blixify-ui-web 1.3.30 → 1.3.32
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.
- package/lib/components/data/columnTypes/groupSections.d.ts +6 -0
- package/lib/components/data/columnTypes/groupSections.d.ts.map +1 -1
- package/lib/components/data/columnTypes/groupSections.js +49 -2
- package/lib/components/data/columnTypes/groupSections.js.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.d.ts +17 -0
- package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +886 -453
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +2 -0
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.js +29 -0
- package/lib/components/data/dataTemplate/viewStatePersistence.js.map +1 -1
- package/package.json +1 -1
|
@@ -257,11 +257,17 @@ exports.handleCheckEmptyCardValue = handleCheckEmptyCardValue;
|
|
|
257
257
|
// INFO: rows a select-all update sends by id at most, and ids per delete
|
|
258
258
|
// request — both keep a request within what the server accepts
|
|
259
259
|
var SELECT_ALL_ID_CAP = 5000;
|
|
260
|
+
// INFO: a select-all delete over this many records runs in batches of record
|
|
261
|
+
// ids, each checked for links and deleted on its own, with progress shown
|
|
262
|
+
var DELETE_BATCH_THRESHOLD = 5000;
|
|
263
|
+
var DELETE_BATCH_SIZE = 2000;
|
|
264
|
+
// INFO: rows the "Can't delete yet" box lists before "and N more"
|
|
265
|
+
var DELETE_BLOCKED_ROWS = 50;
|
|
260
266
|
// INFO: the conditions a server's batch update reads the same way as a list
|
|
261
267
|
var BATCH_UPDATE_QUERY_TYPES = ["=", "!=", ">", "<", "in", "!in"];
|
|
262
268
|
var DELETE_ID_CHUNK = 1000;
|
|
263
269
|
exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
264
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130;
|
|
270
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133;
|
|
265
271
|
// INFO: every view draws a lookup as its source column's type, read-only, so
|
|
266
272
|
// no type branch below meets "lookup"; rawProps.model keeps the lookups as
|
|
267
273
|
// stored for the columns handed back to the host
|
|
@@ -280,7 +286,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
280
286
|
// the list never refetching while the panel is open, which fails silently.
|
|
281
287
|
// INFO: the panel cannot navigate its way out — handleNavigate("read") is
|
|
282
288
|
// routed straight back into it — so expand-to-full-page is local state.
|
|
283
|
-
var
|
|
289
|
+
var _134 = (0, react_1.useState)(false), drawerPageView = _134[0], setDrawerPageView = _134[1];
|
|
284
290
|
// INFO: the panel keeps rendering the record it was opened with rather than
|
|
285
291
|
// live props. Without this, navigating back to the list would re-render the
|
|
286
292
|
// still-mounted panel as a second list behind the overlay.
|
|
@@ -335,7 +341,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
335
341
|
drawerFormEditedRef.current = false;
|
|
336
342
|
}
|
|
337
343
|
drawerOpenRef.current = isDrawerHost;
|
|
338
|
-
var
|
|
344
|
+
var _135 = (0, react_1.useState)(false), drawerDiscardModal = _135[0], setDrawerDiscardModal = _135[1];
|
|
339
345
|
// INFO: leaving the record ends the escape, so the next row opened from the
|
|
340
346
|
// list peeks in the panel again rather than inheriting a full page the user
|
|
341
347
|
// asked for once. Saving a form on the full page lands on its read view, which
|
|
@@ -414,7 +420,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
414
420
|
initialFilterReferenceDate: initialFilterReferenceDate,
|
|
415
421
|
};
|
|
416
422
|
};
|
|
417
|
-
var
|
|
423
|
+
var _136 = intialiseDefaultFilterValues(), initialFilterSearch = _136.initialFilterSearch, initialFilterSearchParams = _136.initialFilterSearchParams, initialFilterSelection = _136.initialFilterSelection, initialFilterReference = _136.initialFilterReference, initialFilterReferenceDate = _136.initialFilterReferenceDate;
|
|
418
424
|
// INFO: organise.initialSearch fills the Quick find box, which sends its
|
|
419
425
|
// value under "search". Without that box (hideSearch, Firebase, or a
|
|
420
426
|
// "search" query taking its place) there is nothing to fill
|
|
@@ -430,19 +436,25 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
430
436
|
// keyword: All's columns and sort, no stored filters, and nothing this
|
|
431
437
|
// person kept in the browser (view drafts, persistViewState) is read or
|
|
432
438
|
// written — until they pick a view, which is their own choice again
|
|
433
|
-
var
|
|
439
|
+
var _137 = (0, react_1.useState)(function () {
|
|
440
|
+
var _a, _b, _c;
|
|
441
|
+
return handleCanInitialSearch((_a = props.organise) === null || _a === void 0 ? void 0 : _a.additionalQuery) ||
|
|
442
|
+
!!((_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.linkFlexFilters) === null || _c === void 0 ? void 0 : _c.length);
|
|
443
|
+
}), isLinkOpen = _137[0], setIsLinkOpen = _137[1];
|
|
434
444
|
var handleSeedInitialSearch = function (params) {
|
|
435
445
|
var _a;
|
|
436
|
-
return isLinkOpen &&
|
|
446
|
+
return isLinkOpen &&
|
|
447
|
+
((_a = props.organise) === null || _a === void 0 ? void 0 : _a.initialSearch) &&
|
|
448
|
+
handleCanInitialSearch(props.organise.additionalQuery)
|
|
437
449
|
? __assign(__assign({}, params), { search: props.organise.initialSearch }) : params;
|
|
438
450
|
};
|
|
439
451
|
// INFO: Persist view state hook — handles storage read/write for filter/sort/column state
|
|
440
|
-
var
|
|
452
|
+
var _138 = (0, viewStatePersistence_1.usePersistedViewState)({
|
|
441
453
|
mode: isLinkOpen ? undefined : (_k = props.organise) === null || _k === void 0 ? void 0 : _k.persistViewState,
|
|
442
454
|
collectionId: props.collectionId,
|
|
443
455
|
persistKey: (_l = props.organise) === null || _l === void 0 ? void 0 : _l.persistKey,
|
|
444
456
|
type: resolvedType,
|
|
445
|
-
}), rawPersistedState =
|
|
457
|
+
}), rawPersistedState = _138.persistedState, isPersistEnabled = _138.isEnabled, handleSaveView = _138.handleSaveView, handleRegisterViewSnapshot = _138.handleRegisterViewSnapshot;
|
|
446
458
|
// INFO: drop stored filters/sort on removed columns — they would empty the table
|
|
447
459
|
var persistedState = (0, react_1.useMemo)(function () {
|
|
448
460
|
var _a, _b, _c, _d;
|
|
@@ -458,8 +470,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
458
470
|
(_o = props.bareSettings) === null || _o === void 0 ? void 0 : _o.bareFlexFilterListObjects,
|
|
459
471
|
(_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareFlexFilterRelated,
|
|
460
472
|
]);
|
|
461
|
-
var
|
|
462
|
-
var
|
|
473
|
+
var _139 = (0, react_1.useState)(false), loading = _139[0], setLoading = _139[1];
|
|
474
|
+
var _140 = (0, react_1.useState)(), notification = _140[0], setNotification = _140[1];
|
|
463
475
|
// INFO: a success toast is confirmation, not a decision — it clears itself so
|
|
464
476
|
// it never sits on the floating step bar; errors stay until dismissed
|
|
465
477
|
(0, react_1.useEffect)(function () {
|
|
@@ -469,80 +481,80 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
469
481
|
return function () { return clearTimeout(timer); };
|
|
470
482
|
}, [notification]);
|
|
471
483
|
//INFO : Used by List
|
|
472
|
-
var
|
|
484
|
+
var _141 = (0, react_1.useState)(function () {
|
|
473
485
|
var _a;
|
|
474
486
|
return handleSeedInitialSearch((_a = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _a !== void 0 ? _a : initialFilterSearch);
|
|
475
|
-
}), filterSearch =
|
|
476
|
-
var
|
|
487
|
+
}), filterSearch = _141[0], setFilterSearch = _141[1];
|
|
488
|
+
var _142 = (0, react_1.useState)(function () {
|
|
477
489
|
var _a;
|
|
478
490
|
return handleSeedInitialSearch((_a = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _a !== void 0 ? _a : initialFilterSearchParams);
|
|
479
|
-
}), filterSearchParams =
|
|
480
|
-
var
|
|
481
|
-
var
|
|
482
|
-
var
|
|
483
|
-
var
|
|
484
|
-
var
|
|
491
|
+
}), filterSearchParams = _142[0], setFilterSearchParams = _142[1];
|
|
492
|
+
var _143 = (0, react_1.useState)((_q = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _q !== void 0 ? _q : initialFilterSelection), filterSelection = _143[0], setFilterSelection = _143[1];
|
|
493
|
+
var _144 = (0, react_1.useState)((_r = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _r !== void 0 ? _r : initialFilterReference), filterReference = _144[0], setFilterReference = _144[1];
|
|
494
|
+
var _145 = (0, react_1.useState)({}), filterReferenceSearch = _145[0], setFilterReferenceSearch = _145[1];
|
|
495
|
+
var _146 = (0, react_1.useState)({}), filterReferenceList = _146[0], setFilterReferenceList = _146[1];
|
|
496
|
+
var _147 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
|
|
485
497
|
? (0, viewStatePersistence_1.parseDateFilterState)(persistedState.filterReferenceDate)
|
|
486
|
-
: initialFilterReferenceDate), filterReferenceDate =
|
|
487
|
-
var
|
|
488
|
-
var
|
|
489
|
-
var
|
|
490
|
-
var
|
|
491
|
-
var
|
|
498
|
+
: initialFilterReferenceDate), filterReferenceDate = _147[0], setFilterReferenceDate = _147[1];
|
|
499
|
+
var _148 = (0, react_1.useState)(true), tableLoading = _148[0], setTableLoading = _148[1];
|
|
500
|
+
var _149 = (0, react_1.useState)(""), cursor = _149[0], setCursor = _149[1];
|
|
501
|
+
var _150 = (0, react_1.useState)(""), lastCursor = _150[0], setLastCursor = _150[1];
|
|
502
|
+
var _151 = (0, react_1.useState)([]), tableData = _151[0], setTableData = _151[1];
|
|
503
|
+
var _152 = (0, react_1.useState)([]), spaceTableData = _152[0], setSpaceTableData = _152[1];
|
|
492
504
|
// INFO: a save resolves after later renders, so it reads the table from here —
|
|
493
505
|
// the state it closed over can predate an earlier save on the same row
|
|
494
506
|
var tableDataRef = (0, react_1.useRef)([]);
|
|
495
507
|
var spaceTableDataRef = (0, react_1.useRef)([]);
|
|
496
508
|
tableDataRef.current = tableData;
|
|
497
509
|
spaceTableDataRef.current = spaceTableData;
|
|
498
|
-
var
|
|
499
|
-
var
|
|
510
|
+
var _153 = (0, react_1.useState)(0), size = _153[0], setSize = _153[1];
|
|
511
|
+
var _154 = (0, react_1.useState)((_u = (_s = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _s !== void 0 ? _s : (_t = props.organise) === null || _t === void 0 ? void 0 : _t.pageIndex) !== null && _u !== void 0 ? _u : 0), pageIndex = _154[0], setPageIndex = _154[1];
|
|
500
512
|
// INFO: every change of page, including the return to the first page when a
|
|
501
513
|
// filter or search changes, which onChangePagination does not always report
|
|
502
514
|
(0, react_1.useEffect)(function () {
|
|
503
515
|
var _a, _b;
|
|
504
516
|
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangePageIndex) === null || _b === void 0 ? void 0 : _b.call(_a, pageIndex);
|
|
505
517
|
}, [pageIndex]);
|
|
506
|
-
var
|
|
507
|
-
var
|
|
508
|
-
var
|
|
509
|
-
var
|
|
510
|
-
var
|
|
518
|
+
var _155 = (0, react_1.useState)([]), selectedIds = _155[0], setSelectedIds = _155[1];
|
|
519
|
+
var _156 = (0, react_1.useState)(false), selectAll = _156[0], setSelectAll = _156[1];
|
|
520
|
+
var _157 = (0, react_1.useState)(""), deletePasscode = _157[0], setDeletePasscode = _157[1];
|
|
521
|
+
var _158 = (0, react_1.useState)(""), deletePasscodeInput = _158[0], setDeletePasscodeInput = _158[1];
|
|
522
|
+
var _159 = (0, react_1.useState)(""), deleteFeedId = _159[0], setDeleteFeedId = _159[1];
|
|
511
523
|
//INFO : Used by List Organise
|
|
512
524
|
// INFO: Internal sort state that overrides props.organise?.sort when
|
|
513
525
|
// persistViewState is enabled and a persisted sort exists
|
|
514
|
-
var
|
|
515
|
-
var
|
|
516
|
-
var
|
|
517
|
-
var
|
|
526
|
+
var _160 = (0, react_1.useState)((_v = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _v !== void 0 ? _v : undefined), persistedSort = _160[0], setPersistedSort = _160[1];
|
|
527
|
+
var _161 = (0, react_1.useState)(false), filterDraft = _161[0], setFilterDraft = _161[1];
|
|
528
|
+
var _162 = (0, react_1.useState)(false), addTabModal = _162[0], setAddTabModal = _162[1];
|
|
529
|
+
var _163 = (0, react_1.useState)(-1), editTabIndex = _163[0], setEditTabIndex = _163[1];
|
|
518
530
|
//INFO : resolve the initial tab synchronously so the mount cond is already
|
|
519
531
|
// tab-scoped — an empty initial tab caused a second wasted list fetch
|
|
520
|
-
var
|
|
532
|
+
var _164 = (0, react_1.useState)(function () {
|
|
521
533
|
var _a;
|
|
522
534
|
return (0, listModule_1.renderSelectedRefreshTab)(props.localURLEndpoint, resolvedType, props.collectionId, props.id, (_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs, listViewId);
|
|
523
|
-
}), selectedTab =
|
|
524
|
-
var
|
|
535
|
+
}), selectedTab = _164[0], setSelectedTab = _164[1];
|
|
536
|
+
var _165 = (0, react_1.useState)("dayGridMonth"), calendarView = _165[0], setCalendarView = _165[1];
|
|
525
537
|
// INFO: bareNewDTW calendar viewSwitch mode — drives the NewCalendar variant
|
|
526
538
|
// (calendarView above drives the matching range query)
|
|
527
|
-
var
|
|
528
|
-
var
|
|
539
|
+
var _166 = (0, react_1.useState)("month"), newCalendarViewMode = _166[0], setNewCalendarViewMode = _166[1];
|
|
540
|
+
var _167 = (0, react_1.useState)(new Date()), calendarTabMonth = _167[0], setCalendarTabMonth = _167[1];
|
|
529
541
|
// INFO: read once per theme — it asks the browser to resolve a style
|
|
530
542
|
var timelinePrimaryColour = (0, react_1.useMemo)(function () { return (0, timelineBars_1.handleReadPrimaryColour)(); },
|
|
531
543
|
/* eslint-disable-next-line */
|
|
532
544
|
[(_w = props.organise) === null || _w === void 0 ? void 0 : _w.darkMode]);
|
|
533
545
|
// INFO: the period a timeline shows — it reads only the records whose bars
|
|
534
546
|
// overlap it, so a large datasheet loads one month or quarter at a time
|
|
535
|
-
var
|
|
547
|
+
var _168 = (0, react_1.useState)({ unit: "month", anchor: new Date() }), timelineRange = _168[0], setTimelineRange = _168[1];
|
|
536
548
|
// INFO: defaultViewSwitch picks the opening view only — the tab re-inits
|
|
537
549
|
// whenever its settings change, and that must not undo the user's switch
|
|
538
550
|
var calendarViewInitRef = (0, react_1.useRef)(false);
|
|
539
|
-
var
|
|
540
|
-
var
|
|
541
|
-
var
|
|
542
|
-
var
|
|
551
|
+
var _169 = (0, react_1.useState)(true), kanbanDroppable = _169[0], setKanbanDroppable = _169[1];
|
|
552
|
+
var _170 = (0, react_1.useState)([]), kanbanOptions = _170[0], setKanbanOptions = _170[1];
|
|
553
|
+
var _171 = (0, react_1.useState)(false), batchUpdateModal = _171[0], setBatchUpdateModal = _171[1];
|
|
554
|
+
var _172 = (0, react_1.useState)({
|
|
543
555
|
columnId: "",
|
|
544
556
|
columnData: {},
|
|
545
|
-
}), batchUpdateData =
|
|
557
|
+
}), batchUpdateData = _172[0], setBatchUpdateData = _172[1];
|
|
546
558
|
// INFO: system columns (created / updated at and by, record id, number)
|
|
547
559
|
// join the structure hidden; the ones a user shows are kept per view
|
|
548
560
|
var isSystemColumnsEnabled = !!((_x = props.bareSettings) === null || _x === void 0 ? void 0 : _x.bareSystemColumns);
|
|
@@ -550,12 +562,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
550
562
|
var appendedSystemColumnIds = isSystemColumnsEnabled
|
|
551
563
|
? systemColumns_1.SYSTEM_COLUMN_IDS.filter(function (eachId) { var _a; return !((_a = props.model) !== null && _a !== void 0 ? _a : []).some(function (each) { return each.id === eachId; }); })
|
|
552
564
|
: [];
|
|
553
|
-
var
|
|
565
|
+
var _173 = (0, react_1.useState)((_z = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _z !== void 0 ? _z : []), shownSystemColumnIds = _173[0], setShownSystemColumnIds = _173[1];
|
|
554
566
|
var handleWithSystemColumns = function (model, shownIds) {
|
|
555
567
|
if (shownIds === void 0) { shownIds = shownSystemColumnIds; }
|
|
556
568
|
return isSystemColumnsEnabled ? (0, systemColumns_1.handleAppendSystemColumns)(model, shownIds) : model;
|
|
557
569
|
};
|
|
558
|
-
var
|
|
570
|
+
var _174 = (0, react_1.useState)(function () {
|
|
559
571
|
var _a;
|
|
560
572
|
var baseModel = handleWithSystemColumns((props === null || props === void 0 ? void 0 : props.model) || [], (_a = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _a !== void 0 ? _a : []);
|
|
561
573
|
if (!persistedState)
|
|
@@ -582,8 +594,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
582
594
|
});
|
|
583
595
|
}
|
|
584
596
|
return model;
|
|
585
|
-
}), structure =
|
|
586
|
-
var
|
|
597
|
+
}), structure = _174[0], setStructure = _174[1];
|
|
598
|
+
var _175 = (0, react_1.useState)(((_0 = props === null || props === void 0 ? void 0 : props.organise) === null || _0 === void 0 ? void 0 : _0.additionalQuery) || []), additionalQuery = _175[0], setAdditionalQuery = _175[1];
|
|
587
599
|
// INFO: State for user-configurable flex filters (Monday.com-style)
|
|
588
600
|
// INFO: Initialize with one empty row so users see inputs immediately without clicking "Add Filter"
|
|
589
601
|
var defaultFlexFilterRow = [
|
|
@@ -595,13 +607,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
595
607
|
},
|
|
596
608
|
];
|
|
597
609
|
// INFO: rows the host opens the list with come before a saved view's
|
|
598
|
-
var initialFlexFilterRows = ((_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.
|
|
599
|
-
props.organise.
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
?
|
|
603
|
-
:
|
|
604
|
-
|
|
610
|
+
var initialFlexFilterRows = ((_2 = (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.linkFlexFilters) === null || _2 === void 0 ? void 0 : _2.length)
|
|
611
|
+
? props.organise.linkFlexFilters
|
|
612
|
+
: ((_3 = props.organise) === null || _3 === void 0 ? void 0 : _3.initialFlexFilters) &&
|
|
613
|
+
props.organise.initialFlexFilters.length > 0
|
|
614
|
+
? props.organise.initialFlexFilters
|
|
615
|
+
: (persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
|
|
616
|
+
? persistedState.flexFilters
|
|
617
|
+
: defaultFlexFilterRow;
|
|
618
|
+
var _176 = (0, react_1.useState)(initialFlexFilterRows), flexFilters = _176[0], setFlexFilters = _176[1];
|
|
605
619
|
// INFO: always-current mirror of flexFilters, read by the imperative apply/
|
|
606
620
|
// clear methods so chained calls in one tick aren't stale.
|
|
607
621
|
var flexFiltersRef = (0, react_1.useRef)(flexFilters);
|
|
@@ -614,111 +628,113 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
614
628
|
}, [flexFilters]);
|
|
615
629
|
// INFO: Debounced version of flexFilters used by renderImpSearchFilterConditions
|
|
616
630
|
// to prevent API calls on every keystroke when typing in value inputs
|
|
617
|
-
var
|
|
631
|
+
var _177 = (0, react_1.useState)(initialFlexFilterRows), flexFiltersDebounced = _177[0], setFlexFiltersDebounced = _177[1];
|
|
618
632
|
// INFO: the filter rows of the export being set up — started from the
|
|
619
633
|
// list's own when the export opens, so changing them leaves the list as it is
|
|
620
|
-
var
|
|
621
|
-
var
|
|
622
|
-
var
|
|
623
|
-
var
|
|
624
|
-
var
|
|
634
|
+
var _178 = (0, react_1.useState)(defaultFlexFilterRow), exportFlexFilters = _178[0], setExportFlexFilters = _178[1];
|
|
635
|
+
var _179 = (0, react_1.useState)({}), flexFilterReferenceOptions = _179[0], setFlexFilterReferenceOptions = _179[1];
|
|
636
|
+
var _180 = (0, react_1.useState)({}), flexFilterReferenceSearch = _180[0], setFlexFilterReferenceSearch = _180[1];
|
|
637
|
+
var _181 = (0, react_1.useState)(false), flexFilterModalOpen = _181[0], setFlexFilterModalOpen = _181[1];
|
|
638
|
+
var _182 = (0, react_1.useState)(false), viewSettingsModalOpen = _182[0], setViewSettingsModalOpen = _182[1];
|
|
625
639
|
// INFO: Columns the end user chose to hide (bareSettings.bareViewSettings).
|
|
626
640
|
// Deliberately kept out of `structure`: the props-sync effect below resets
|
|
627
641
|
// structure to props.model whenever props change, which would wipe the
|
|
628
642
|
// choice, and the persist effect derives schema-level hiddenColumnIds from
|
|
629
643
|
// structure — writing user hides there would blur the two concepts.
|
|
630
|
-
var
|
|
631
|
-
var
|
|
632
|
-
var
|
|
633
|
-
var
|
|
644
|
+
var _183 = (0, react_1.useState)((_4 = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _4 !== void 0 ? _4 : []), userHiddenColumnIds = _183[0], setUserHiddenColumnIds = _183[1];
|
|
645
|
+
var _184 = (0, react_1.useState)(""), columnSearch = _184[0], setColumnSearch = _184[1];
|
|
646
|
+
var _185 = (0, react_1.useState)([]), savedViews = _185[0], setSavedViews = _185[1];
|
|
647
|
+
var _186 = (0, react_1.useState)(null), activeSavedViewId = _186[0], setActiveSavedViewId = _186[1];
|
|
634
648
|
// INFO: the widths of the view on screen, by column id ("180px")
|
|
635
|
-
var
|
|
649
|
+
var _187 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.columnWidths) !== null && _c !== void 0 ? _c : {}; }), columnWidths = _187[0], setColumnWidths = _187[1];
|
|
636
650
|
// INFO: the kanban lane widths of the view on screen, by lane id ("300px")
|
|
637
|
-
var
|
|
651
|
+
var _188 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.laneWidths) !== null && _c !== void 0 ? _c : {}; }), laneWidths = _188[0], setLaneWidths = _188[1];
|
|
638
652
|
// INFO: the read drawer's dragged width ("520px"), kept in the view with the
|
|
639
653
|
// column widths. A restored persistViewState wins over All's, as a saved
|
|
640
654
|
// view or draft applied at opening replaces both
|
|
641
|
-
var
|
|
655
|
+
var _189 = (0, react_1.useState)(function () {
|
|
642
656
|
var _a, _b, _c;
|
|
643
657
|
return (_a = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.drawerWidth : undefined)) !== null && _a !== void 0 ? _a : (_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.allView) === null || _c === void 0 ? void 0 : _c.drawerWidth;
|
|
644
|
-
}), drawerWidth =
|
|
658
|
+
}), drawerWidth = _189[0], setDrawerWidth = _189[1];
|
|
645
659
|
// INFO: the columns the view on screen freezes at the left edge
|
|
646
|
-
var
|
|
660
|
+
var _190 = (0, react_1.useState)(function () { var _a, _b; return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.pinnedColumnIds; }), pinnedColumnIds = _190[0], setPinnedColumnIds = _190[1];
|
|
647
661
|
// INFO: unsaved changes are kept only once the opening view is on screen,
|
|
648
662
|
// so the defaults drawn before it never overwrite a person's own
|
|
649
|
-
var
|
|
663
|
+
var _191 = (0, react_1.useState)(false), isViewDraftReady = _191[0], setIsViewDraftReady = _191[1];
|
|
650
664
|
// INFO: null while the name box is closed
|
|
651
|
-
var
|
|
652
|
-
var
|
|
665
|
+
var _192 = (0, react_1.useState)(null), savedViewName = _192[0], setSavedViewName = _192[1];
|
|
666
|
+
var _193 = (0, react_1.useState)(null), deletingSavedViewId = _193[0], setDeletingSavedViewId = _193[1];
|
|
653
667
|
// INFO: the view chip being dragged, to drop it in another place
|
|
654
|
-
var
|
|
668
|
+
var _194 = (0, react_1.useState)(null), draggingSavedViewId = _194[0], setDraggingSavedViewId = _194[1];
|
|
655
669
|
// INFO: the tab strip in the order a drag has reached, saved once on drop
|
|
656
|
-
var
|
|
657
|
-
var
|
|
658
|
-
var
|
|
659
|
-
var
|
|
670
|
+
var _195 = (0, react_1.useState)(null), draggedTabs = _195[0], setDraggedTabs = _195[1];
|
|
671
|
+
var _196 = (0, react_1.useState)(null), renamingSavedView = _196[0], setRenamingSavedView = _196[1];
|
|
672
|
+
var _197 = (0, react_1.useState)(false), isSavedViewsExpanded = _197[0], setIsSavedViewsExpanded = _197[1];
|
|
673
|
+
var _198 = (0, react_1.useState)(null), draggingColumnId = _198[0], setDraggingColumnId = _198[1];
|
|
660
674
|
var columnRowRefs = (0, react_1.useRef)({});
|
|
661
675
|
//INFO : Used by Auth
|
|
662
|
-
var
|
|
676
|
+
var _199 = (0, react_1.useState)({
|
|
663
677
|
email: "",
|
|
664
678
|
google: "",
|
|
665
679
|
phone: "",
|
|
666
680
|
disabled: false,
|
|
667
681
|
create: false,
|
|
668
|
-
}), authMethods =
|
|
669
|
-
var
|
|
682
|
+
}), authMethods = _199[0], setAuthMethods = _199[1];
|
|
683
|
+
var _200 = (0, react_1.useState)(""), selectedAuthMethod = _200[0], setSelectedAuthMethod = _200[1];
|
|
670
684
|
// INFO: the sign-in check of a users datasheet's record is running; the
|
|
671
685
|
// panel shows a spinner rather than nothing, which read as "no login"
|
|
672
|
-
var
|
|
686
|
+
var _201 = (0, react_1.useState)(false), authLoading = _201[0], setAuthLoading = _201[1];
|
|
673
687
|
// INFO: a delete is running — the ref answers a second tap at once, before
|
|
674
688
|
// the state has rendered, and the state disables the confirm button
|
|
675
689
|
var deletingRef = (0, react_1.useRef)(false);
|
|
676
|
-
var
|
|
690
|
+
var _202 = (0, react_1.useState)(false), deleting = _202[0], setDeleting = _202[1];
|
|
677
691
|
// INFO: Used by Activity Log
|
|
678
|
-
var
|
|
679
|
-
var
|
|
692
|
+
var _203 = (0, react_1.useState)(false), activityModal = _203[0], setActivityModal = _203[1];
|
|
693
|
+
var _204 = (0, react_1.useState)(""), activityId = _204[0], setActivityId = _204[1];
|
|
680
694
|
//INFO : Used by Export
|
|
681
|
-
var
|
|
682
|
-
var
|
|
683
|
-
var
|
|
684
|
-
var
|
|
685
|
-
var
|
|
686
|
-
var
|
|
687
|
-
var
|
|
688
|
-
var
|
|
689
|
-
var
|
|
690
|
-
var
|
|
691
|
-
var
|
|
692
|
-
var
|
|
693
|
-
var
|
|
694
|
-
var
|
|
695
|
-
var
|
|
695
|
+
var _205 = (0, react_1.useState)(null), csvFile = _205[0], setCSVFile = _205[1];
|
|
696
|
+
var _206 = (0, react_1.useState)([]), csvFileData = _206[0], setCSVFileData = _206[1];
|
|
697
|
+
var _207 = (0, react_1.useState)(0), stepCSVIndex = _207[0], setStepCSVIndex = _207[1];
|
|
698
|
+
var _208 = (0, react_1.useState)({}), listCSVMapAttribute = _208[0], setListCSVMapAttribute = _208[1];
|
|
699
|
+
var _209 = (0, react_1.useState)({}), listCSVObjAttribute = _209[0], setListCSVObjAttribute = _209[1];
|
|
700
|
+
var _210 = (0, react_1.useState)([]), csvAPIAttribute = _210[0], setCSVAPIAttribute = _210[1];
|
|
701
|
+
var _211 = (0, react_1.useState)(((_5 = props.devSettings.currentUser) === null || _5 === void 0 ? void 0 : _5.userEmail) || ""), exportCSVEmail = _211[0], setExportCSVEmail = _211[1];
|
|
702
|
+
var _212 = (0, react_1.useState)(((_7 = (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.exportSettings) === null || _7 === void 0 ? void 0 : _7.defaultExportPDFName) || ""), exportPDFTitle = _212[0], setExportPDFTitle = _212[1];
|
|
703
|
+
var _213 = (0, react_1.useState)(false), exportPDFLoading = _213[0], setExportPDFLoading = _213[1];
|
|
704
|
+
var _214 = (0, react_1.useState)(false), exportReadPDFLoading = _214[0], setExportReadPDFLoading = _214[1];
|
|
705
|
+
var _215 = (0, react_1.useState)((_10 = (_9 = (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.exportSettings) === null || _9 === void 0 ? void 0 : _9.sumColumnId) !== null && _10 !== void 0 ? _10 : []), exportSumAttributeIds = _215[0], setExportSumAttributeIds = _215[1];
|
|
706
|
+
var _216 = (0, react_1.useState)((_13 = (_12 = (_11 = props.organise) === null || _11 === void 0 ? void 0 : _11.exportSettings) === null || _12 === void 0 ? void 0 : _12.hideSubItems) !== null && _13 !== void 0 ? _13 : false), hideSubItems = _216[0], setHideSubItems = _216[1];
|
|
707
|
+
var _217 = (0, react_1.useState)([]), importTableData = _217[0], setImportTableData = _217[1];
|
|
708
|
+
var _218 = (0, react_1.useState)([]), queryList = _218[0], setQueryList = _218[1];
|
|
709
|
+
var _219 = (0, react_1.useState)(undefined), allQueryList = _219[0], setAllQueryList = _219[1];
|
|
696
710
|
// INFO: a restored state wins over the prop; its "" is a list the user
|
|
697
711
|
// ungrouped, so it opens ungrouped
|
|
698
|
-
var
|
|
712
|
+
var _220 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
|
|
699
713
|
? persistedState.groupBy || undefined
|
|
700
|
-
: (
|
|
714
|
+
: (_14 = props.organise) === null || _14 === void 0 ? void 0 : _14.groupBy), groupId = _220[0], setGroupId = _220[1];
|
|
715
|
+
// INFO: groups by their record count, or in the column's own order
|
|
716
|
+
var _221 = (0, react_1.useState)((_15 = persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupOrder) !== null && _15 !== void 0 ? _15 : ""), groupOrder = _221[0], setGroupOrder = _221[1];
|
|
701
717
|
// INFO: each group's total per number column, keyed by section id
|
|
702
|
-
var
|
|
718
|
+
var _222 = (0, react_1.useState)({}), groupSummaries = _222[0], setGroupSummaries = _222[1];
|
|
703
719
|
// INFO: each group's row count over every row the filters match; null until
|
|
704
720
|
// read. A band paged alone shows it until its own first page lands, and a
|
|
705
721
|
// band it counts empty is left out instead of waiting to be read
|
|
706
|
-
var
|
|
722
|
+
var _223 = (0, react_1.useState)(null), groupTotals = _223[0], setGroupTotals = _223[1];
|
|
707
723
|
// INFO: the last read of groupTotals failed, so bands fall back to the rows
|
|
708
724
|
// loaded instead of waiting on a total that is not coming
|
|
709
|
-
var
|
|
725
|
+
var _224 = (0, react_1.useState)(false), groupTotalsFailed = _224[0], setGroupTotalsFailed = _224[1];
|
|
710
726
|
var groupSummaryRequestRef = (0, react_1.useRef)(0);
|
|
711
727
|
// INFO: the grouped count waiting to go out, so a filter change can stop it
|
|
712
728
|
// before it sends the filters it was scheduled with
|
|
713
729
|
var groupSummaryTimerRef = (0, react_1.useRef)(null);
|
|
714
|
-
var
|
|
715
|
-
var
|
|
730
|
+
var _225 = (0, react_1.useState)({}), commentCounts = _225[0], setCommentCounts = _225[1];
|
|
731
|
+
var _226 = (0, react_1.useState)({}), commentUnread = _226[0], setCommentUnread = _226[1];
|
|
716
732
|
// INFO: Monday-board per-group paging. Keyed by the group key that
|
|
717
733
|
// handleBuildNewTableGroups() produces (an option, Unknown or No Value).
|
|
718
734
|
// Each group tracks its own loaded cursor + total so it can lazily load its
|
|
719
735
|
// next page as the user scrolls inside that band, independent of every other
|
|
720
736
|
// group. Only used when renderCheckGroupPaging() is true.
|
|
721
|
-
var
|
|
737
|
+
var _227 = (0, react_1.useState)({}), groupPageState = _227[0], setGroupPageState = _227[1];
|
|
722
738
|
// INFO: read fresh inside the async per-group fetch so chained scroll fires
|
|
723
739
|
// in one tick do not re-fetch an already in-flight page.
|
|
724
740
|
var groupPageStateRef = (0, react_1.useRef)({});
|
|
@@ -733,62 +749,84 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
733
749
|
var groupLoadingKeyRef = (0, react_1.useRef)(null);
|
|
734
750
|
var groupLoadQueueRef = (0, react_1.useRef)([]);
|
|
735
751
|
var handleFetchGroupNextPageRef = (0, react_1.useRef)(function () { });
|
|
736
|
-
var
|
|
737
|
-
var
|
|
752
|
+
var _228 = (0, react_1.useState)(""), readTabSection = _228[0], setReadTabSection = _228[1];
|
|
753
|
+
var _229 = (0, react_1.useState)(false), readFloatingNav = _229[0], setReadFloatingNav = _229[1];
|
|
738
754
|
var readTabSectionRefs = (0, react_1.useRef)({});
|
|
739
755
|
//INFO : Used by Read
|
|
740
756
|
//INFO : Used by Update
|
|
741
|
-
var
|
|
742
|
-
var
|
|
743
|
-
var
|
|
744
|
-
var
|
|
745
|
-
var
|
|
746
|
-
var
|
|
747
|
-
var
|
|
757
|
+
var _230 = (0, react_1.useState)(false), modalVisible = _230[0], setModalVisible = _230[1];
|
|
758
|
+
var _231 = (0, react_1.useState)(false), deleteModal = _231[0], setDeleteModal = _231[1];
|
|
759
|
+
var _232 = (0, react_1.useState)(false), excelModal = _232[0], setExcelModal = _232[1];
|
|
760
|
+
var _233 = (0, react_1.useState)(false), exportExcel = _233[0], setExportExcel = _233[1];
|
|
761
|
+
var _234 = (0, react_1.useState)(""), exportType = _234[0], setExportType = _234[1];
|
|
762
|
+
var _235 = (0, react_1.useState)(false), exportQR = _235[0], setExportQR = _235[1];
|
|
763
|
+
var _236 = (0, react_1.useState)(function () {
|
|
748
764
|
var _a, _b;
|
|
749
765
|
var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
|
|
750
766
|
return firstTabId;
|
|
751
|
-
}), activeTab =
|
|
752
|
-
var
|
|
753
|
-
var
|
|
754
|
-
var
|
|
755
|
-
var
|
|
756
|
-
var
|
|
757
|
-
var
|
|
758
|
-
var
|
|
767
|
+
}), activeTab = _236[0], setActiveTab = _236[1];
|
|
768
|
+
var _237 = (0, react_1.useState)(false), signatureSigning = _237[0], setSignatureSigning = _237[1];
|
|
769
|
+
var _238 = (0, react_1.useState)({}), selectedData = _238[0], setSelectedData = _238[1];
|
|
770
|
+
var _239 = (0, react_1.useState)(""), selectedObjectStructureId = _239[0], setSelectedObjectStructureId = _239[1];
|
|
771
|
+
var _240 = (0, react_1.useState)(""), selectedObjectId = _240[0], setSelectedObjectId = _240[1];
|
|
772
|
+
var _241 = (0, react_1.useState)(""), selectedListAddressId = _241[0], setSelectedListAddressId = _241[1];
|
|
773
|
+
var _242 = (0, react_1.useState)(-1), selectedListAddressIndex = _242[0], setSelectedListAddressIndex = _242[1];
|
|
774
|
+
var _243 = (0, react_1.useState)({
|
|
759
775
|
lat: 0,
|
|
760
776
|
lng: 0,
|
|
761
777
|
name: "",
|
|
762
|
-
}), selectedListAddress =
|
|
763
|
-
var
|
|
764
|
-
var
|
|
765
|
-
var
|
|
766
|
-
var
|
|
767
|
-
var
|
|
768
|
-
var
|
|
778
|
+
}), selectedListAddress = _243[0], setSelectedListAddress = _243[1];
|
|
779
|
+
var _244 = (0, react_1.useState)({}), selectedObjectData = _244[0], setSelectedObjectData = _244[1];
|
|
780
|
+
var _245 = (0, react_1.useState)(null), objectCellEdit = _245[0], setObjectCellEdit = _245[1];
|
|
781
|
+
var _246 = (0, react_1.useState)(false), referenceLoading = _246[0], setReferenceLoading = _246[1];
|
|
782
|
+
var _247 = (0, react_1.useState)({}), referencesOptions = _247[0], setReferencesOptions = _247[1];
|
|
783
|
+
var _248 = (0, react_1.useState)({}), referencesDetails = _248[0], setReferencesDetails = _248[1];
|
|
784
|
+
var _249 = (0, react_1.useState)({}), listReferencesOptions = _249[0], setListReferencesOptions = _249[1];
|
|
769
785
|
// INFO: the referenced records themselves, for a table cell that picks from
|
|
770
786
|
// a list on one (referenceSelection)
|
|
771
|
-
var
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
var
|
|
775
|
-
|
|
787
|
+
var _250 = (0, react_1.useState)({}), listReferencesDetails = _250[0], setListReferencesDetails = _250[1];
|
|
788
|
+
// INFO: each record that could not be deleted, by the datasheet still
|
|
789
|
+
// linking to it
|
|
790
|
+
var _251 = (0, react_1.useState)([]), referenceDeleteTableData = _251[0], setReferenceDeleteTableData = _251[1];
|
|
791
|
+
// INFO: the records a delete left because they are still linked — what
|
|
792
|
+
// "Delete anyway" deletes
|
|
793
|
+
var blockedDeleteIdsRef = (0, react_1.useRef)([]);
|
|
794
|
+
// INFO: "Delete anyway" is for a list's delete; a single record's delete
|
|
795
|
+
// has its own steps around it
|
|
796
|
+
var isBlockedFromListRef = (0, react_1.useRef)(false);
|
|
797
|
+
var _252 = (0, react_1.useState)(false), isDeleteAnywayConfirm = _252[0], setIsDeleteAnywayConfirm = _252[1];
|
|
798
|
+
// INFO: a batched delete stops when the list goes away mid-run
|
|
799
|
+
var isMountedRef = (0, react_1.useRef)(true);
|
|
800
|
+
(0, react_1.useEffect)(function () {
|
|
801
|
+
isMountedRef.current = true;
|
|
802
|
+
return function () {
|
|
803
|
+
isMountedRef.current = false;
|
|
804
|
+
};
|
|
805
|
+
}, []);
|
|
806
|
+
// INFO: each box opens with "Delete anyway" not yet confirmed
|
|
807
|
+
(0, react_1.useEffect)(function () {
|
|
808
|
+
setIsDeleteAnywayConfirm(false);
|
|
809
|
+
}, [referenceDeleteTableData]);
|
|
810
|
+
// INFO: how far a batched delete has got, shown while it runs
|
|
811
|
+
var _253 = (0, react_1.useState)(null), deleteProgress = _253[0], setDeleteProgress = _253[1];
|
|
812
|
+
var _254 = (0, react_1.useState)([]), relatedSections = _254[0], setRelatedSections = _254[1];
|
|
813
|
+
var _255 = (0, react_1.useState)({
|
|
776
814
|
id: "",
|
|
777
815
|
name: "",
|
|
778
816
|
type: "string",
|
|
779
|
-
}), referenceCreationModal =
|
|
780
|
-
var
|
|
781
|
-
var
|
|
817
|
+
}), referenceCreationModal = _255[0], setReferenceCreationModal = _255[1];
|
|
818
|
+
var _256 = (0, react_1.useState)({}), referenceModelSchema = _256[0], setReferenceSchema = _256[1];
|
|
819
|
+
var _257 = (0, react_1.useState)([]), kanbanChecked = _257[0], setKanbanChecked = _257[1];
|
|
782
820
|
//INFO : Offline
|
|
783
|
-
var
|
|
784
|
-
var
|
|
821
|
+
var _258 = (0, react_1.useState)(0), offlineDataLength = _258[0], setOfflineDataLength = _258[1];
|
|
822
|
+
var _259 = (0, react_1.useState)(false), offlineModal = _259[0], setOfflineModal = _259[1];
|
|
785
823
|
// INFO: live-stream state — driven by socket connection and navigator.onLine
|
|
786
|
-
var
|
|
787
|
-
var
|
|
824
|
+
var _260 = (0, react_1.useState)(false), isLive = _260[0], setIsLive = _260[1];
|
|
825
|
+
var _261 = (0, react_1.useState)(false), isLiveOffline = _261[0], setIsLiveOffline = _261[1];
|
|
788
826
|
// INFO: true when navigator is offline — used to switch ReadQueryHoc between
|
|
789
827
|
// server reads (online, full pagination) and IndexedDB reads (offline, cached data).
|
|
790
828
|
// Independent of SSE status so it works even when bareSocketName is not set.
|
|
791
|
-
var
|
|
829
|
+
var _262 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _262[0], setIsNetworkOffline = _262[1];
|
|
792
830
|
var previousType = (0, react_1.useRef)(null);
|
|
793
831
|
var previousSelectedData = (0, react_1.useRef)(null);
|
|
794
832
|
var scrollSentinelRef = (0, react_1.useRef)(null);
|
|
@@ -938,7 +976,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
938
976
|
* viewId still wins when present: it is a deliberate destination, from a
|
|
939
977
|
* shared link or a back button.
|
|
940
978
|
*/
|
|
941
|
-
var defaultTabName = (
|
|
979
|
+
var defaultTabName = (_18 = (_17 = (_16 = props.organise) === null || _16 === void 0 ? void 0 : _16.extendedTabs) === null || _17 === void 0 ? void 0 : _17.find(function (eachTab) { return eachTab.defaultTab; })) === null || _18 === void 0 ? void 0 : _18.name;
|
|
942
980
|
// INFO: the pinned tab is a LIST destination. Falling back to it while a
|
|
943
981
|
// record is open resolved the read view to a list tab, which renderTabContent
|
|
944
982
|
// refuses — so General Details rendered nothing. Only a list falls back.
|
|
@@ -950,14 +988,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
950
988
|
// INFO: Firestore reads and the monday wrapper join every condition with AND
|
|
951
989
|
// (monday flattens all ORs into one), so a flex OR group is offered on Mongo only
|
|
952
990
|
var isFlexOrSupported = !isFirebase && devSettings.server !== "mondayServer";
|
|
953
|
-
var isDateWarnings = !!((
|
|
954
|
-
var isDatasheetDefaults = !!((
|
|
991
|
+
var isDateWarnings = !!((_19 = props.organise) === null || _19 === void 0 ? void 0 : _19.dateWarnings);
|
|
992
|
+
var isDatasheetDefaults = !!((_20 = props.organise) === null || _20 === void 0 ? void 0 : _20.datasheetDefaults);
|
|
955
993
|
// INFO: the columns as the views draw them — with datasheet defaults every
|
|
956
994
|
// list option without a colour takes the palette colour of its position
|
|
957
995
|
var displayStructure = isDatasheetDefaults
|
|
958
996
|
? (0, defaultColours_1.handleApplyDefaultColours)(structure)
|
|
959
997
|
: structure;
|
|
960
|
-
var dbModule = isFirebaseClient ? (
|
|
998
|
+
var dbModule = isFirebaseClient ? (_21 = props.lib) === null || _21 === void 0 ? void 0 : _21.firebase : (_22 = props.lib) === null || _22 === void 0 ? void 0 : _22.axios;
|
|
961
999
|
var schemaPresent = props.devSettings.schemaEndpoint ? true : false;
|
|
962
1000
|
var selectedRelated = resolvedType === "read"
|
|
963
1001
|
? relatedSections.find(function (eachSection) { return eachSection.id === viewType; })
|
|
@@ -1151,38 +1189,38 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1151
1189
|
}, [
|
|
1152
1190
|
resolvedType,
|
|
1153
1191
|
props.id,
|
|
1154
|
-
(
|
|
1192
|
+
(_23 = props.space) === null || _23 === void 0 ? void 0 : _23._id,
|
|
1155
1193
|
props.devSettings.schemaEndpoint,
|
|
1156
|
-
(
|
|
1194
|
+
(_24 = props.organise) === null || _24 === void 0 ? void 0 : _24.showRelatedTab,
|
|
1157
1195
|
]);
|
|
1158
1196
|
/* eslint-enable */
|
|
1159
1197
|
// INFO: the view settings panel (columns, sort, rows per page) is standard on
|
|
1160
1198
|
// the new DTW; bareViewSettings stays the opt-in for legacy and bare DTWs
|
|
1161
|
-
var isViewSettingsEnabled = ((
|
|
1199
|
+
var isViewSettingsEnabled = ((_25 = props.bareSettings) === null || _25 === void 0 ? void 0 : _25.bareViewSettings) || ((_26 = props.bareSettings) === null || _26 === void 0 ? void 0 : _26.bareNewDTW)
|
|
1162
1200
|
? true
|
|
1163
1201
|
: false;
|
|
1164
1202
|
// INFO: a consumer that wires onChangeHide owns the hide at schema level
|
|
1165
1203
|
// (shared by every user) — toggling writes to the model and calls back. Without it
|
|
1166
1204
|
// the hide is this user's own and lives in userHiddenColumnIds.
|
|
1167
|
-
var isSchemaHideMode = ((
|
|
1205
|
+
var isSchemaHideMode = ((_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.onChangeHide) ? true : false;
|
|
1168
1206
|
// INFO: rows per page is a view setting the user can change, so it starts from
|
|
1169
1207
|
// the persisted value and falls back to the consumer's limit
|
|
1170
|
-
var
|
|
1208
|
+
var _263 = (0, react_1.useState)((_29 = (_28 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _28 !== void 0 ? _28 : props.limit) !== null && _29 !== void 0 ? _29 : 10), pageLimit = _263[0], setPageLimit = _263[1];
|
|
1171
1209
|
var limit = pageLimit;
|
|
1172
|
-
var isSavedViewsEnabled = !!((
|
|
1210
|
+
var isSavedViewsEnabled = !!((_30 = props.organise) === null || _30 === void 0 ? void 0 : _30.savedViews) && resolvedType === "list";
|
|
1173
1211
|
// INFO: a calendar and a chart draw their own way, so columns, sort and
|
|
1174
1212
|
// group have nothing to change there
|
|
1175
1213
|
var isViewSettingsHiddenForTab = (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.viewType) === "calendar" || (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.viewType) === "chart";
|
|
1176
1214
|
// INFO: Group shapes a table, list or grid into sections, a map into routes
|
|
1177
1215
|
// and a timeline into colours
|
|
1178
|
-
var isGroupPickerShown = !!((
|
|
1216
|
+
var isGroupPickerShown = !!((_31 = props.organise) === null || _31 === void 0 ? void 0 : _31.showGroupByFeature) && !isViewSettingsHiddenForTab;
|
|
1179
1217
|
// INFO: an app that stores views takes over from this browser's storage, so
|
|
1180
1218
|
// every view is the team's and nothing is kept locally
|
|
1181
|
-
var isAppViews = ((
|
|
1182
|
-
!!((
|
|
1219
|
+
var isAppViews = ((_32 = props.organise) === null || _32 === void 0 ? void 0 : _32.sharedViews) !== undefined ||
|
|
1220
|
+
!!((_33 = props.organise) === null || _33 === void 0 ? void 0 : _33.onChangeSharedViews);
|
|
1183
1221
|
// INFO: a saved view carries its sort, so the sort is held here as with persistViewState
|
|
1184
1222
|
var isInternalSort = isPersistEnabled || isSavedViewsEnabled;
|
|
1185
|
-
var activeSortId = (isInternalSort && persistedSort) || ((
|
|
1223
|
+
var activeSortId = (isInternalSort && persistedSort) || ((_34 = props.organise) === null || _34 === void 0 ? void 0 : _34.sort);
|
|
1186
1224
|
var handleSortColumn = function (value) {
|
|
1187
1225
|
var _a, _b, _c, _d;
|
|
1188
1226
|
if (isInternalSort)
|
|
@@ -1212,7 +1250,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1212
1250
|
// INFO: Firebase pages by document cursor and a union by skip, so neither
|
|
1213
1251
|
// can hand over the whole set — there formula columns are not offered for
|
|
1214
1252
|
// sorting or filtering, rather than ordering one page
|
|
1215
|
-
var isFormulaViewSupported = !isFirebase && !((
|
|
1253
|
+
var isFormulaViewSupported = !isFirebase && !((_36 = (_35 = props.organise) === null || _35 === void 0 ? void 0 : _35.unionCollections) === null || _36 === void 0 ? void 0 : _36.length);
|
|
1216
1254
|
var formulaSort = isFormulaViewSupported &&
|
|
1217
1255
|
(activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) &&
|
|
1218
1256
|
formulaColumnIds.includes(activeSortId.sortId)
|
|
@@ -1223,12 +1261,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1223
1261
|
// a union read runs them
|
|
1224
1262
|
// INFO: a people filter's "me" needs only who is signed in, which any
|
|
1225
1263
|
// backend can match
|
|
1226
|
-
var currentUserId = (
|
|
1227
|
-
var flexFilterExtras = !isFirebase && !((
|
|
1264
|
+
var currentUserId = (_37 = props.devSettings.currentUser) === null || _37 === void 0 ? void 0 : _37.userId;
|
|
1265
|
+
var flexFilterExtras = !isFirebase && !((_39 = (_38 = props.organise) === null || _38 === void 0 ? void 0 : _38.unionCollections) === null || _39 === void 0 ? void 0 : _39.length)
|
|
1228
1266
|
? {
|
|
1229
|
-
references: (
|
|
1230
|
-
listObjects: (
|
|
1231
|
-
related: (
|
|
1267
|
+
references: (_40 = props.bareSettings) === null || _40 === void 0 ? void 0 : _40.bareFlexFilterReferences,
|
|
1268
|
+
listObjects: (_41 = props.bareSettings) === null || _41 === void 0 ? void 0 : _41.bareFlexFilterListObjects,
|
|
1269
|
+
related: (_42 = props.bareSettings) === null || _42 === void 0 ? void 0 : _42.bareFlexFilterRelated,
|
|
1232
1270
|
currentUserId: currentUserId,
|
|
1233
1271
|
}
|
|
1234
1272
|
: isFirebase
|
|
@@ -1371,18 +1409,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1371
1409
|
var handleGetSelectAllText = function () {
|
|
1372
1410
|
return "".concat(size.toLocaleString(), " records ").concat(handleCheckReaderFiltered() ? "matching your filters" : "in this list");
|
|
1373
1411
|
};
|
|
1374
|
-
var
|
|
1375
|
-
var isEditor = ((
|
|
1376
|
-
var isOffline = (
|
|
1412
|
+
var _264 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _264.canUpdateRecord, canInlineUpdate = _264.canInlineUpdate, canBatchUpdate = _264.canBatchUpdate, canDeleteRecord = _264.canDeleteRecord;
|
|
1413
|
+
var isEditor = ((_43 = props.edit) === null || _43 === void 0 ? void 0 : _43.allEditable) ? true : false;
|
|
1414
|
+
var isOffline = (_44 = props.bareSettings) === null || _44 === void 0 ? void 0 : _44.bareOffline;
|
|
1377
1415
|
// INFO: when bareOfflineNetworkAware is true, the save path is also gated on
|
|
1378
1416
|
// the live network state — online saves go to the server even if bareOffline
|
|
1379
1417
|
// is true, offline saves go to IDB as normal.
|
|
1380
|
-
var isOfflineNetworkListener = isOffline && ((
|
|
1381
|
-
var showId = (
|
|
1418
|
+
var isOfflineNetworkListener = isOffline && ((_45 = props.bareSettings) === null || _45 === void 0 ? void 0 : _45.bareOfflineNetworkListener);
|
|
1419
|
+
var showId = (_46 = props.space) === null || _46 === void 0 ? void 0 : _46.showId;
|
|
1382
1420
|
var remainId = showId || selectedObjectStructureId ? true : false;
|
|
1383
|
-
var idField = ((
|
|
1384
|
-
var pipeline = (
|
|
1385
|
-
if ((
|
|
1421
|
+
var idField = ((_47 = props.space) === null || _47 === void 0 ? void 0 : _47.idField) || ((_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.idField);
|
|
1422
|
+
var pipeline = (_49 = props === null || props === void 0 ? void 0 : props.space) === null || _49 === void 0 ? void 0 : _49.pipeline;
|
|
1423
|
+
if ((_50 = props.bareSettings) === null || _50 === void 0 ? void 0 : _50.bareListPipeline) {
|
|
1386
1424
|
pipeline = pipeline
|
|
1387
1425
|
? __spreadArray(__spreadArray([], pipeline, true), props.bareSettings.bareListPipeline, true) : props.bareSettings.bareListPipeline;
|
|
1388
1426
|
}
|
|
@@ -1395,38 +1433,38 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1395
1433
|
* three records came back instead of five files, and each tile received the
|
|
1396
1434
|
* whole array rather than one file, so every one of them read "Attachment".
|
|
1397
1435
|
*/
|
|
1398
|
-
var fileViewColumnId = (
|
|
1436
|
+
var fileViewColumnId = (_54 = (_53 = ((_52 = (_51 = props.organise) === null || _51 === void 0 ? void 0 : _51.extendedTabs) !== null && _52 !== void 0 ? _52 : []).find(function (eachTab) {
|
|
1399
1437
|
return eachTab.viewType === "file" &&
|
|
1400
1438
|
(0, utils_1.lowercaseTextToId)(eachTab.name) === viewType;
|
|
1401
|
-
})) === null ||
|
|
1439
|
+
})) === null || _53 === void 0 ? void 0 : _53.fileSettings) === null || _54 === void 0 ? void 0 : _54.columnId;
|
|
1402
1440
|
// INFO: select-all promises "all N records", so it is offered only where N
|
|
1403
1441
|
// is the total a delete reads — not on Firebase (N is the rows loaded so
|
|
1404
1442
|
// far), a union of datasheets (N counts the others too), a file view (N
|
|
1405
1443
|
// counts files, not records) or offline
|
|
1406
1444
|
var isSelectAllUncountable = isFirebase ||
|
|
1407
|
-
!!((
|
|
1445
|
+
!!((_56 = (_55 = props.organise) === null || _55 === void 0 ? void 0 : _55.unionCollections) === null || _56 === void 0 ? void 0 : _56.length) ||
|
|
1408
1446
|
!!fileViewColumnId ||
|
|
1409
|
-
!!((
|
|
1410
|
-
var hasNavigation = ((
|
|
1447
|
+
!!((_57 = props.bareSettings) === null || _57 === void 0 ? void 0 : _57.bareOffline);
|
|
1448
|
+
var hasNavigation = ((_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.handleNavigate) ? true : false;
|
|
1411
1449
|
var formColumn = "grid-cols-12";
|
|
1412
|
-
var useMobileView = (
|
|
1450
|
+
var useMobileView = (_60 = (_59 = props.bareSettings) === null || _59 === void 0 ? void 0 : _59.bareUpdateMobileView) !== null && _60 !== void 0 ? _60 : false;
|
|
1413
1451
|
var gridGap = useMobileView ? "gap-x-6 gap-y-2 md:gap-y-6" : "gap-6";
|
|
1414
|
-
var isActivityLog = (((
|
|
1415
|
-
((
|
|
1416
|
-
(((
|
|
1417
|
-
((
|
|
1452
|
+
var isActivityLog = (((_62 = (_61 = props.edit) === null || _61 === void 0 ? void 0 : _61.activityLog) === null || _62 === void 0 ? void 0 : _62.enableComments) &&
|
|
1453
|
+
((_63 = props.edit) === null || _63 === void 0 ? void 0 : _63.activityLog.commentCollectionId)) ||
|
|
1454
|
+
(((_65 = (_64 = props.edit) === null || _64 === void 0 ? void 0 : _64.activityLog) === null || _65 === void 0 ? void 0 : _65.enableLogs) &&
|
|
1455
|
+
((_66 = props.edit) === null || _66 === void 0 ? void 0 : _66.activityLog.logsCollectionId));
|
|
1418
1456
|
// INFO: a record's comments and logs shown in place of the record rather than
|
|
1419
1457
|
// in a drawer of their own — a related tab already sits inside the read
|
|
1420
1458
|
// drawer, and a second drawer over it hid the row being discussed. It opens
|
|
1421
1459
|
// the row through handleNavigate, so without one it stays off and the
|
|
1422
1460
|
// drawer is used, rather than leaving a comment button that does nothing
|
|
1423
1461
|
var isInlineActivity = !!isActivityLog &&
|
|
1424
|
-
!!((
|
|
1462
|
+
!!((_67 = props.bareSettings) === null || _67 === void 0 ? void 0 : _67.bareInlineActivity) &&
|
|
1425
1463
|
hasNavigation;
|
|
1426
1464
|
// INFO: each row button opens what it shows: the comment button the row's
|
|
1427
1465
|
// comments and logs alone, the eye (or the row) its details alone, so
|
|
1428
1466
|
// neither has to be scrolled past to reach the other
|
|
1429
|
-
var
|
|
1467
|
+
var _265 = (0, react_1.useState)(false), inlineActivityOnly = _265[0], setInlineActivityOnly = _265[1];
|
|
1430
1468
|
var isActivityOnly = isInlineActivity && inlineActivityOnly;
|
|
1431
1469
|
// INFO: the row whose comments were shown; going back to the list asks its
|
|
1432
1470
|
// comment count again, as the drawer does when it closes
|
|
@@ -1465,12 +1503,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1465
1503
|
// column
|
|
1466
1504
|
recordTitleColumn: (_d = ((_c = (_b = structure.find(function (eachDS) { return eachDS.id === "title"; })) !== null && _b !== void 0 ? _b : structure.find(function (eachDS) { return eachDS.id === "name"; })) !== null && _c !== void 0 ? _c : structure.find(function (eachDS) { return eachDS.type === "string"; }))) === null || _d === void 0 ? void 0 : _d.id, model: structure }));
|
|
1467
1505
|
};
|
|
1468
|
-
var customPaginationSize = ((
|
|
1506
|
+
var customPaginationSize = ((_68 = props.organise) === null || _68 === void 0 ? void 0 : _68.customPaginationCount)
|
|
1469
1507
|
? props.organise.customPaginationCount(size)
|
|
1470
1508
|
: undefined;
|
|
1471
1509
|
//TODO : Code - Pass ...devSettings, search dbEndpoint:
|
|
1472
1510
|
var writeServerQuery = new writeQuery_1.WriteQuery({
|
|
1473
|
-
dbModule: (
|
|
1511
|
+
dbModule: (_69 = props.lib) === null || _69 === void 0 ? void 0 : _69.axios,
|
|
1474
1512
|
dbType: devSettings.server,
|
|
1475
1513
|
dbCollection: props.collectionId,
|
|
1476
1514
|
dbEndpoint: devSettings.dbEndpoint,
|
|
@@ -1478,7 +1516,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1478
1516
|
dbUserToken: devSettings.dbUserToken,
|
|
1479
1517
|
});
|
|
1480
1518
|
var readServerQuery = new readQuery_1.ReadQuery({
|
|
1481
|
-
dbModule: (
|
|
1519
|
+
dbModule: (_70 = props.lib) === null || _70 === void 0 ? void 0 : _70.axios,
|
|
1482
1520
|
dbType: devSettings.server,
|
|
1483
1521
|
dbCollection: props.collectionId,
|
|
1484
1522
|
dbEndpoint: devSettings.dbEndpoint,
|
|
@@ -1486,12 +1524,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1486
1524
|
dbUserToken: devSettings.dbUserToken,
|
|
1487
1525
|
});
|
|
1488
1526
|
var moreButtonPopUp = [
|
|
1489
|
-
((
|
|
1527
|
+
((_71 = props.edit) === null || _71 === void 0 ? void 0 : _71.allEditable) &&
|
|
1490
1528
|
// INFO: the import runs on the server (importEndpoint), so a Firestore
|
|
1491
1529
|
// datasheet served through one can import; only the browser-direct
|
|
1492
1530
|
// Firebase client has no server to import through
|
|
1493
1531
|
!isFirebaseClient &&
|
|
1494
|
-
!((
|
|
1532
|
+
!((_73 = (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.exportSettings) === null || _73 === void 0 ? void 0 : _73.hideImportCSV)
|
|
1495
1533
|
? {
|
|
1496
1534
|
text: "Import Excel",
|
|
1497
1535
|
onClick: function () {
|
|
@@ -1500,7 +1538,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1500
1538
|
},
|
|
1501
1539
|
}
|
|
1502
1540
|
: null,
|
|
1503
|
-
!((
|
|
1541
|
+
!((_75 = (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.exportSettings) === null || _75 === void 0 ? void 0 : _75.hideExportCSV)
|
|
1504
1542
|
? {
|
|
1505
1543
|
text: "Export CSV",
|
|
1506
1544
|
onClick: function () {
|
|
@@ -1510,7 +1548,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1510
1548
|
},
|
|
1511
1549
|
}
|
|
1512
1550
|
: null,
|
|
1513
|
-
!((
|
|
1551
|
+
!((_77 = (_76 = props.organise) === null || _76 === void 0 ? void 0 : _76.exportSettings) === null || _77 === void 0 ? void 0 : _77.hideExportExcel)
|
|
1514
1552
|
? {
|
|
1515
1553
|
text: "Export Excel",
|
|
1516
1554
|
onClick: function () {
|
|
@@ -1520,7 +1558,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1520
1558
|
},
|
|
1521
1559
|
}
|
|
1522
1560
|
: null,
|
|
1523
|
-
!((
|
|
1561
|
+
!((_79 = (_78 = props.organise) === null || _78 === void 0 ? void 0 : _78.exportSettings) === null || _79 === void 0 ? void 0 : _79.hideExportPDF)
|
|
1524
1562
|
? {
|
|
1525
1563
|
text: "Export PDF",
|
|
1526
1564
|
onClick: function () {
|
|
@@ -1530,7 +1568,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1530
1568
|
},
|
|
1531
1569
|
}
|
|
1532
1570
|
: null,
|
|
1533
|
-
!((
|
|
1571
|
+
!((_81 = (_80 = props.organise) === null || _80 === void 0 ? void 0 : _80.exportSettings) === null || _81 === void 0 ? void 0 : _81.hideExportQR)
|
|
1534
1572
|
? {
|
|
1535
1573
|
text: "Export QR",
|
|
1536
1574
|
onClick: function () {
|
|
@@ -1540,7 +1578,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1540
1578
|
},
|
|
1541
1579
|
}
|
|
1542
1580
|
: null,
|
|
1543
|
-
!((
|
|
1581
|
+
!((_83 = (_82 = props.organise) === null || _82 === void 0 ? void 0 : _82.exportSettings) === null || _83 === void 0 ? void 0 : _83.hideExportQR)
|
|
1544
1582
|
? {
|
|
1545
1583
|
text: "Export QR(Data)",
|
|
1546
1584
|
onClick: function () {
|
|
@@ -1550,7 +1588,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1550
1588
|
},
|
|
1551
1589
|
}
|
|
1552
1590
|
: null,
|
|
1553
|
-
!((
|
|
1591
|
+
!((_85 = (_84 = props.organise) === null || _84 === void 0 ? void 0 : _84.exportSettings) === null || _85 === void 0 ? void 0 : _85.hideExportPrint)
|
|
1554
1592
|
? {
|
|
1555
1593
|
text: "Print",
|
|
1556
1594
|
onClick: function () {
|
|
@@ -1562,8 +1600,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1562
1600
|
: null,
|
|
1563
1601
|
// INFO: drafts only exist where the form can save one, so the filter has
|
|
1564
1602
|
// nothing to find on any other page
|
|
1565
|
-
((
|
|
1566
|
-
!((
|
|
1603
|
+
((_86 = props.edit) === null || _86 === void 0 ? void 0 : _86.enableUpdateDraft) &&
|
|
1604
|
+
!((_88 = (_87 = props.organise) === null || _87 === void 0 ? void 0 : _87.exportSettings) === null || _88 === void 0 ? void 0 : _88.hideExportDraft)
|
|
1567
1605
|
? {
|
|
1568
1606
|
text: filterDraft ? "Show All Items" : "Filter Draft",
|
|
1569
1607
|
onClick: function () {
|
|
@@ -1572,7 +1610,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
1572
1610
|
}
|
|
1573
1611
|
: null,
|
|
1574
1612
|
].filter(Boolean);
|
|
1575
|
-
if ((
|
|
1613
|
+
if ((_89 = props.organise) === null || _89 === void 0 ? void 0 : _89.moreSettings)
|
|
1576
1614
|
moreButtonPopUp = moreButtonPopUp.concat(props.organise.moreSettings);
|
|
1577
1615
|
//=====================================================================================
|
|
1578
1616
|
//SECTION: User Column Visibility Handlers
|
|
@@ -2011,20 +2049,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2011
2049
|
// INFO: scroll mode reloads from page 0; the anchor restores the position
|
|
2012
2050
|
pageIndex: renderCheckScrollMode() ? 0 : pageIndex, hiddenColumnIds: structure.filter(function (col) { return col.hide; }).map(function (col) { return col.id; }),
|
|
2013
2051
|
// INFO: raw, so switching bareViewSettings off does not wipe the user's choice
|
|
2014
|
-
userHiddenColumnIds: userHiddenColumnIds, shownSystemColumnIds: shownSystemColumnIds, columnOrder: structure.map(function (col) { return col.id; }), columnWidths: columnWidths, laneWidths: laneWidths, drawerWidth: drawerWidth, pinnedColumnIds: pinnedColumnIds, groupBy: groupId !== null && groupId !== void 0 ? groupId : "" }, scrollCaptureRef.current));
|
|
2052
|
+
userHiddenColumnIds: userHiddenColumnIds, shownSystemColumnIds: shownSystemColumnIds, columnOrder: structure.map(function (col) { return col.id; }), columnWidths: columnWidths, laneWidths: laneWidths, drawerWidth: drawerWidth, pinnedColumnIds: pinnedColumnIds, groupBy: groupId !== null && groupId !== void 0 ? groupId : "", groupOrder: groupId ? groupOrder : "" }, scrollCaptureRef.current));
|
|
2015
2053
|
};
|
|
2016
2054
|
handleRegisterViewSnapshot(handleBuildViewSnapshot);
|
|
2017
2055
|
//=====================================================================================
|
|
2018
2056
|
//SECTION: Saved Views
|
|
2019
2057
|
//=====================================================================================
|
|
2020
|
-
var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (
|
|
2058
|
+
var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_90 = props.organise) === null || _90 === void 0 ? void 0 : _90.persistKey, (_91 = devSettings.currentUser) === null || _91 === void 0 ? void 0 : _91.userEmail);
|
|
2021
2059
|
(0, react_1.useEffect)(function () {
|
|
2022
2060
|
if (isSavedViewsEnabled && !isAppViews)
|
|
2023
2061
|
setSavedViews((0, viewStatePersistence_1.handleReadSavedViews)(savedViewsKey));
|
|
2024
2062
|
}, [isSavedViewsEnabled, isAppViews, savedViewsKey]);
|
|
2025
2063
|
// INFO: the app keeps All's settings, so every change is kept in this
|
|
2026
2064
|
// browser until the person updates the view for everyone or resets it
|
|
2027
|
-
var isViewDraftsEnabled = isSavedViewsEnabled && ((
|
|
2065
|
+
var isViewDraftsEnabled = isSavedViewsEnabled && ((_92 = props.organise) === null || _92 === void 0 ? void 0 : _92.allView) !== undefined;
|
|
2028
2066
|
var handleGetViewDraftKey = function (viewId) {
|
|
2029
2067
|
var _a, _b;
|
|
2030
2068
|
return (0, viewStatePersistence_1.buildViewDraftKey)(props.collectionId, viewId !== null && viewId !== void 0 ? viewId : "all", (_a = props.organise) === null || _a === void 0 ? void 0 : _a.persistKey, (_b = devSettings.currentUser) === null || _b === void 0 ? void 0 : _b.userEmail);
|
|
@@ -2153,7 +2191,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2153
2191
|
var lastSentSharedViewsRef = (0, react_1.useRef)(null);
|
|
2154
2192
|
(0, react_1.useEffect)(function () {
|
|
2155
2193
|
lastSentSharedViewsRef.current = null;
|
|
2156
|
-
}, [(
|
|
2194
|
+
}, [(_93 = props.organise) === null || _93 === void 0 ? void 0 : _93.sharedViews]);
|
|
2157
2195
|
var handleStoreSharedViews = function (update) {
|
|
2158
2196
|
var _a, _b, _c;
|
|
2159
2197
|
if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeSharedViews))
|
|
@@ -2170,15 +2208,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2170
2208
|
var openingViewSettledRef = (0, react_1.useRef)(false);
|
|
2171
2209
|
// INFO: keyed on the ids, so a list handed in again on every render does
|
|
2172
2210
|
// not re-run the opening
|
|
2173
|
-
var starredViewIdsKey = ((
|
|
2211
|
+
var starredViewIdsKey = ((_95 = (_94 = props.organise) === null || _94 === void 0 ? void 0 : _94.defaultSavedViewIds) !== null && _95 !== void 0 ? _95 : []).join("|");
|
|
2174
2212
|
(0, react_1.useEffect)(function () {
|
|
2175
|
-
var _a, _b, _c, _d;
|
|
2213
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2176
2214
|
if (!isSavedViewsEnabled || openingViewSettledRef.current)
|
|
2177
2215
|
return;
|
|
2178
|
-
// INFO: a link opens on All with only its keyword, never on a
|
|
2179
|
-
|
|
2216
|
+
// INFO: a link opens on All with only its keyword or filters, never on a
|
|
2217
|
+
// ★ view
|
|
2218
|
+
if (isLinkOpen &&
|
|
2219
|
+
(((_a = props.organise) === null || _a === void 0 ? void 0 : _a.initialSearch) || ((_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.linkFlexFilters) === null || _c === void 0 ? void 0 : _c.length))) {
|
|
2180
2220
|
openingViewSettledRef.current = true;
|
|
2181
|
-
handleApplySavedView(null, true,
|
|
2221
|
+
handleApplySavedView(null, true,
|
|
2222
|
+
// INFO: the keyword only where there is a Quick find box to show it
|
|
2223
|
+
handleCanInitialSearch((_d = props.organise) === null || _d === void 0 ? void 0 : _d.additionalQuery)
|
|
2224
|
+
? (_e = props.organise) === null || _e === void 0 ? void 0 : _e.initialSearch
|
|
2225
|
+
: undefined, undefined, (_f = props.organise) === null || _f === void 0 ? void 0 : _f.linkFlexFilters);
|
|
2182
2226
|
setIsViewDraftReady(true);
|
|
2183
2227
|
return;
|
|
2184
2228
|
}
|
|
@@ -2187,7 +2231,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2187
2231
|
setIsViewDraftReady(true);
|
|
2188
2232
|
return;
|
|
2189
2233
|
}
|
|
2190
|
-
var wantedId = (
|
|
2234
|
+
var wantedId = (_h = (_g = props.organise) === null || _g === void 0 ? void 0 : _g.initialSavedViewId) !== null && _h !== void 0 ? _h : handleGetStarredViewId();
|
|
2191
2235
|
if (!wantedId) {
|
|
2192
2236
|
// INFO: All opens with its stored settings and this person's changes
|
|
2193
2237
|
if (isViewDraftsEnabled) {
|
|
@@ -2198,7 +2242,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2198
2242
|
return;
|
|
2199
2243
|
}
|
|
2200
2244
|
// INFO: the app's views may still be loading
|
|
2201
|
-
if (isAppViews && ((
|
|
2245
|
+
if (isAppViews && ((_j = props.organise) === null || _j === void 0 ? void 0 : _j.sharedViews) === undefined)
|
|
2202
2246
|
return;
|
|
2203
2247
|
openingViewSettledRef.current = true;
|
|
2204
2248
|
var view = handleGetTabSavedViews().find(function (eachView) { return eachView.id === wantedId; });
|
|
@@ -2208,13 +2252,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2208
2252
|
/* eslint-disable */
|
|
2209
2253
|
}, [
|
|
2210
2254
|
isSavedViewsEnabled,
|
|
2211
|
-
(
|
|
2255
|
+
(_96 = props.organise) === null || _96 === void 0 ? void 0 : _96.initialSavedViewId,
|
|
2212
2256
|
starredViewIdsKey,
|
|
2213
|
-
(
|
|
2257
|
+
(_97 = props.organise) === null || _97 === void 0 ? void 0 : _97.sharedViews,
|
|
2214
2258
|
savedViews,
|
|
2215
2259
|
]);
|
|
2216
2260
|
/* eslint-enable */
|
|
2217
|
-
var appDefaultViewIds = ((
|
|
2261
|
+
var appDefaultViewIds = ((_99 = (_98 = props.organise) === null || _98 === void 0 ? void 0 : _98.defaultSavedViews) !== null && _99 !== void 0 ? _99 : [])
|
|
2218
2262
|
.map(function (eachView) { var _a; return (_a = eachView.id) !== null && _a !== void 0 ? _a : ""; })
|
|
2219
2263
|
.join("|");
|
|
2220
2264
|
// INFO: keyed on the ids, not the array, so an inline literal passed on every
|
|
@@ -2288,11 +2332,23 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2288
2332
|
};
|
|
2289
2333
|
// INFO: notify — only a user's choice is handed back; a list opening on a
|
|
2290
2334
|
// view or syncing the host's own groupBy tells the host nothing new
|
|
2335
|
+
// INFO: ordering groups applies where the rows are drawn in group sections
|
|
2336
|
+
// — the table, a list and a grid — not to a map's routes or a timeline's
|
|
2337
|
+
// colours
|
|
2338
|
+
var handleCheckGroupOrderShown = function () {
|
|
2339
|
+
var _a;
|
|
2340
|
+
return !!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW) &&
|
|
2341
|
+
!handleCheckLookupGroupBy() &&
|
|
2342
|
+
(!(selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.viewType) ||
|
|
2343
|
+
["general", "table", "report", "list", "grid"].includes(selectedTab.viewType));
|
|
2344
|
+
};
|
|
2291
2345
|
var handleChangeGroupBy = function (value, notify) {
|
|
2292
2346
|
var _a, _b;
|
|
2293
2347
|
if (value === (groupId !== null && groupId !== void 0 ? groupId : ""))
|
|
2294
2348
|
return;
|
|
2295
2349
|
setGroupId(value);
|
|
2350
|
+
if (!value)
|
|
2351
|
+
setGroupOrder("");
|
|
2296
2352
|
if (notify)
|
|
2297
2353
|
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeGroupBy) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
2298
2354
|
};
|
|
@@ -2302,15 +2358,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2302
2358
|
// INFO: linkSearch — the list opens as a fresh datasheet with only that
|
|
2303
2359
|
// keyword: All's columns and sort, none of its filters, and no draft.
|
|
2304
2360
|
// restoredState — the state persistViewState kept, applied in place of a view
|
|
2305
|
-
var handleApplySavedView = function (view, isOpening, linkSearch, restoredState) {
|
|
2306
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
2361
|
+
var handleApplySavedView = function (view, isOpening, linkSearch, restoredState, linkFlexFilters) {
|
|
2362
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
2307
2363
|
var next;
|
|
2308
|
-
if (linkSearch) {
|
|
2364
|
+
if (linkSearch || (linkFlexFilters === null || linkFlexFilters === void 0 ? void 0 : linkFlexFilters.length)) {
|
|
2309
2365
|
// INFO: the filter keys are left out, not set to undefined, so the
|
|
2310
2366
|
// app's own additionalQuery defaults still apply
|
|
2311
|
-
var
|
|
2367
|
+
var _0 = (_a = handleGetStoredViewState(null)) !== null && _a !== void 0 ? _a : {}, _search = _0.filterSearchParams, _selection = _0.filterSelection, _reference = _0.filterReference, _date = _0.filterReferenceDate, _flex = _0.flexFilters, allLayout = __rest(_0, ["filterSearchParams", "filterSelection", "filterReference", "filterReferenceDate", "flexFilters"]);
|
|
2312
2368
|
next = handleResolveViewState(allLayout);
|
|
2313
|
-
next = __assign(__assign(
|
|
2369
|
+
next = __assign(__assign(__assign({}, next), (linkSearch
|
|
2370
|
+
? {
|
|
2371
|
+
filterSearchParams: __assign(__assign({}, next.filterSearchParams), { search: linkSearch }),
|
|
2372
|
+
}
|
|
2373
|
+
: {})), ((linkFlexFilters === null || linkFlexFilters === void 0 ? void 0 : linkFlexFilters.length) ? { flexFilters: linkFlexFilters } : {}));
|
|
2314
2374
|
}
|
|
2315
2375
|
else if (restoredState) {
|
|
2316
2376
|
next = handleResolveViewState(restoredState);
|
|
@@ -2347,10 +2407,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2347
2407
|
if (next.pageLimit)
|
|
2348
2408
|
setPageLimit(next.pageLimit);
|
|
2349
2409
|
handleChangeGroupBy((_l = next.groupBy) !== null && _l !== void 0 ? _l : "", !isOpening);
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2410
|
+
setGroupOrder((_m = next.groupOrder) !== null && _m !== void 0 ? _m : "");
|
|
2411
|
+
setUserHiddenColumnIds((_o = next.userHiddenColumnIds) !== null && _o !== void 0 ? _o : []);
|
|
2412
|
+
setShownSystemColumnIds((_p = next.shownSystemColumnIds) !== null && _p !== void 0 ? _p : []);
|
|
2413
|
+
setColumnWidths((_q = next.columnWidths) !== null && _q !== void 0 ? _q : {});
|
|
2414
|
+
setLaneWidths((_r = next.laneWidths) !== null && _r !== void 0 ? _r : {});
|
|
2354
2415
|
setDrawerWidth(next.drawerWidth);
|
|
2355
2416
|
setPinnedColumnIds(next.pinnedColumnIds);
|
|
2356
2417
|
if (view) {
|
|
@@ -2367,12 +2428,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2367
2428
|
pendingViewCondKeyRef.current = JSON.stringify(handleReadQueryHocCond());
|
|
2368
2429
|
handleClearDataByFilter();
|
|
2369
2430
|
if (pageIndex !== 0)
|
|
2370
|
-
(
|
|
2371
|
-
(
|
|
2431
|
+
(_t = (_s = props.organise) === null || _s === void 0 ? void 0 : _s.onChangePagination) === null || _t === void 0 ? void 0 : _t.call(_s, 0);
|
|
2432
|
+
(_v = (_u = props.bareSettings) === null || _u === void 0 ? void 0 : _u.bareListHandleFilter) === null || _v === void 0 ? void 0 : _v.call(_u, (_w = next.filterSearchParams) !== null && _w !== void 0 ? _w : {}, (_x = next.filterSelection) !== null && _x !== void 0 ? _x : {}, next.filterReferenceDate
|
|
2372
2433
|
? (0, viewStatePersistence_1.parseDateFilterState)(next.filterReferenceDate)
|
|
2373
|
-
: initialFilterReferenceDate, (
|
|
2434
|
+
: initialFilterReferenceDate, (_y = next.filterReference) !== null && _y !== void 0 ? _y : {});
|
|
2374
2435
|
}
|
|
2375
|
-
setActiveSavedViewId((
|
|
2436
|
+
setActiveSavedViewId((_z = view === null || view === void 0 ? void 0 : view.id) !== null && _z !== void 0 ? _z : null);
|
|
2376
2437
|
setDeletingSavedViewId(null);
|
|
2377
2438
|
};
|
|
2378
2439
|
// INFO: re-read storage before each write so a change made in another browser
|
|
@@ -2621,12 +2682,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2621
2682
|
shownSystemColumnIds,
|
|
2622
2683
|
pageLimit,
|
|
2623
2684
|
groupId,
|
|
2685
|
+
groupOrder,
|
|
2624
2686
|
columnWidths,
|
|
2625
2687
|
laneWidths,
|
|
2626
2688
|
drawerWidth,
|
|
2627
2689
|
pinnedColumnIds,
|
|
2628
|
-
(
|
|
2629
|
-
(
|
|
2690
|
+
(_100 = props.organise) === null || _100 === void 0 ? void 0 : _100.allView,
|
|
2691
|
+
(_101 = props.organise) === null || _101 === void 0 ? void 0 : _101.sharedViews,
|
|
2630
2692
|
savedViews,
|
|
2631
2693
|
]);
|
|
2632
2694
|
/* eslint-enable */
|
|
@@ -2670,7 +2732,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2670
2732
|
if (scrollRestoredRef.current)
|
|
2671
2733
|
scrollCatchUpRef.current = null;
|
|
2672
2734
|
/* eslint-disable */
|
|
2673
|
-
}, [props.collectionId, (
|
|
2735
|
+
}, [props.collectionId, (_102 = props.organise) === null || _102 === void 0 ? void 0 : _102.persistKey]);
|
|
2674
2736
|
/* eslint-enable */
|
|
2675
2737
|
// INFO: wait a frame — rows land in state one tick before layout
|
|
2676
2738
|
(0, react_1.useEffect)(function () {
|
|
@@ -2705,7 +2767,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2705
2767
|
(0, react_1.useEffect)(function () {
|
|
2706
2768
|
handleOfflinePrefetch();
|
|
2707
2769
|
/* eslint-disable */
|
|
2708
|
-
}, [props.collectionId, (
|
|
2770
|
+
}, [props.collectionId, (_103 = props.bareSettings) === null || _103 === void 0 ? void 0 : _103.bareOffline]);
|
|
2709
2771
|
/* eslint-enable */
|
|
2710
2772
|
// INFO: MRQ polling — calls handleRefresh every N ms (e.g. 1500) as a fallback.
|
|
2711
2773
|
// Calls through handleRefreshRef so the interval always dispatches the latest
|
|
@@ -2725,7 +2787,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2725
2787
|
}, interval);
|
|
2726
2788
|
return function () { return clearInterval(timer); };
|
|
2727
2789
|
/* eslint-disable */
|
|
2728
|
-
}, [(
|
|
2790
|
+
}, [(_104 = props.bareSettings) === null || _104 === void 0 ? void 0 : _104.barePollingInterval, isLive, isNetworkOffline]);
|
|
2729
2791
|
/* eslint-enable */
|
|
2730
2792
|
// INFO: Pub/Sub → SSE live-stream — driven by bareSettings.bareSocketName
|
|
2731
2793
|
// EventSource URL: {sseEndpoint}/{room}?bm_apiToken={token}
|
|
@@ -2767,7 +2829,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
2767
2829
|
};
|
|
2768
2830
|
/* eslint-disable */
|
|
2769
2831
|
}, [
|
|
2770
|
-
(
|
|
2832
|
+
(_105 = props.bareSettings) === null || _105 === void 0 ? void 0 : _105.bareSocketName,
|
|
2771
2833
|
props.collectionId,
|
|
2772
2834
|
props.devSettings.sseEndpoint,
|
|
2773
2835
|
props.devSettings.dbAPIToken,
|
|
@@ -3041,10 +3103,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
3041
3103
|
props.collectionId,
|
|
3042
3104
|
props.model,
|
|
3043
3105
|
props.localURLEndpoint,
|
|
3044
|
-
(
|
|
3106
|
+
(_106 = props.organise) === null || _106 === void 0 ? void 0 : _106.extendedTabs,
|
|
3045
3107
|
listViewId,
|
|
3046
|
-
(
|
|
3047
|
-
(
|
|
3108
|
+
(_107 = props.organise) === null || _107 === void 0 ? void 0 : _107.additionalQuery,
|
|
3109
|
+
(_108 = props.organise) === null || _108 === void 0 ? void 0 : _108.groupBy,
|
|
3048
3110
|
resolvedType,
|
|
3049
3111
|
]);
|
|
3050
3112
|
/**
|
|
@@ -3196,7 +3258,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
3196
3258
|
};
|
|
3197
3259
|
}, 100);
|
|
3198
3260
|
return function () { return clearTimeout(timeoutId); };
|
|
3199
|
-
}, [(
|
|
3261
|
+
}, [(_109 = props.organise) === null || _109 === void 0 ? void 0 : _109.showReadFloatingNav, resolvedType, props.id, loading]);
|
|
3200
3262
|
(0, react_1.useEffect)(function () {
|
|
3201
3263
|
if (resolvedType !== "read")
|
|
3202
3264
|
return;
|
|
@@ -4775,7 +4837,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
4775
4837
|
// the link view ends and the list opens as it normally would. A change
|
|
4776
4838
|
// while a record is open (opening one drops the link from the URL) waits
|
|
4777
4839
|
// until the list shows again
|
|
4778
|
-
var lastInitialSearchRef = (0, react_1.useRef)((
|
|
4840
|
+
var lastInitialSearchRef = (0, react_1.useRef)((_110 = props.organise) === null || _110 === void 0 ? void 0 : _110.initialSearch);
|
|
4779
4841
|
// INFO: persistViewState reads its stored state only once the link view
|
|
4780
4842
|
// has ended, a render later
|
|
4781
4843
|
var isNormalOpenPendingRef = (0, react_1.useRef)(false);
|
|
@@ -4802,7 +4864,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
4802
4864
|
setIsLinkOpen(true);
|
|
4803
4865
|
handleApplySavedView(null, true, value);
|
|
4804
4866
|
/* eslint-disable */
|
|
4805
|
-
}, [(
|
|
4867
|
+
}, [(_111 = props.organise) === null || _111 === void 0 ? void 0 : _111.initialSearch, resolvedType]);
|
|
4806
4868
|
(0, react_1.useEffect)(function () {
|
|
4807
4869
|
if (!isNormalOpenPendingRef.current || isLinkOpen)
|
|
4808
4870
|
return;
|
|
@@ -5895,28 +5957,323 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
5895
5957
|
handleSelectIds([]);
|
|
5896
5958
|
/* eslint-disable-next-line */
|
|
5897
5959
|
}, [selectAllFilterKey]);
|
|
5960
|
+
// INFO: the stored files of deleted records go with them; a failure here
|
|
5961
|
+
// leaves files behind, never records, so it does not stop the delete
|
|
5962
|
+
var handleDeleteRecordFiles = function (ids) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5963
|
+
var data, uploadEndpoint, err_12;
|
|
5964
|
+
var _a;
|
|
5965
|
+
return __generator(this, function (_b) {
|
|
5966
|
+
switch (_b.label) {
|
|
5967
|
+
case 0:
|
|
5968
|
+
if (ids.length === 0)
|
|
5969
|
+
return [2 /*return*/];
|
|
5970
|
+
_b.label = 1;
|
|
5971
|
+
case 1:
|
|
5972
|
+
_b.trys.push([1, 3, , 4]);
|
|
5973
|
+
data = new FormData();
|
|
5974
|
+
data.append("data[assetCollectionName]", props.collectionId);
|
|
5975
|
+
data.append("data[assetParentId]", JSON.stringify(ids));
|
|
5976
|
+
uploadEndpoint = devSettings.uploadEndpoint
|
|
5977
|
+
? devSettings.uploadEndpoint
|
|
5978
|
+
: "/api/asset";
|
|
5979
|
+
if (props.devSettings.bucketName)
|
|
5980
|
+
data.append("data[bucketName]", props.devSettings.bucketName);
|
|
5981
|
+
return [4 /*yield*/, ((_a = props.lib) === null || _a === void 0 ? void 0 : _a.axios({
|
|
5982
|
+
data: data,
|
|
5983
|
+
method: "post",
|
|
5984
|
+
url: "".concat(uploadEndpoint, "/batchDeleteDirectory"),
|
|
5985
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
5986
|
+
}))];
|
|
5987
|
+
case 2:
|
|
5988
|
+
_b.sent();
|
|
5989
|
+
return [3 /*break*/, 4];
|
|
5990
|
+
case 3:
|
|
5991
|
+
err_12 = _b.sent();
|
|
5992
|
+
return [3 /*break*/, 4];
|
|
5993
|
+
case 4: return [2 /*return*/];
|
|
5994
|
+
}
|
|
5995
|
+
});
|
|
5996
|
+
}); };
|
|
5997
|
+
// INFO: deletes by id in parts the server accepts; stops at the first part
|
|
5998
|
+
// that fails and returns the ids that did go
|
|
5999
|
+
var handleDeleteIdsInParts = function (ids) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6000
|
+
var deletedIds, start, chunk, err_13;
|
|
6001
|
+
return __generator(this, function (_a) {
|
|
6002
|
+
switch (_a.label) {
|
|
6003
|
+
case 0:
|
|
6004
|
+
deletedIds = [];
|
|
6005
|
+
start = 0;
|
|
6006
|
+
_a.label = 1;
|
|
6007
|
+
case 1:
|
|
6008
|
+
if (!(start < ids.length)) return [3 /*break*/, 7];
|
|
6009
|
+
chunk = ids.slice(start, start + DELETE_ID_CHUNK);
|
|
6010
|
+
_a.label = 2;
|
|
6011
|
+
case 2:
|
|
6012
|
+
_a.trys.push([2, 5, , 6]);
|
|
6013
|
+
return [4 /*yield*/, writeServerQuery.call("batchDelete", { id: chunk })];
|
|
6014
|
+
case 3:
|
|
6015
|
+
_a.sent();
|
|
6016
|
+
deletedIds.push.apply(deletedIds, chunk);
|
|
6017
|
+
return [4 /*yield*/, handleDeleteRecordFiles(chunk)];
|
|
6018
|
+
case 4:
|
|
6019
|
+
_a.sent();
|
|
6020
|
+
return [3 /*break*/, 6];
|
|
6021
|
+
case 5:
|
|
6022
|
+
err_13 = _a.sent();
|
|
6023
|
+
return [2 /*return*/, { deletedIds: deletedIds, isStopped: true }];
|
|
6024
|
+
case 6:
|
|
6025
|
+
start += DELETE_ID_CHUNK;
|
|
6026
|
+
return [3 /*break*/, 1];
|
|
6027
|
+
case 7: return [2 /*return*/, { deletedIds: deletedIds, isStopped: false }];
|
|
6028
|
+
}
|
|
6029
|
+
});
|
|
6030
|
+
}); };
|
|
6031
|
+
/**
|
|
6032
|
+
* A large select-all delete, a batch at a time: only record ids are read,
|
|
6033
|
+
* in id order after the last one seen, so a batch is never missed as rows
|
|
6034
|
+
* go. Each batch's links are checked with one read per linked datasheet,
|
|
6035
|
+
* and its free records deleted. Linked records are kept and listed at the
|
|
6036
|
+
* end; any error stops it and says how far it got.
|
|
6037
|
+
*/
|
|
6038
|
+
var handleDeleteInBatches = function (query, total) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6039
|
+
var sources, blockedIds, linkedBySource, deletedCount, processed, lastId, _loop_1, state_1, err_14;
|
|
6040
|
+
var _a, _b, _c;
|
|
6041
|
+
return __generator(this, function (_d) {
|
|
6042
|
+
switch (_d.label) {
|
|
6043
|
+
case 0: return [4 /*yield*/, (0, referenceScan_1.handleListReferenceSources)({
|
|
6044
|
+
dbModule: dbModule,
|
|
6045
|
+
devSettings: props.devSettings,
|
|
6046
|
+
space: props.space,
|
|
6047
|
+
fresh: true,
|
|
6048
|
+
bareReferenceDel: (_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareReferenceDel,
|
|
6049
|
+
})];
|
|
6050
|
+
case 1:
|
|
6051
|
+
sources = _d.sent();
|
|
6052
|
+
blockedIds = [];
|
|
6053
|
+
linkedBySource = new Map();
|
|
6054
|
+
deletedCount = 0;
|
|
6055
|
+
processed = 0;
|
|
6056
|
+
lastId = "";
|
|
6057
|
+
setDeleteProgress({ done: 0, total: total });
|
|
6058
|
+
_d.label = 2;
|
|
6059
|
+
case 2:
|
|
6060
|
+
_d.trys.push([2, 6, , 7]);
|
|
6061
|
+
_loop_1 = function () {
|
|
6062
|
+
var page, batchIds, batchSet, linkedIds, _loop_2, _i, sources_1, eachSource, _e, deletedIds, isStopped;
|
|
6063
|
+
return __generator(this, function (_f) {
|
|
6064
|
+
switch (_f.label) {
|
|
6065
|
+
case 0:
|
|
6066
|
+
if (!isMountedRef.current)
|
|
6067
|
+
throw new Error("left");
|
|
6068
|
+
return [4 /*yield*/, readServerQuery.call({
|
|
6069
|
+
type: "list",
|
|
6070
|
+
query: __spreadArray(__spreadArray([], query, true), (lastId
|
|
6071
|
+
? [{ type: ">", queryId: serverId, value: lastId }]
|
|
6072
|
+
: []), true),
|
|
6073
|
+
sort: { sortId: serverId, type: "asc" },
|
|
6074
|
+
limit: DELETE_BATCH_SIZE,
|
|
6075
|
+
attributeIds: [serverId],
|
|
6076
|
+
})];
|
|
6077
|
+
case 1:
|
|
6078
|
+
page = _f.sent();
|
|
6079
|
+
batchIds = ((_b = page === null || page === void 0 ? void 0 : page.data) !== null && _b !== void 0 ? _b : []).map(function (eachRow) {
|
|
6080
|
+
return handleGetRowId(eachRow);
|
|
6081
|
+
});
|
|
6082
|
+
if (batchIds.length === 0)
|
|
6083
|
+
return [2 /*return*/, "break"];
|
|
6084
|
+
if (lastId && !(batchIds[0] > lastId))
|
|
6085
|
+
throw new Error("no progress");
|
|
6086
|
+
lastId = batchIds[batchIds.length - 1];
|
|
6087
|
+
batchSet = new Set(batchIds);
|
|
6088
|
+
linkedIds = new Set();
|
|
6089
|
+
_loop_2 = function (eachSource) {
|
|
6090
|
+
var referenceRQ, columnId, linking;
|
|
6091
|
+
return __generator(this, function (_g) {
|
|
6092
|
+
switch (_g.label) {
|
|
6093
|
+
case 0:
|
|
6094
|
+
referenceRQ = new readQuery_1.ReadQuery({
|
|
6095
|
+
dbModule: dbModule,
|
|
6096
|
+
dbType: props.devSettings.server,
|
|
6097
|
+
dbCollection: eachSource.collectionId,
|
|
6098
|
+
dbEndpoint: props.devSettings.dbEndpoint,
|
|
6099
|
+
dbAPIToken: props.devSettings.dbAPIToken,
|
|
6100
|
+
dbUserToken: props.devSettings.dbUserToken,
|
|
6101
|
+
});
|
|
6102
|
+
columnId = eachSource.column.id;
|
|
6103
|
+
return [4 /*yield*/, referenceRQ.call({
|
|
6104
|
+
type: "list",
|
|
6105
|
+
query: [{ type: "in", queryId: columnId, value: batchIds }],
|
|
6106
|
+
stopLimit: true,
|
|
6107
|
+
attributeIds: [columnId],
|
|
6108
|
+
})];
|
|
6109
|
+
case 1:
|
|
6110
|
+
linking = _g.sent();
|
|
6111
|
+
((_c = linking === null || linking === void 0 ? void 0 : linking.data) !== null && _c !== void 0 ? _c : []).forEach(function (eachRow) {
|
|
6112
|
+
var values = Array.isArray(eachRow === null || eachRow === void 0 ? void 0 : eachRow[columnId])
|
|
6113
|
+
? eachRow[columnId]
|
|
6114
|
+
: [eachRow === null || eachRow === void 0 ? void 0 : eachRow[columnId]];
|
|
6115
|
+
values.forEach(function (eachValue) {
|
|
6116
|
+
var _a, _b, _c;
|
|
6117
|
+
var id = String((_b = (_a = eachValue === null || eachValue === void 0 ? void 0 : eachValue._id) !== null && _a !== void 0 ? _a : eachValue === null || eachValue === void 0 ? void 0 : eachValue.id) !== null && _b !== void 0 ? _b : eachValue);
|
|
6118
|
+
if (!batchSet.has(id))
|
|
6119
|
+
return;
|
|
6120
|
+
linkedIds.add(id);
|
|
6121
|
+
var key = "".concat(eachSource.collectionId, "|").concat(columnId);
|
|
6122
|
+
var link = (_c = linkedBySource.get(key)) !== null && _c !== void 0 ? _c : {
|
|
6123
|
+
collectionId: eachSource.collectionId,
|
|
6124
|
+
collectionName: eachSource.collectionName,
|
|
6125
|
+
columnId: columnId,
|
|
6126
|
+
columnType: eachSource.column.type,
|
|
6127
|
+
recordId: "",
|
|
6128
|
+
recordLabel: "",
|
|
6129
|
+
count: 0,
|
|
6130
|
+
};
|
|
6131
|
+
link.count += 1;
|
|
6132
|
+
linkedBySource.set(key, link);
|
|
6133
|
+
});
|
|
6134
|
+
});
|
|
6135
|
+
return [2 /*return*/];
|
|
6136
|
+
}
|
|
6137
|
+
});
|
|
6138
|
+
};
|
|
6139
|
+
_i = 0, sources_1 = sources;
|
|
6140
|
+
_f.label = 2;
|
|
6141
|
+
case 2:
|
|
6142
|
+
if (!(_i < sources_1.length)) return [3 /*break*/, 5];
|
|
6143
|
+
eachSource = sources_1[_i];
|
|
6144
|
+
return [5 /*yield**/, _loop_2(eachSource)];
|
|
6145
|
+
case 3:
|
|
6146
|
+
_f.sent();
|
|
6147
|
+
_f.label = 4;
|
|
6148
|
+
case 4:
|
|
6149
|
+
_i++;
|
|
6150
|
+
return [3 /*break*/, 2];
|
|
6151
|
+
case 5:
|
|
6152
|
+
blockedIds.push.apply(blockedIds, Array.from(linkedIds));
|
|
6153
|
+
return [4 /*yield*/, handleDeleteIdsInParts(batchIds.filter(function (eachId) { return !linkedIds.has(eachId); }))];
|
|
6154
|
+
case 6:
|
|
6155
|
+
_e = _f.sent(), deletedIds = _e.deletedIds, isStopped = _e.isStopped;
|
|
6156
|
+
deletedCount += deletedIds.length;
|
|
6157
|
+
processed += batchIds.length;
|
|
6158
|
+
setDeleteProgress({ done: processed, total: total });
|
|
6159
|
+
if (isStopped)
|
|
6160
|
+
throw new Error("stopped");
|
|
6161
|
+
if (batchIds.length < DELETE_BATCH_SIZE)
|
|
6162
|
+
return [2 /*return*/, "break"];
|
|
6163
|
+
return [2 /*return*/];
|
|
6164
|
+
}
|
|
6165
|
+
});
|
|
6166
|
+
};
|
|
6167
|
+
_d.label = 3;
|
|
6168
|
+
case 3:
|
|
6169
|
+
if (!(processed < total)) return [3 /*break*/, 5];
|
|
6170
|
+
return [5 /*yield**/, _loop_1()];
|
|
6171
|
+
case 4:
|
|
6172
|
+
state_1 = _d.sent();
|
|
6173
|
+
if (state_1 === "break")
|
|
6174
|
+
return [3 /*break*/, 5];
|
|
6175
|
+
return [3 /*break*/, 3];
|
|
6176
|
+
case 5: return [3 /*break*/, 7];
|
|
6177
|
+
case 6:
|
|
6178
|
+
err_14 = _d.sent();
|
|
6179
|
+
setNotification({
|
|
6180
|
+
type: false,
|
|
6181
|
+
title: "Delete stopped",
|
|
6182
|
+
msg: "".concat(deletedCount.toLocaleString(), " of ").concat(total.toLocaleString(), " records were deleted before an error. Refresh to see what is left."),
|
|
6183
|
+
});
|
|
6184
|
+
return [3 /*break*/, 7];
|
|
6185
|
+
case 7:
|
|
6186
|
+
setDeleteProgress(null);
|
|
6187
|
+
blockedDeleteIdsRef.current = blockedIds;
|
|
6188
|
+
isBlockedFromListRef.current = true;
|
|
6189
|
+
// INFO: a batch reads too many records to name each, so the box lists the
|
|
6190
|
+
// linking datasheets with how many of the selection each still links
|
|
6191
|
+
if (blockedIds.length > 0)
|
|
6192
|
+
setReferenceDeleteTableData(Array.from(linkedBySource.values()).map(function (eachLink) { return (__assign(__assign({}, eachLink), { recordLabel: "".concat(blockedIds.length.toLocaleString(), " selected records"), isSummary: true })); }));
|
|
6193
|
+
return [2 /*return*/, deletedCount];
|
|
6194
|
+
}
|
|
6195
|
+
});
|
|
6196
|
+
}); };
|
|
6197
|
+
// INFO: deletes records still linked elsewhere without the link check —
|
|
6198
|
+
// the records linking to them keep the link, which then shows as missing
|
|
6199
|
+
var handleDeleteAnyway = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6200
|
+
var ids, deletedIds, start, _a, batchDeleted, isStopped;
|
|
6201
|
+
return __generator(this, function (_b) {
|
|
6202
|
+
switch (_b.label) {
|
|
6203
|
+
case 0:
|
|
6204
|
+
if (deletingRef.current || !isBlockedFromListRef.current)
|
|
6205
|
+
return [2 /*return*/];
|
|
6206
|
+
ids = blockedDeleteIdsRef.current;
|
|
6207
|
+
setIsDeleteAnywayConfirm(false);
|
|
6208
|
+
setReferenceDeleteTableData([]);
|
|
6209
|
+
if (ids.length === 0)
|
|
6210
|
+
return [2 /*return*/];
|
|
6211
|
+
deletingRef.current = true;
|
|
6212
|
+
_b.label = 1;
|
|
6213
|
+
case 1:
|
|
6214
|
+
_b.trys.push([1, , 6, 7]);
|
|
6215
|
+
setLoading(true);
|
|
6216
|
+
setModalVisible(true);
|
|
6217
|
+
setDeleteProgress({ done: 0, total: ids.length });
|
|
6218
|
+
deletedIds = [];
|
|
6219
|
+
start = 0;
|
|
6220
|
+
_b.label = 2;
|
|
6221
|
+
case 2:
|
|
6222
|
+
if (!(start < ids.length)) return [3 /*break*/, 5];
|
|
6223
|
+
return [4 /*yield*/, handleDeleteIdsInParts(ids.slice(start, start + DELETE_BATCH_SIZE))];
|
|
6224
|
+
case 3:
|
|
6225
|
+
_a = _b.sent(), batchDeleted = _a.deletedIds, isStopped = _a.isStopped;
|
|
6226
|
+
deletedIds.push.apply(deletedIds, batchDeleted);
|
|
6227
|
+
setDeleteProgress({
|
|
6228
|
+
done: start + batchDeleted.length,
|
|
6229
|
+
total: ids.length,
|
|
6230
|
+
});
|
|
6231
|
+
if (isStopped) {
|
|
6232
|
+
setNotification({
|
|
6233
|
+
type: false,
|
|
6234
|
+
title: "Delete stopped",
|
|
6235
|
+
msg: "".concat(deletedIds.length.toLocaleString(), " of ").concat(ids.length.toLocaleString(), " records were deleted before an error. Refresh to see what is left."),
|
|
6236
|
+
});
|
|
6237
|
+
return [3 /*break*/, 5];
|
|
6238
|
+
}
|
|
6239
|
+
_b.label = 4;
|
|
6240
|
+
case 4:
|
|
6241
|
+
start += DELETE_BATCH_SIZE;
|
|
6242
|
+
return [3 /*break*/, 2];
|
|
6243
|
+
case 5: return [3 /*break*/, 7];
|
|
6244
|
+
case 6:
|
|
6245
|
+
// INFO: released however it ends, so a later delete is never locked out
|
|
6246
|
+
blockedDeleteIdsRef.current = [];
|
|
6247
|
+
deletingRef.current = false;
|
|
6248
|
+
setDeleteProgress(null);
|
|
6249
|
+
handleRefresh();
|
|
6250
|
+
return [7 /*endfinally*/];
|
|
6251
|
+
case 7: return [2 /*return*/];
|
|
6252
|
+
}
|
|
6253
|
+
});
|
|
6254
|
+
}); };
|
|
5898
6255
|
var handleMultipleRemoveSelectedData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
5899
|
-
var passcodeMatch, offlineDataResp, offlineData, filteredData, ids, notReferenceId, query,
|
|
5900
|
-
var
|
|
5901
|
-
return __generator(this, function (
|
|
5902
|
-
switch (
|
|
6256
|
+
var passcodeMatch, offlineDataResp, offlineData, filteredData, ids, notReferenceId, query, countData, matchedCount, isIdFiltered, query, responseData, formulaKeptIds_1, matchedRows, deleteIds, _a, deletedIds, isStopped, responseData, err_15;
|
|
6257
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6258
|
+
return __generator(this, function (_k) {
|
|
6259
|
+
switch (_k.label) {
|
|
5903
6260
|
case 0:
|
|
5904
6261
|
if (deletingRef.current)
|
|
5905
6262
|
return [2 /*return*/];
|
|
5906
6263
|
deletingRef.current = true;
|
|
5907
6264
|
setDeleting(true);
|
|
5908
|
-
|
|
6265
|
+
_k.label = 1;
|
|
5909
6266
|
case 1:
|
|
5910
|
-
|
|
6267
|
+
_k.trys.push([1, 22, 23, 24]);
|
|
5911
6268
|
setLoading(true);
|
|
5912
6269
|
setModalVisible(true);
|
|
5913
6270
|
passcodeMatch = deletePasscodeInput === deletePasscode;
|
|
5914
|
-
if (!passcodeMatch) return [3 /*break*/,
|
|
5915
|
-
if (!((
|
|
6271
|
+
if (!passcodeMatch) return [3 /*break*/, 20];
|
|
6272
|
+
if (!((_b = props.bareSettings) === null || _b === void 0 ? void 0 : _b.bareOffline)) return [3 /*break*/, 4];
|
|
5916
6273
|
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
5917
6274
|
case 2:
|
|
5918
|
-
offlineDataResp =
|
|
5919
|
-
offlineData = (
|
|
6275
|
+
offlineDataResp = _k.sent();
|
|
6276
|
+
offlineData = (_c = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _c !== void 0 ? _c : [];
|
|
5920
6277
|
filteredData = offlineData.filter(function (eachOfflineData) {
|
|
5921
6278
|
return !selectedIds.includes(eachOfflineData[serverId]);
|
|
5922
6279
|
});
|
|
@@ -5925,22 +6282,57 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
5925
6282
|
type: props.collectionId,
|
|
5926
6283
|
})];
|
|
5927
6284
|
case 3:
|
|
5928
|
-
|
|
5929
|
-
return [3 /*break*/,
|
|
6285
|
+
_k.sent();
|
|
6286
|
+
return [3 /*break*/, 19];
|
|
5930
6287
|
case 4:
|
|
5931
6288
|
ids = [];
|
|
5932
6289
|
notReferenceId = [];
|
|
5933
|
-
if (!selectAll) return [3 /*break*/,
|
|
6290
|
+
if (!(selectAll && !handleGetFormulaKeptIds())) return [3 /*break*/, 6];
|
|
6291
|
+
query = (_d = renderImpSearchFilterConditions()) !== null && _d !== void 0 ? _d : [];
|
|
6292
|
+
return [4 /*yield*/, readServerQuery.call({
|
|
6293
|
+
type: "list",
|
|
6294
|
+
query: query,
|
|
6295
|
+
limit: 1,
|
|
6296
|
+
})];
|
|
6297
|
+
case 5:
|
|
6298
|
+
countData = _k.sent();
|
|
6299
|
+
matchedCount = (_e = countData === null || countData === void 0 ? void 0 : countData.count) !== null && _e !== void 0 ? _e : 0;
|
|
6300
|
+
if (matchedCount !== selectAllSizeRef.current) {
|
|
6301
|
+
setNotification({
|
|
6302
|
+
type: false,
|
|
6303
|
+
title: "Nothing deleted",
|
|
6304
|
+
msg: handleGetChangedListMessage(matchedCount),
|
|
6305
|
+
});
|
|
6306
|
+
setLoading(false);
|
|
6307
|
+
setModalVisible(false);
|
|
6308
|
+
return [2 /*return*/];
|
|
6309
|
+
}
|
|
6310
|
+
_k.label = 6;
|
|
6311
|
+
case 6:
|
|
6312
|
+
isIdFiltered = ((_f = renderImpSearchFilterConditions()) !== null && _f !== void 0 ? _f : []).some(function (eachQuery) {
|
|
6313
|
+
return eachQuery.queryId === serverId && eachQuery.type !== "exists";
|
|
6314
|
+
});
|
|
6315
|
+
if (!(selectAll &&
|
|
6316
|
+
!handleGetFormulaKeptIds() &&
|
|
6317
|
+
!isIdFiltered &&
|
|
6318
|
+
selectAllSizeRef.current > DELETE_BATCH_THRESHOLD)) return [3 /*break*/, 8];
|
|
6319
|
+
return [4 /*yield*/, handleDeleteInBatches((_g = renderImpSearchFilterConditions()) !== null && _g !== void 0 ? _g : [], selectAllSizeRef.current)];
|
|
6320
|
+
case 7:
|
|
6321
|
+
_k.sent();
|
|
6322
|
+
ids = [];
|
|
6323
|
+
return [3 /*break*/, 17];
|
|
6324
|
+
case 8:
|
|
6325
|
+
if (!selectAll) return [3 /*break*/, 12];
|
|
5934
6326
|
query = renderImpSearchFilterConditions();
|
|
5935
6327
|
return [4 /*yield*/, readServerQuery.call({
|
|
5936
6328
|
type: "list",
|
|
5937
6329
|
query: query,
|
|
5938
6330
|
stopLimit: true,
|
|
5939
6331
|
})];
|
|
5940
|
-
case
|
|
5941
|
-
responseData =
|
|
6332
|
+
case 9:
|
|
6333
|
+
responseData = _k.sent();
|
|
5942
6334
|
formulaKeptIds_1 = handleGetFormulaKeptIds();
|
|
5943
|
-
matchedRows = ((
|
|
6335
|
+
matchedRows = ((_h = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _h !== void 0 ? _h : []).filter(function (eachRow) {
|
|
5944
6336
|
return !formulaKeptIds_1 || formulaKeptIds_1.has(handleGetRowId(eachRow));
|
|
5945
6337
|
});
|
|
5946
6338
|
// INFO: the rows found now must be the ones the reader was shown
|
|
@@ -5956,40 +6348,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
5956
6348
|
return [2 /*return*/];
|
|
5957
6349
|
}
|
|
5958
6350
|
return [4 /*yield*/, handleCheckDeleteReference(matchedRows, true)];
|
|
5959
|
-
case 6:
|
|
5960
|
-
notReferenceId = _f.sent();
|
|
5961
|
-
deleteIds = notReferenceId !== null && notReferenceId !== void 0 ? notReferenceId : [];
|
|
5962
|
-
deletedIds = [];
|
|
5963
|
-
start = 0;
|
|
5964
|
-
_f.label = 7;
|
|
5965
|
-
case 7:
|
|
5966
|
-
if (!(start < deleteIds.length)) return [3 /*break*/, 12];
|
|
5967
|
-
chunk = deleteIds.slice(start, start + DELETE_ID_CHUNK);
|
|
5968
|
-
_f.label = 8;
|
|
5969
|
-
case 8:
|
|
5970
|
-
_f.trys.push([8, 10, , 11]);
|
|
5971
|
-
return [4 /*yield*/, writeServerQuery.call("batchDelete", { id: chunk })];
|
|
5972
|
-
case 9:
|
|
5973
|
-
_f.sent();
|
|
5974
|
-
deletedIds.push.apply(deletedIds, chunk);
|
|
5975
|
-
return [3 /*break*/, 11];
|
|
5976
6351
|
case 10:
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
setNotification({
|
|
5981
|
-
type: false,
|
|
5982
|
-
title: "Delete stopped",
|
|
5983
|
-
msg: "".concat(deletedIds.length.toLocaleString(), " of ").concat(deleteIds.length.toLocaleString(), " records were deleted before an error. Refresh to see what is left."),
|
|
5984
|
-
});
|
|
5985
|
-
return [3 /*break*/, 12];
|
|
6352
|
+
notReferenceId = _k.sent();
|
|
6353
|
+
deleteIds = notReferenceId !== null && notReferenceId !== void 0 ? notReferenceId : [];
|
|
6354
|
+
return [4 /*yield*/, handleDeleteIdsInParts(deleteIds)];
|
|
5986
6355
|
case 11:
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
6356
|
+
_a = _k.sent(), deletedIds = _a.deletedIds, isStopped = _a.isStopped;
|
|
6357
|
+
if (isStopped)
|
|
6358
|
+
setNotification({
|
|
6359
|
+
type: false,
|
|
6360
|
+
title: "Delete stopped",
|
|
6361
|
+
msg: "".concat(deletedIds.length.toLocaleString(), " of ").concat(deleteIds.length.toLocaleString(), " records were deleted before an error. Refresh to see what is left."),
|
|
6362
|
+
});
|
|
6363
|
+
ids = [];
|
|
5991
6364
|
return [3 /*break*/, 17];
|
|
5992
|
-
case
|
|
6365
|
+
case 12: return [4 /*yield*/, readServerQuery.call({
|
|
5993
6366
|
type: "list",
|
|
5994
6367
|
query: [
|
|
5995
6368
|
{
|
|
@@ -6000,42 +6373,32 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6000
6373
|
],
|
|
6001
6374
|
stopLimit: true,
|
|
6002
6375
|
})];
|
|
6376
|
+
case 13:
|
|
6377
|
+
responseData = _k.sent();
|
|
6378
|
+
return [4 /*yield*/, handleCheckDeleteReference((_j = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _j !== void 0 ? _j : [], true)];
|
|
6003
6379
|
case 14:
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
case 15:
|
|
6007
|
-
notReferenceId = _f.sent();
|
|
6380
|
+
notReferenceId = _k.sent();
|
|
6381
|
+
if (!((notReferenceId !== null && notReferenceId !== void 0 ? notReferenceId : []).length > 0)) return [3 /*break*/, 16];
|
|
6008
6382
|
return [4 /*yield*/, writeServerQuery.call("batchDelete", {
|
|
6009
6383
|
id: notReferenceId,
|
|
6010
6384
|
})];
|
|
6385
|
+
case 15:
|
|
6386
|
+
_k.sent();
|
|
6387
|
+
_k.label = 16;
|
|
6011
6388
|
case 16:
|
|
6012
|
-
ids =
|
|
6013
|
-
|
|
6014
|
-
case 17:
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
data.append("data[assetCollectionName]", props.collectionId);
|
|
6018
|
-
data.append("data[assetParentId]", JSON.stringify(ids !== null && ids !== void 0 ? ids : []));
|
|
6019
|
-
uploadEndpoint = devSettings.uploadEndpoint
|
|
6020
|
-
? devSettings.uploadEndpoint
|
|
6021
|
-
: "/api/asset";
|
|
6022
|
-
if (props.devSettings.bucketName)
|
|
6023
|
-
data.append("data[bucketName]", props.devSettings.bucketName);
|
|
6024
|
-
return [4 /*yield*/, ((_e = props.lib) === null || _e === void 0 ? void 0 : _e.axios({
|
|
6025
|
-
data: data,
|
|
6026
|
-
method: "post",
|
|
6027
|
-
url: "".concat(uploadEndpoint, "/batchDeleteDirectory"),
|
|
6028
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
6029
|
-
}))];
|
|
6389
|
+
ids = notReferenceId !== null && notReferenceId !== void 0 ? notReferenceId : [];
|
|
6390
|
+
_k.label = 17;
|
|
6391
|
+
case 17:
|
|
6392
|
+
// INFO: files go only with records that were deleted
|
|
6393
|
+
return [4 /*yield*/, handleDeleteRecordFiles(ids !== null && ids !== void 0 ? ids : [])];
|
|
6030
6394
|
case 18:
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
case 19:
|
|
6395
|
+
// INFO: files go only with records that were deleted
|
|
6396
|
+
_k.sent();
|
|
6034
6397
|
if (mapViewRef.current)
|
|
6035
6398
|
mapViewRef.current.handleClearPolygons();
|
|
6036
|
-
|
|
6037
|
-
case
|
|
6038
|
-
case
|
|
6399
|
+
_k.label = 19;
|
|
6400
|
+
case 19: return [3 /*break*/, 21];
|
|
6401
|
+
case 20:
|
|
6039
6402
|
setNotification({
|
|
6040
6403
|
type: false,
|
|
6041
6404
|
title: "Incorrect Passcode",
|
|
@@ -6044,15 +6407,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6044
6407
|
setLoading(false);
|
|
6045
6408
|
setModalVisible(false);
|
|
6046
6409
|
return [2 /*return*/];
|
|
6047
|
-
case
|
|
6410
|
+
case 21: return [3 /*break*/, 24];
|
|
6411
|
+
case 22:
|
|
6412
|
+
err_15 = _k.sent();
|
|
6413
|
+
return [3 /*break*/, 24];
|
|
6048
6414
|
case 23:
|
|
6049
|
-
err_13 = _f.sent();
|
|
6050
|
-
return [3 /*break*/, 25];
|
|
6051
|
-
case 24:
|
|
6052
6415
|
deletingRef.current = false;
|
|
6053
6416
|
setDeleting(false);
|
|
6054
6417
|
return [7 /*endfinally*/];
|
|
6055
|
-
case
|
|
6418
|
+
case 24:
|
|
6056
6419
|
setDeletePasscodeInput("");
|
|
6057
6420
|
// INFO: the selection is gone with the rows it covered
|
|
6058
6421
|
if (selectAll)
|
|
@@ -6063,7 +6426,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6063
6426
|
});
|
|
6064
6427
|
}); };
|
|
6065
6428
|
var handleRemoveSelectedData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6066
|
-
var deleted, deletable, selectedId_1, deleteIds, res, offlineDataResp, offlineData, selectedIndex_2, doc,
|
|
6429
|
+
var deleted, deletable, selectedId_1, deleteIds, res, offlineDataResp, offlineData, selectedIndex_2, doc, err_16;
|
|
6067
6430
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6068
6431
|
return __generator(this, function (_k) {
|
|
6069
6432
|
switch (_k.label) {
|
|
@@ -6161,7 +6524,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6161
6524
|
_k.label = 13;
|
|
6162
6525
|
case 13: return [3 /*break*/, 16];
|
|
6163
6526
|
case 14:
|
|
6164
|
-
|
|
6527
|
+
err_16 = _k.sent();
|
|
6165
6528
|
setDeleteModal(false);
|
|
6166
6529
|
setDeleteFeedId("");
|
|
6167
6530
|
return [3 /*break*/, 16];
|
|
@@ -6183,21 +6546,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6183
6546
|
});
|
|
6184
6547
|
}); };
|
|
6185
6548
|
var handleCheckDeleteReference = function (selectedData, multipleDelete) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6186
|
-
var existDataIds, existsData, handleFindReference_1, referenceSources_1,
|
|
6549
|
+
var existDataIds, existsData, handleFindReference_1, referenceSources_1, err_17;
|
|
6187
6550
|
var _a, _b, _c;
|
|
6188
6551
|
return __generator(this, function (_d) {
|
|
6189
6552
|
switch (_d.label) {
|
|
6190
6553
|
case 0:
|
|
6191
6554
|
existDataIds = [];
|
|
6192
|
-
existsData =
|
|
6555
|
+
existsData = [];
|
|
6193
6556
|
_d.label = 1;
|
|
6194
6557
|
case 1:
|
|
6195
6558
|
_d.trys.push([1, 4, , 5]);
|
|
6196
6559
|
handleFindReference_1 = function (data, referenceStructure, space, spaceId, spaceName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6197
6560
|
var referenceRQ, currentReferenceSelectedList;
|
|
6198
|
-
var _a, _b, _c
|
|
6199
|
-
return __generator(this, function (
|
|
6200
|
-
switch (
|
|
6561
|
+
var _a, _b, _c;
|
|
6562
|
+
return __generator(this, function (_d) {
|
|
6563
|
+
switch (_d.label) {
|
|
6201
6564
|
case 0:
|
|
6202
6565
|
referenceRQ = new readQuery_1.ReadQuery({
|
|
6203
6566
|
dbModule: dbModule,
|
|
@@ -6214,19 +6577,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6214
6577
|
],
|
|
6215
6578
|
})];
|
|
6216
6579
|
case 1:
|
|
6217
|
-
currentReferenceSelectedList =
|
|
6580
|
+
currentReferenceSelectedList = _d.sent();
|
|
6218
6581
|
if ((currentReferenceSelectedList === null || currentReferenceSelectedList === void 0 ? void 0 : currentReferenceSelectedList.data) &&
|
|
6219
6582
|
(currentReferenceSelectedList === null || currentReferenceSelectedList === void 0 ? void 0 : currentReferenceSelectedList.data.length) > 0) {
|
|
6220
6583
|
if (!existDataIds.includes(data[serverId]))
|
|
6221
6584
|
existDataIds.push(data[serverId]);
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
]
|
|
6229
|
-
|
|
6585
|
+
existsData.push({
|
|
6586
|
+
collectionId: space ? space._id : (spaceId !== null && spaceId !== void 0 ? spaceId : ""),
|
|
6587
|
+
collectionName: space ? space.name : (spaceName !== null && spaceName !== void 0 ? spaceName : ""),
|
|
6588
|
+
columnId: referenceStructure.id,
|
|
6589
|
+
columnType: referenceStructure.type,
|
|
6590
|
+
recordId: data[serverId],
|
|
6591
|
+
recordLabel: String((_b = data[(_a = referenceStructure === null || referenceStructure === void 0 ? void 0 : referenceStructure.referenceLabel) !== null && _a !== void 0 ? _a : ""]) !== null && _b !== void 0 ? _b : data[serverId]),
|
|
6592
|
+
count: (_c = currentReferenceSelectedList.count) !== null && _c !== void 0 ? _c : currentReferenceSelectedList.data.length,
|
|
6593
|
+
});
|
|
6230
6594
|
}
|
|
6231
6595
|
return [2 /*return*/];
|
|
6232
6596
|
}
|
|
@@ -6268,10 +6632,22 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6268
6632
|
_d.sent();
|
|
6269
6633
|
return [3 /*break*/, 5];
|
|
6270
6634
|
case 4:
|
|
6271
|
-
|
|
6272
|
-
|
|
6635
|
+
err_17 = _d.sent();
|
|
6636
|
+
// INFO: a datasheet that could not be checked may still link to these
|
|
6637
|
+
// records, so none of them is deleted
|
|
6638
|
+
setNotification({
|
|
6639
|
+
type: false,
|
|
6640
|
+
title: "Nothing deleted",
|
|
6641
|
+
msg: "Couldn't check where these records are used. Try again.",
|
|
6642
|
+
});
|
|
6643
|
+
return [2 /*return*/, []];
|
|
6273
6644
|
case 5:
|
|
6274
|
-
|
|
6645
|
+
blockedDeleteIdsRef.current = __spreadArray([], existDataIds, true);
|
|
6646
|
+
isBlockedFromListRef.current = !!multipleDelete;
|
|
6647
|
+
setReferenceDeleteTableData(__spreadArray([], existsData, true).sort(function (left, right) {
|
|
6648
|
+
return left.recordLabel.localeCompare(right.recordLabel) ||
|
|
6649
|
+
left.collectionName.localeCompare(right.collectionName);
|
|
6650
|
+
}));
|
|
6275
6651
|
return [2 /*return*/, selectedData
|
|
6276
6652
|
.filter(function (eachData) {
|
|
6277
6653
|
return !existDataIds.includes(eachData[serverId]);
|
|
@@ -6281,7 +6657,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6281
6657
|
});
|
|
6282
6658
|
}); };
|
|
6283
6659
|
var handleCloneSelectedData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6284
|
-
var responseData, newDataList_1, res,
|
|
6660
|
+
var responseData, newDataList_1, res, err_18;
|
|
6285
6661
|
return __generator(this, function (_a) {
|
|
6286
6662
|
switch (_a.label) {
|
|
6287
6663
|
case 0:
|
|
@@ -6322,7 +6698,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6322
6698
|
_a.label = 4;
|
|
6323
6699
|
case 4: return [3 /*break*/, 6];
|
|
6324
6700
|
case 5:
|
|
6325
|
-
|
|
6701
|
+
err_18 = _a.sent();
|
|
6326
6702
|
return [3 /*break*/, 6];
|
|
6327
6703
|
case 6:
|
|
6328
6704
|
setLoading(false);
|
|
@@ -6331,7 +6707,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6331
6707
|
});
|
|
6332
6708
|
}); };
|
|
6333
6709
|
var handleBatchUpdateData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6334
|
-
var model_1, columnId_1, dataToSubmit_1, isFile, res, updateQuery, handleRefuseUpdate, formulaKeptIds_2, isById, responseData, matchedRows, countData, matchedCount, selectAllQuery, batchUpdateConfig, res,
|
|
6710
|
+
var model_1, columnId_1, dataToSubmit_1, isFile, res, updateQuery, handleRefuseUpdate, formulaKeptIds_2, isById, responseData, matchedRows, countData, matchedCount, selectAllQuery, batchUpdateConfig, res, err_19;
|
|
6335
6711
|
var _a, _b;
|
|
6336
6712
|
return __generator(this, function (_c) {
|
|
6337
6713
|
switch (_c.label) {
|
|
@@ -6474,12 +6850,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6474
6850
|
_c.label = 11;
|
|
6475
6851
|
case 11: return [3 /*break*/, 14];
|
|
6476
6852
|
case 12:
|
|
6477
|
-
|
|
6478
|
-
if (
|
|
6853
|
+
err_19 = _c.sent();
|
|
6854
|
+
if (err_19.response) {
|
|
6479
6855
|
setNotification({
|
|
6480
6856
|
type: false,
|
|
6481
6857
|
title: "Error",
|
|
6482
|
-
msg: handleGetWriteErrorMessage(
|
|
6858
|
+
msg: handleGetWriteErrorMessage(err_19.response),
|
|
6483
6859
|
});
|
|
6484
6860
|
}
|
|
6485
6861
|
return [3 /*break*/, 14];
|
|
@@ -6493,7 +6869,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6493
6869
|
});
|
|
6494
6870
|
}); };
|
|
6495
6871
|
var handleUploadOfflineData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6496
|
-
var dataUploadedId, offlineDataResp, offlineData, offlineDataIds, updateDataRes, updateDataList,
|
|
6872
|
+
var dataUploadedId, offlineDataResp, offlineData, offlineDataIds, updateDataRes, updateDataList, _loop_3, i, err_20, success, fullDataResp, fullData, updatedData;
|
|
6497
6873
|
var _a, _b, _c, _d, _e, _f;
|
|
6498
6874
|
return __generator(this, function (_g) {
|
|
6499
6875
|
switch (_g.label) {
|
|
@@ -6528,8 +6904,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6528
6904
|
case 3:
|
|
6529
6905
|
updateDataRes = _g.sent();
|
|
6530
6906
|
updateDataList = (_b = updateDataRes === null || updateDataRes === void 0 ? void 0 : updateDataRes.data) !== null && _b !== void 0 ? _b : [];
|
|
6531
|
-
|
|
6532
|
-
var eachOfflineData, offlineDataId, storedBaseline, serverDoc, isUpdate, preComplete, res,
|
|
6907
|
+
_loop_3 = function (i) {
|
|
6908
|
+
var eachOfflineData, offlineDataId, storedBaseline, serverDoc, isUpdate, preComplete, res, err_21;
|
|
6533
6909
|
var _h;
|
|
6534
6910
|
return __generator(this, function (_j) {
|
|
6535
6911
|
switch (_j.label) {
|
|
@@ -6590,7 +6966,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6590
6966
|
_j.sent();
|
|
6591
6967
|
return [3 /*break*/, 8];
|
|
6592
6968
|
case 7:
|
|
6593
|
-
|
|
6969
|
+
err_21 = _j.sent();
|
|
6594
6970
|
return [3 /*break*/, 8];
|
|
6595
6971
|
case 8: return [2 /*return*/];
|
|
6596
6972
|
}
|
|
@@ -6600,7 +6976,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6600
6976
|
_g.label = 4;
|
|
6601
6977
|
case 4:
|
|
6602
6978
|
if (!(i < offlineData.length)) return [3 /*break*/, 7];
|
|
6603
|
-
return [5 /*yield**/,
|
|
6979
|
+
return [5 /*yield**/, _loop_3(i)];
|
|
6604
6980
|
case 5:
|
|
6605
6981
|
_g.sent();
|
|
6606
6982
|
_g.label = 6;
|
|
@@ -6609,7 +6985,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6609
6985
|
return [3 /*break*/, 4];
|
|
6610
6986
|
case 7: return [3 /*break*/, 9];
|
|
6611
6987
|
case 8:
|
|
6612
|
-
|
|
6988
|
+
err_20 = _g.sent();
|
|
6613
6989
|
return [3 /*break*/, 9];
|
|
6614
6990
|
case 9:
|
|
6615
6991
|
success = dataUploadedId.length === offlineData.length;
|
|
@@ -6662,7 +7038,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6662
7038
|
var columnTypeActions = {
|
|
6663
7039
|
canUpdate: canUpdateRecord,
|
|
6664
7040
|
dateWarnings: isDateWarnings,
|
|
6665
|
-
onButtonClick: (
|
|
7041
|
+
onButtonClick: (_112 = props.organise) === null || _112 === void 0 ? void 0 : _112.onButtonClick,
|
|
6666
7042
|
onUpdateCell: function (rowId, columnId, value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6667
7043
|
var _a;
|
|
6668
7044
|
return __generator(this, function (_b) {
|
|
@@ -6679,7 +7055,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6679
7055
|
}
|
|
6680
7056
|
});
|
|
6681
7057
|
}); },
|
|
6682
|
-
onTimeTrackingAction: ((
|
|
7058
|
+
onTimeTrackingAction: ((_113 = props.organise) === null || _113 === void 0 ? void 0 : _113.onTimeTrackingAction) && canUpdateRecord
|
|
6683
7059
|
? function (rowId, columnId, action) {
|
|
6684
7060
|
return handleTimeTrackingAction(rowId, columnId, action);
|
|
6685
7061
|
}
|
|
@@ -6708,7 +7084,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6708
7084
|
});
|
|
6709
7085
|
}); };
|
|
6710
7086
|
var handleSubmitData = function (type, rowId, columnId, data, offlineId, isOfflineUpdate, isDraft) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6711
|
-
var selectedId, id, handleIsSavedSubmit, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_3,
|
|
7087
|
+
var selectedId, id, handleIsSavedSubmit, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_3, err_22, isUniqueIdFieldCreate, isExistingDoc, newRecordData_1, changedAttributeIds, baseDraftValue, hasBaseDraftChange, offlineDataResp, clonedForOffline, tempData, selectedIndex_4, offlineData, err_23, dataToSubmit_2, changedAttributeIds, baseDraftValue, hasBaseDraftChange, operationType, currentRow, wentToServer, dataId, err_24, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_5, _a;
|
|
6712
7088
|
var _b, _c, _d, _e;
|
|
6713
7089
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
6714
7090
|
return __generator(this, function (_z) {
|
|
@@ -6840,7 +7216,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
6840
7216
|
res = true;
|
|
6841
7217
|
return [3 /*break*/, 9];
|
|
6842
7218
|
case 8:
|
|
6843
|
-
|
|
7219
|
+
err_22 = _z.sent();
|
|
6844
7220
|
return [3 /*break*/, 9];
|
|
6845
7221
|
case 9: return [3 /*break*/, 16];
|
|
6846
7222
|
case 10:
|
|
@@ -7007,7 +7383,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7007
7383
|
res = true;
|
|
7008
7384
|
return [3 /*break*/, 22];
|
|
7009
7385
|
case 21:
|
|
7010
|
-
|
|
7386
|
+
err_23 = _z.sent();
|
|
7011
7387
|
return [3 /*break*/, 22];
|
|
7012
7388
|
case 22: return [3 /*break*/, 25];
|
|
7013
7389
|
case 23:
|
|
@@ -7157,8 +7533,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7157
7533
|
dataId = res ? id : "";
|
|
7158
7534
|
return [2 /*return*/, dataId];
|
|
7159
7535
|
case 39:
|
|
7160
|
-
|
|
7161
|
-
console.log("error",
|
|
7536
|
+
err_24 = _z.sent();
|
|
7537
|
+
console.log("error", err_24);
|
|
7162
7538
|
// INFO: clear in-flight guard on failure so the next save retries as a create
|
|
7163
7539
|
if (isCreatingRef.current) {
|
|
7164
7540
|
isCreatingRef.current = false;
|
|
@@ -7169,7 +7545,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7169
7545
|
id &&
|
|
7170
7546
|
!offlineId &&
|
|
7171
7547
|
!isOfflineUpdate &&
|
|
7172
|
-
!
|
|
7548
|
+
!err_24.response)) return [3 /*break*/, 44];
|
|
7173
7549
|
_z.label = 40;
|
|
7174
7550
|
case 40:
|
|
7175
7551
|
_z.trys.push([40, 43, , 44]);
|
|
@@ -7228,11 +7604,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7228
7604
|
_a = _z.sent();
|
|
7229
7605
|
return [3 /*break*/, 44];
|
|
7230
7606
|
case 44:
|
|
7231
|
-
if (
|
|
7607
|
+
if (err_24.response) {
|
|
7232
7608
|
setNotification({
|
|
7233
7609
|
type: false,
|
|
7234
7610
|
title: "Error",
|
|
7235
|
-
msg: handleGetWriteErrorMessage(
|
|
7611
|
+
msg: handleGetWriteErrorMessage(err_24.response),
|
|
7236
7612
|
});
|
|
7237
7613
|
}
|
|
7238
7614
|
return [3 /*break*/, 45];
|
|
@@ -7279,7 +7655,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7279
7655
|
});
|
|
7280
7656
|
}); };
|
|
7281
7657
|
var handleSubmit = function (isDraft) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7282
|
-
var preComplete, res, updatedMarkdownData_1, uploadedData_2, uploadTypes_1,
|
|
7658
|
+
var preComplete, res, updatedMarkdownData_1, uploadedData_2, uploadTypes_1, err_25;
|
|
7283
7659
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
7284
7660
|
return __generator(this, function (_m) {
|
|
7285
7661
|
switch (_m.label) {
|
|
@@ -7412,7 +7788,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7412
7788
|
isSubmittingRef.current = false;
|
|
7413
7789
|
return [3 /*break*/, 9];
|
|
7414
7790
|
case 8:
|
|
7415
|
-
|
|
7791
|
+
err_25 = _m.sent();
|
|
7416
7792
|
setModalVisible(false);
|
|
7417
7793
|
setLoading(false);
|
|
7418
7794
|
isSubmittingRef.current = false;
|
|
@@ -7422,7 +7798,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7422
7798
|
});
|
|
7423
7799
|
}); };
|
|
7424
7800
|
var handleUpdateKanbanChecked = function (id, columnId, value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7425
|
-
var
|
|
7801
|
+
var err_26;
|
|
7426
7802
|
var _a;
|
|
7427
7803
|
return __generator(this, function (_b) {
|
|
7428
7804
|
switch (_b.label) {
|
|
@@ -7440,7 +7816,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7440
7816
|
_b.sent();
|
|
7441
7817
|
return [3 /*break*/, 4];
|
|
7442
7818
|
case 3:
|
|
7443
|
-
|
|
7819
|
+
err_26 = _b.sent();
|
|
7444
7820
|
return [3 /*break*/, 4];
|
|
7445
7821
|
case 4: return [2 /*return*/];
|
|
7446
7822
|
}
|
|
@@ -7817,7 +8193,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7817
8193
|
handleUpdateChangeData(clonedData);
|
|
7818
8194
|
};
|
|
7819
8195
|
var handleOnChangeSelect = function (id, value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7820
|
-
var _a, data, model, isUpdate, clonedData, refetchReference, currentSchema, allowedWatchedColumnTypes_1, watchedColumns, _i, watchedColumns_1, eachWatched, dependency, referenceRQ, valueRes,
|
|
8196
|
+
var _a, data, model, isUpdate, clonedData, refetchReference, currentSchema, allowedWatchedColumnTypes_1, watchedColumns, _i, watchedColumns_1, eachWatched, dependency, referenceRQ, valueRes, err_27;
|
|
7821
8197
|
return __generator(this, function (_b) {
|
|
7822
8198
|
switch (_b.label) {
|
|
7823
8199
|
case 0:
|
|
@@ -7880,7 +8256,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7880
8256
|
return [3 /*break*/, 3];
|
|
7881
8257
|
case 6: return [3 /*break*/, 8];
|
|
7882
8258
|
case 7:
|
|
7883
|
-
|
|
8259
|
+
err_27 = _b.sent();
|
|
7884
8260
|
return [3 /*break*/, 8];
|
|
7885
8261
|
case 8:
|
|
7886
8262
|
clonedData[id] = value;
|
|
@@ -7958,7 +8334,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7958
8334
|
}
|
|
7959
8335
|
};
|
|
7960
8336
|
var handleStepCSV = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7961
|
-
var csvList_1,
|
|
8337
|
+
var csvList_1, _loop_4, _i, _a, _b, eachKey, eachValue, valid_1, errorValue_1, excelFormData, updateFields, response, open_1, err_28;
|
|
7962
8338
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7963
8339
|
return __generator(this, function (_p) {
|
|
7964
8340
|
switch (_p.label) {
|
|
@@ -7973,7 +8349,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
7973
8349
|
case 1:
|
|
7974
8350
|
if (!(stepCSVIndex === 1)) return [3 /*break*/, 3];
|
|
7975
8351
|
csvList_1 = [];
|
|
7976
|
-
|
|
8352
|
+
_loop_4 = function (eachKey, eachValue) {
|
|
7977
8353
|
if (eachKey && eachValue && typeof eachValue === "string") {
|
|
7978
8354
|
var selectedModel = structure.find(function (eachModel) {
|
|
7979
8355
|
return eachModel.id === eachValue;
|
|
@@ -8032,7 +8408,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8032
8408
|
};
|
|
8033
8409
|
for (_i = 0, _a = Object.entries(listCSVMapAttribute); _i < _a.length; _i++) {
|
|
8034
8410
|
_b = _a[_i], eachKey = _b[0], eachValue = _b[1];
|
|
8035
|
-
|
|
8411
|
+
_loop_4(eachKey, eachValue);
|
|
8036
8412
|
}
|
|
8037
8413
|
valid_1 = true;
|
|
8038
8414
|
errorValue_1 = "";
|
|
@@ -8105,12 +8481,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8105
8481
|
_p.label = 5;
|
|
8106
8482
|
case 5: return [3 /*break*/, 7];
|
|
8107
8483
|
case 6:
|
|
8108
|
-
|
|
8484
|
+
err_28 = _p.sent();
|
|
8109
8485
|
setLoading(false);
|
|
8110
8486
|
setNotification({
|
|
8111
8487
|
type: false,
|
|
8112
8488
|
title: "Import Error",
|
|
8113
|
-
msg:
|
|
8489
|
+
msg: err_28.message,
|
|
8114
8490
|
});
|
|
8115
8491
|
return [3 /*break*/, 7];
|
|
8116
8492
|
case 7: return [2 /*return*/];
|
|
@@ -8118,7 +8494,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8118
8494
|
});
|
|
8119
8495
|
}); };
|
|
8120
8496
|
var handleExportCSVData = function (downloadLinkOnly, printOnly) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8121
|
-
var exportQueryList, formulaRows, kept, baseUrl, apiEndpoint, reqData, res, dataList, csvDownloadLink, notificaitonMsg,
|
|
8497
|
+
var exportQueryList, formulaRows, kept, baseUrl, apiEndpoint, reqData, res, dataList, csvDownloadLink, notificaitonMsg, err_29;
|
|
8122
8498
|
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;
|
|
8123
8499
|
return __generator(this, function (_2) {
|
|
8124
8500
|
switch (_2.label) {
|
|
@@ -8204,7 +8580,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8204
8580
|
setExportCSVEmail((_1 = (_0 = props.devSettings.currentUser) === null || _0 === void 0 ? void 0 : _0.userEmail) !== null && _1 !== void 0 ? _1 : "");
|
|
8205
8581
|
return [3 /*break*/, 6];
|
|
8206
8582
|
case 5:
|
|
8207
|
-
|
|
8583
|
+
err_29 = _2.sent();
|
|
8208
8584
|
setNotification({
|
|
8209
8585
|
type: true,
|
|
8210
8586
|
title: "Export Failed",
|
|
@@ -8260,7 +8636,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8260
8636
|
});
|
|
8261
8637
|
}); };
|
|
8262
8638
|
var handleExportReadPDF = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
8263
|
-
var elementToExport, dimensionsConfig, headerConfig_1, isMobile, scale, html2canvasOptions, originalStyles, captureWidth, captureHeight, canvas, pageWidth, pageHeight, orientation_1, pdf, pixelsToMm, elementWidthMm, elementHeightMm, pageSize, margin, headerHeight, imageDataURL, imageWidth_1, imageHeight_1, hasImage, hasText, img_1,
|
|
8639
|
+
var elementToExport, dimensionsConfig, headerConfig_1, isMobile, scale, html2canvasOptions, originalStyles, captureWidth, captureHeight, canvas, pageWidth, pageHeight, orientation_1, pdf, pixelsToMm, elementWidthMm, elementHeightMm, pageSize, margin, headerHeight, imageDataURL, imageWidth_1, imageHeight_1, hasImage, hasText, img_1, err_30, textHeight, usableWidth, imgHeight, usableHeight, currentY, imgX, imgY, imgW, imgH, finalX, textY, textX, heightLeft, page, currentY, imgX, imgY, imgW, imgH, finalX, textY, textX, sourceY, sourceHeight, pageCanvas, ctx, pageData, pdfBlob, err_31;
|
|
8264
8640
|
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;
|
|
8265
8641
|
return __generator(this, function (_4) {
|
|
8266
8642
|
switch (_4.label) {
|
|
@@ -8431,8 +8807,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8431
8807
|
headerHeight = imageHeight_1 + 2;
|
|
8432
8808
|
return [3 /*break*/, 13];
|
|
8433
8809
|
case 12:
|
|
8434
|
-
|
|
8435
|
-
console.error("Failed to load PDF header image:",
|
|
8810
|
+
err_30 = _4.sent();
|
|
8811
|
+
console.error("Failed to load PDF header image:", err_30);
|
|
8436
8812
|
console.error("Image source:", headerConfig_1.image.src);
|
|
8437
8813
|
return [3 /*break*/, 13];
|
|
8438
8814
|
case 13:
|
|
@@ -8573,8 +8949,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8573
8949
|
}
|
|
8574
8950
|
return [3 /*break*/, 17];
|
|
8575
8951
|
case 15:
|
|
8576
|
-
|
|
8577
|
-
console.error("PDF export error:",
|
|
8952
|
+
err_31 = _4.sent();
|
|
8953
|
+
console.error("PDF export error:", err_31);
|
|
8578
8954
|
setNotification({
|
|
8579
8955
|
type: false,
|
|
8580
8956
|
title: "Error",
|
|
@@ -8814,7 +9190,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8814
9190
|
: getActiveUserHiddenColumnIds().includes(column.id);
|
|
8815
9191
|
};
|
|
8816
9192
|
var renderViewSettingsContent = function () {
|
|
8817
|
-
var _a, _b, _c, _d, _e, _f;
|
|
9193
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8818
9194
|
var viewColumns = getViewSettingsColumns();
|
|
8819
9195
|
var hiddenCount = viewColumns.filter(getIsColumnHidden).length;
|
|
8820
9196
|
var visibleCount = viewColumns.length - hiddenCount;
|
|
@@ -8914,7 +9290,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8914
9290
|
react_1.default.createElement("div", { className: "mt-1" },
|
|
8915
9291
|
react_1.default.createElement(select_1.Select, { id: "dtw-view-group-by", portalDropdown: true, label: "", placeholder: "Column", value: groupId !== null && groupId !== void 0 ? groupId : "", darkMode: (_f = props.organise) === null || _f === void 0 ? void 0 : _f.darkMode, options: handleGetGroupByOptions(), onChange: function (value) {
|
|
8916
9292
|
return handleChangeGroupBy(value !== null && value !== void 0 ? value : "", true);
|
|
8917
|
-
} }))
|
|
9293
|
+
} })),
|
|
9294
|
+
groupId && handleCheckGroupOrderShown() && (react_1.default.createElement("div", { className: "mt-2" },
|
|
9295
|
+
react_1.default.createElement(select_1.Select, { id: "dtw-view-group-order", portalDropdown: true, label: "", value: groupOrder, darkMode: (_g = props.organise) === null || _g === void 0 ? void 0 : _g.darkMode, options: [
|
|
9296
|
+
{ key: "", label: "Column order" },
|
|
9297
|
+
{ key: "most", label: "Most records first" },
|
|
9298
|
+
{ key: "fewest", label: "Fewest records first" },
|
|
9299
|
+
], onChange: function (value) {
|
|
9300
|
+
return setGroupOrder((value !== null && value !== void 0 ? value : ""));
|
|
9301
|
+
} }))))),
|
|
8918
9302
|
react_1.default.createElement("div", { className: "mt-3 border-t pt-3 ".concat(dividerColor) },
|
|
8919
9303
|
react_1.default.createElement("p", { className: "text-sm font-medium ".concat(labelColor) }, "Rows per page"),
|
|
8920
9304
|
react_1.default.createElement("div", { className: "mt-2 flex flex-row flex-wrap gap-2" }, PAGE_LIMIT_OPTIONS.map(function (eachOption) { return (react_1.default.createElement("button", { key: eachOption, type: "button", "data-testid": "dtw-page-limit-".concat(eachOption), className: "rounded-md border px-3 py-1 text-sm ".concat(pageLimit === eachOption
|
|
@@ -8934,8 +9318,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
8934
9318
|
: rows;
|
|
8935
9319
|
};
|
|
8936
9320
|
/* eslint-disable */
|
|
8937
|
-
var newTableRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(tableData); }, [tableData, (
|
|
8938
|
-
var newTableSpaceRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(spaceTableData); }, [spaceTableData, (
|
|
9321
|
+
var newTableRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(tableData); }, [tableData, (_114 = props.bareSettings) === null || _114 === void 0 ? void 0 : _114.bareNewDTW]);
|
|
9322
|
+
var newTableSpaceRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(spaceTableData); }, [spaceTableData, (_115 = props.bareSettings) === null || _115 === void 0 ? void 0 : _115.bareNewDTW]);
|
|
8939
9323
|
/* eslint-enable */
|
|
8940
9324
|
// INFO: beside a record's title, the pencil opens its edit form for whoever
|
|
8941
9325
|
// may update, and the bubble opens comments and logs for anyone who can see
|
|
@@ -10955,7 +11339,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
10955
11339
|
// around it. Each is saved with only its changed fields, then patched into
|
|
10956
11340
|
// the list in place
|
|
10957
11341
|
var handleSaveRecordChanges = function (changes) { return __awaiter(void 0, void 0, void 0, function () {
|
|
10958
|
-
var
|
|
11342
|
+
var _loop_5, _i, changes_1, eachChange, err_32;
|
|
10959
11343
|
var _a;
|
|
10960
11344
|
return __generator(this, function (_b) {
|
|
10961
11345
|
switch (_b.label) {
|
|
@@ -10964,7 +11348,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
10964
11348
|
_b.label = 1;
|
|
10965
11349
|
case 1:
|
|
10966
11350
|
_b.trys.push([1, 6, 7, 8]);
|
|
10967
|
-
|
|
11351
|
+
_loop_5 = function (eachChange) {
|
|
10968
11352
|
var currentRow;
|
|
10969
11353
|
return __generator(this, function (_c) {
|
|
10970
11354
|
switch (_c.label) {
|
|
@@ -10995,7 +11379,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
10995
11379
|
case 2:
|
|
10996
11380
|
if (!(_i < changes_1.length)) return [3 /*break*/, 5];
|
|
10997
11381
|
eachChange = changes_1[_i];
|
|
10998
|
-
return [5 /*yield**/,
|
|
11382
|
+
return [5 /*yield**/, _loop_5(eachChange)];
|
|
10999
11383
|
case 3:
|
|
11000
11384
|
_b.sent();
|
|
11001
11385
|
_b.label = 4;
|
|
@@ -11004,12 +11388,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
11004
11388
|
return [3 /*break*/, 2];
|
|
11005
11389
|
case 5: return [3 /*break*/, 8];
|
|
11006
11390
|
case 6:
|
|
11007
|
-
|
|
11391
|
+
err_32 = _b.sent();
|
|
11008
11392
|
setNotification({
|
|
11009
11393
|
type: false,
|
|
11010
11394
|
title: "Error",
|
|
11011
|
-
msg: (
|
|
11012
|
-
? handleGetWriteErrorMessage(
|
|
11395
|
+
msg: (err_32 === null || err_32 === void 0 ? void 0 : err_32.response)
|
|
11396
|
+
? handleGetWriteErrorMessage(err_32.response)
|
|
11013
11397
|
: "The changes could not be saved",
|
|
11014
11398
|
});
|
|
11015
11399
|
return [3 /*break*/, 8];
|
|
@@ -11146,7 +11530,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
11146
11530
|
((_b = groupPageState[eachGroup.id]) === null || _b === void 0 ? void 0 : _b.size) === 0);
|
|
11147
11531
|
})
|
|
11148
11532
|
: sections;
|
|
11149
|
-
|
|
11533
|
+
// INFO: coloured in the column's order first, so a group keeps its colour
|
|
11534
|
+
// when the order changes
|
|
11535
|
+
return (0, groupSections_1.handleOrderGroupSections)(handleApplyGroupDefaults(shownSections), groupOrder);
|
|
11150
11536
|
};
|
|
11151
11537
|
// INFO: every section is coloured — by its option's
|
|
11152
11538
|
// position, so a group keeps its colour as others empty — person groups
|
|
@@ -11413,7 +11799,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
11413
11799
|
// tableData / spaceTableData, so handleBuildNewTableGroups() keeps building
|
|
11414
11800
|
// bands from one source; each group advances its own cursor
|
|
11415
11801
|
var handleFetchGroupNextPage = function (groupKey) { return __awaiter(void 0, void 0, void 0, function () {
|
|
11416
|
-
var current, groupSize, cursor, generation, page_1, existingIds_1, appendRaw_1, appendPretty_1, nextCursor,
|
|
11802
|
+
var current, groupSize, cursor, generation, page_1, existingIds_1, appendRaw_1, appendPretty_1, nextCursor, err_33, nextKey;
|
|
11417
11803
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
11418
11804
|
return __generator(this, function (_h) {
|
|
11419
11805
|
switch (_h.label) {
|
|
@@ -11477,7 +11863,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
11477
11863
|
});
|
|
11478
11864
|
return [3 /*break*/, 5];
|
|
11479
11865
|
case 3:
|
|
11480
|
-
|
|
11866
|
+
err_33 = _h.sent();
|
|
11481
11867
|
if (generation !== groupPagingGenRef.current)
|
|
11482
11868
|
return [2 /*return*/];
|
|
11483
11869
|
// INFO: clear the in-flight flag so a failed page can be retried on the
|
|
@@ -11502,7 +11888,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
11502
11888
|
// INFO: page mode — swaps ONE group's rows for its page `page`; every other
|
|
11503
11889
|
// group keeps the page it is on
|
|
11504
11890
|
var handleFetchGroupPage = function (groupKey, page) { return __awaiter(void 0, void 0, void 0, function () {
|
|
11505
|
-
var generation, result, keptRaw_1, keptPretty_1, loaded,
|
|
11891
|
+
var generation, result, keptRaw_1, keptPretty_1, loaded, err_34;
|
|
11506
11892
|
return __generator(this, function (_a) {
|
|
11507
11893
|
switch (_a.label) {
|
|
11508
11894
|
case 0:
|
|
@@ -11538,7 +11924,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
11538
11924
|
});
|
|
11539
11925
|
return [3 /*break*/, 4];
|
|
11540
11926
|
case 3:
|
|
11541
|
-
|
|
11927
|
+
err_34 = _a.sent();
|
|
11542
11928
|
if (generation !== groupPagingGenRef.current)
|
|
11543
11929
|
return [2 /*return*/];
|
|
11544
11930
|
handleSetGroupPageState(groupKey, { loadingMore: false });
|
|
@@ -13207,22 +13593,37 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13207
13593
|
return null;
|
|
13208
13594
|
};
|
|
13209
13595
|
var renderModalContent = function () {
|
|
13210
|
-
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;
|
|
13596
|
+
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;
|
|
13597
|
+
if (loading && deleteProgress) {
|
|
13598
|
+
var percent = deleteProgress.total
|
|
13599
|
+
? Math.min(100, Math.round((deleteProgress.done / deleteProgress.total) * 100))
|
|
13600
|
+
: 0;
|
|
13601
|
+
return (react_1.default.createElement("div", { className: "mt-5 text-center", "data-testid": "dtw-delete-progress" },
|
|
13602
|
+
react_1.default.createElement("h3", { className: "text-lg font-medium leading-6 ".concat(((_a = props.organise) === null || _a === void 0 ? void 0 : _a.darkMode) ? "text-white" : "text-gray-900") }, "Deleting"),
|
|
13603
|
+
react_1.default.createElement("p", { className: "mt-2 text-sm ".concat(((_b = props.organise) === null || _b === void 0 ? void 0 : _b.darkMode) ? "text-gray-300" : "text-gray-500") },
|
|
13604
|
+
deleteProgress.done.toLocaleString(),
|
|
13605
|
+
" of",
|
|
13606
|
+
" ",
|
|
13607
|
+
deleteProgress.total.toLocaleString(),
|
|
13608
|
+
" records checked"),
|
|
13609
|
+
react_1.default.createElement("div", { className: "mt-3 h-2 w-full overflow-hidden rounded-full ".concat(((_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkMode) ? "bg-gray-700" : "bg-gray-200") },
|
|
13610
|
+
react_1.default.createElement("div", { className: "h-2 rounded-full bg-primary-500 transition-all", style: { width: "".concat(percent, "%") } }))));
|
|
13611
|
+
}
|
|
13211
13612
|
if (loading) {
|
|
13212
13613
|
return (react_1.default.createElement("div", { className: "mt-5" },
|
|
13213
13614
|
react_1.default.createElement(loading_1.Loading, null),
|
|
13214
13615
|
react_1.default.createElement("div", { className: "mt-3 text-center sm:mt-5" },
|
|
13215
|
-
react_1.default.createElement("h3", { className: "text-lg font-medium leading-6 ".concat(((
|
|
13616
|
+
react_1.default.createElement("h3", { className: "text-lg font-medium leading-6 ".concat(((_d = props.organise) === null || _d === void 0 ? void 0 : _d.darkMode) ? "text-white" : "text-gray-900"), id: "modal-title" }, "Loading"),
|
|
13216
13617
|
react_1.default.createElement("div", { className: "mt-2" },
|
|
13217
|
-
react_1.default.createElement("p", { className: "text-sm ".concat(((
|
|
13618
|
+
react_1.default.createElement("p", { className: "text-sm ".concat(((_e = props.organise) === null || _e === void 0 ? void 0 : _e.darkMode) ? "text-gray-300" : "text-gray-500") }, "Please wait while we are proccessing your request")))));
|
|
13218
13619
|
}
|
|
13219
13620
|
if (exportPDFLoading) {
|
|
13220
13621
|
return (react_1.default.createElement("div", { className: "mt-5" },
|
|
13221
13622
|
react_1.default.createElement(loading_1.Loading, null),
|
|
13222
13623
|
react_1.default.createElement("div", { className: "mt-3 text-center sm:mt-5" },
|
|
13223
|
-
react_1.default.createElement("h3", { className: "text-lg font-medium leading-6 ".concat(((
|
|
13624
|
+
react_1.default.createElement("h3", { className: "text-lg font-medium leading-6 ".concat(((_f = props.organise) === null || _f === void 0 ? void 0 : _f.darkMode) ? "text-white" : "text-gray-900"), id: "modal-title" }, "Loading"),
|
|
13224
13625
|
react_1.default.createElement("div", { className: "mt-2" },
|
|
13225
|
-
react_1.default.createElement("p", { className: "text-sm ".concat(((
|
|
13626
|
+
react_1.default.createElement("p", { className: "text-sm ".concat(((_g = props.organise) === null || _g === void 0 ? void 0 : _g.darkMode) ? "text-gray-300" : "text-gray-500") }, "Please wait while PDF is being generated")))));
|
|
13226
13627
|
}
|
|
13227
13628
|
else if (excelModal) {
|
|
13228
13629
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -13248,21 +13649,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13248
13649
|
react_1.default.createElement(button_1.Button, { text: "".concat(stepCSVIndex < 2 ? "Next" : "Submit"), type: "normal", onClick: handleStepCSV }))))));
|
|
13249
13650
|
}
|
|
13250
13651
|
else if (exportExcel || exportQR) {
|
|
13251
|
-
var showEmail = exportType !== "pdf" && !((
|
|
13652
|
+
var showEmail = exportType !== "pdf" && !((_j = (_h = props.organise) === null || _h === void 0 ? void 0 : _h.exportSettings) === null || _j === void 0 ? void 0 : _j.disableEmail);
|
|
13252
13653
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
13253
13654
|
react_1.default.createElement("div", null,
|
|
13254
|
-
showEmail ? (react_1.default.createElement(textInput_1.TextInput, { ref: exportCSVEmailInputRef, value: exportCSVEmail, type: "email", label: "Email", size: "xs", placeholder: (
|
|
13655
|
+
showEmail ? (react_1.default.createElement(textInput_1.TextInput, { ref: exportCSVEmailInputRef, value: exportCSVEmail, type: "email", label: "Email", size: "xs", placeholder: (_l = (_k = props.devSettings.currentUser) === null || _k === void 0 ? void 0 : _k.userEmail) !== null && _l !== void 0 ? _l : "Enter your email", onChange: function (e) { return setExportCSVEmail(e.target.value); } })) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
13255
13656
|
react_1.default.createElement("p", null, "Click the button below to download."),
|
|
13256
|
-
(exportType === "pdf" || exportType === "print") && (react_1.default.createElement(textInput_1.TextInput, { containerClassName: "mt-5", value: exportPDFTitle, type: "text", label: "Title (Optional)", placeholder: (
|
|
13257
|
-
(exportType === "pdf" || exportType === "print") && (react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Sum Attribute", containerClassName: "mt-5", value: exportSumAttributeIds, options: (
|
|
13657
|
+
(exportType === "pdf" || exportType === "print") && (react_1.default.createElement(textInput_1.TextInput, { containerClassName: "mt-5", value: exportPDFTitle, type: "text", label: "Title (Optional)", placeholder: (_p = (_o = (_m = props.organise) === null || _m === void 0 ? void 0 : _m.exportSettings) === null || _o === void 0 ? void 0 : _o.defaultExportPDFName) !== null && _p !== void 0 ? _p : "Enter your report title", onChange: function (e) { return setExportPDFTitle(e.target.value); } })),
|
|
13658
|
+
(exportType === "pdf" || exportType === "print") && (react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Sum Attribute", containerClassName: "mt-5", value: exportSumAttributeIds, options: (_s = (_r = (_q = props.organise) === null || _q === void 0 ? void 0 : _q.renderReferenceLabelOptions) === null || _r === void 0 ? void 0 : _r.call(_q, "", false, "number")) !== null && _s !== void 0 ? _s : [], staticDropdown: true, onChange: function (value) {
|
|
13258
13659
|
setExportSumAttributeIds(value);
|
|
13259
13660
|
} })))),
|
|
13260
|
-
react_1.default.createElement("div", { className: "mt-3 -mx-4 [&>div]:w-full [&>div]:max-w-none" }, (0, flexFilter_1.renderFlexFilterPopupContent)(exportFlexFilters, exportFilterStructure, devSettings, dbModule, flexFilterReferenceOptions, flexFilterReferenceSearch, exportFlexActions, (
|
|
13261
|
-
darkMode: (
|
|
13262
|
-
darkModeBg: (
|
|
13661
|
+
react_1.default.createElement("div", { className: "mt-3 -mx-4 [&>div]:w-full [&>div]:max-w-none" }, (0, flexFilter_1.renderFlexFilterPopupContent)(exportFlexFilters, exportFilterStructure, devSettings, dbModule, flexFilterReferenceOptions, flexFilterReferenceSearch, exportFlexActions, (_t = props.bareSettings) === null || _t === void 0 ? void 0 : _t.bareListFilterQuery, undefined, undefined, true, {
|
|
13662
|
+
darkMode: (_u = props.organise) === null || _u === void 0 ? void 0 : _u.darkMode,
|
|
13663
|
+
darkModeBg: (_v = props.organise) === null || _v === void 0 ? void 0 : _v.darkModeBg,
|
|
13263
13664
|
})),
|
|
13264
13665
|
react_1.default.createElement("div", { className: "mt-3 flex items-center justify-between" },
|
|
13265
|
-
react_1.default.createElement("label", { className: "text-sm font-medium ".concat(((
|
|
13666
|
+
react_1.default.createElement("label", { className: "text-sm font-medium ".concat(((_w = props.organise) === null || _w === void 0 ? void 0 : _w.darkMode) ? "text-gray-200" : "text-gray-700") }, "Hide Sub Items"),
|
|
13266
13667
|
react_1.default.createElement(toggle_1.Toggle, { text: "", direction: "right", value: hideSubItems, onClick: function () { return setHideSubItems(!hideSubItems); } })),
|
|
13267
13668
|
react_1.default.createElement("div", { className: "flex justify-end mt-5 " },
|
|
13268
13669
|
showEmail && (react_1.default.createElement(button_1.Button, { text: "Send to email", size: "small", type: "normal", onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -13282,7 +13683,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13282
13683
|
} })))));
|
|
13283
13684
|
}
|
|
13284
13685
|
else if (addTabModal) {
|
|
13285
|
-
return (react_1.default.createElement(settingsModal_1.TabModal, { type: resolvedType, tabs: (
|
|
13686
|
+
return (react_1.default.createElement(settingsModal_1.TabModal, { type: resolvedType, tabs: (_x = props.organise) === null || _x === void 0 ? void 0 : _x.extendedTabs, editIndex: editTabIndex >= 0 ? editTabIndex : undefined, hiddenViewTypes: (_y = props.organise) === null || _y === void 0 ? void 0 : _y.hiddenTabViewTypes, onChangeTabs: ((_z = props.organise) === null || _z === void 0 ? void 0 : _z.onChangeTabs) ? handleAddedTabs : undefined, model: structure, collectionId: props.collectionId, renderReferenceLabelOptions: (_0 = props.organise) === null || _0 === void 0 ? void 0 : _0.renderReferenceLabelOptions, onClose: function () {
|
|
13286
13687
|
handlePopUpModal(false);
|
|
13287
13688
|
} }));
|
|
13288
13689
|
}
|
|
@@ -13344,7 +13745,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13344
13745
|
return eachModel.id === selectedObjectStructureId;
|
|
13345
13746
|
});
|
|
13346
13747
|
if (filterObjectModel === null || filterObjectModel === void 0 ? void 0 : filterObjectModel.objectData) {
|
|
13347
|
-
var modalModel_1 = (
|
|
13748
|
+
var modalModel_1 = (_1 = filterObjectModel === null || filterObjectModel === void 0 ? void 0 : filterObjectModel.objectData) !== null && _1 !== void 0 ? _1 : [];
|
|
13348
13749
|
var handleOnFailValidation = function (refList) {
|
|
13349
13750
|
var _a, _b;
|
|
13350
13751
|
if ((refList === null || refList === void 0 ? void 0 : refList.length) > 0) {
|
|
@@ -13418,18 +13819,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13418
13819
|
disabledOnEnter_2 = true;
|
|
13419
13820
|
return null;
|
|
13420
13821
|
});
|
|
13421
|
-
if ((
|
|
13822
|
+
if ((_2 = props.bareSettings) === null || _2 === void 0 ? void 0 : _2.bareListObjectHandleData) {
|
|
13422
13823
|
var listObjectViewType = resolvedType === "read"
|
|
13423
13824
|
? "read"
|
|
13424
13825
|
: selectedObjectId
|
|
13425
13826
|
? "update"
|
|
13426
13827
|
: "new";
|
|
13427
|
-
(
|
|
13428
|
-
? (
|
|
13828
|
+
(_4 = (_3 = props.bareSettings) === null || _3 === void 0 ? void 0 : _3.bareListObjectHandleData) === null || _4 === void 0 ? void 0 : _4.call(_3, listObjectViewType, selectedObjectData, selectedObjectId
|
|
13829
|
+
? (_7 = (_6 = (_5 = handleResolveRawData()) === null || _5 === void 0 ? void 0 : _5[selectedObjectStructureId]) === null || _6 === void 0 ? void 0 : _6.find) === null || _7 === void 0 ? void 0 : _7.call(_6, function (eachRow) { return (eachRow === null || eachRow === void 0 ? void 0 : eachRow.id) === selectedObjectId; })
|
|
13429
13830
|
: undefined);
|
|
13430
13831
|
}
|
|
13431
13832
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
13432
|
-
react_1.default.createElement(form_1.Form, { className: "grid ".concat(formColumn, " ").concat(gridGap, " pb-32 mt-6 sm:pb-36"), ref: objectFormRef, refList: objectFormInputRefs, handleComplete: handleSubmitObjectDataType, disabledOnEnter: disabledOnEnter_2, handleOnFailValidation: handleOnFailValidation }, renderDataTemplateFormContent(selectedObjectData, (
|
|
13833
|
+
react_1.default.createElement(form_1.Form, { className: "grid ".concat(formColumn, " ").concat(gridGap, " pb-32 mt-6 sm:pb-36"), ref: objectFormRef, refList: objectFormInputRefs, handleComplete: handleSubmitObjectDataType, disabledOnEnter: disabledOnEnter_2, handleOnFailValidation: handleOnFailValidation }, renderDataTemplateFormContent(selectedObjectData, (_8 = filterObjectModel === null || filterObjectModel === void 0 ? void 0 : filterObjectModel.objectData) !== null && _8 !== void 0 ? _8 : [], objectFormInputRefs, true, filterObjectModel.type === "listObject", undefined, filterObjectModel.type === "listObject"
|
|
13433
13834
|
? selectedData
|
|
13434
13835
|
: undefined)),
|
|
13435
13836
|
react_1.default.createElement("div", { className: "flex justify-end pt-8" },
|
|
@@ -13459,38 +13860,70 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13459
13860
|
}
|
|
13460
13861
|
};
|
|
13461
13862
|
var renderReferenceDeleteTable = function () {
|
|
13462
|
-
var _a;
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
});
|
|
13470
|
-
|
|
13863
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
13864
|
+
// INFO: a batch's rows stand for many records, not one to open
|
|
13865
|
+
var isSummary = referenceDeleteTableData.some(function (each) {
|
|
13866
|
+
return each.isSummary;
|
|
13867
|
+
});
|
|
13868
|
+
var canOpen = !!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onOpenReferencingRecords) && !isSummary;
|
|
13869
|
+
var isMultiple = isSummary ||
|
|
13870
|
+
new Set(referenceDeleteTableData.map(function (each) { return each.recordId; })).size > 1;
|
|
13871
|
+
var handleGetRowKey = function (each) {
|
|
13872
|
+
return "".concat(each.recordId, "|").concat(each.collectionId, "|").concat(each.columnId);
|
|
13873
|
+
};
|
|
13874
|
+
// INFO: the first rows only — a select-all of many linked records would
|
|
13875
|
+
// otherwise list thousands
|
|
13876
|
+
var shownLinks = referenceDeleteTableData.slice(0, DELETE_BLOCKED_ROWS);
|
|
13877
|
+
var hiddenLinks = referenceDeleteTableData.length - shownLinks.length;
|
|
13878
|
+
var rows = shownLinks.map(function (each) { return ({
|
|
13879
|
+
id: handleGetRowKey(each),
|
|
13880
|
+
record: each.recordLabel,
|
|
13881
|
+
usedIn: each.collectionName,
|
|
13882
|
+
count: "".concat(each.count.toLocaleString(), " ").concat(each.count === 1 ? "record" : "records").concat(canOpen ? " ↗" : ""),
|
|
13883
|
+
}); });
|
|
13471
13884
|
return (react_1.default.createElement("div", { className: "px-3 sm:px-0" },
|
|
13472
|
-
react_1.default.createElement("
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13885
|
+
react_1.default.createElement("h2", { className: "mt-2 mb-2 text-xl font-bold ".concat(((_b = props.organise) === null || _b === void 0 ? void 0 : _b.darkMode) ? "text-white" : "text-gray-900") }, "Can't delete yet"),
|
|
13886
|
+
react_1.default.createElement("p", { className: "mt-2 mb-4 text-sm ".concat(((_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkMode) ? "text-gray-300" : "text-gray-600") },
|
|
13887
|
+
isMultiple ? "These records are" : "This record is",
|
|
13888
|
+
" still used in the datasheets below.",
|
|
13889
|
+
" ",
|
|
13890
|
+
canOpen
|
|
13891
|
+
? "Open each to change or delete those records, then try again."
|
|
13892
|
+
: "Change or delete those records first, then try again."),
|
|
13893
|
+
react_1.default.createElement(newTable_1.NewTable, { loading: false, className: "w-full", darkMode: (_d = props.organise) === null || _d === void 0 ? void 0 : _d.darkMode, header: __spreadArray(__spreadArray([], (isMultiple ? [{ key: "record", title: "Record" }] : []), true), [
|
|
13894
|
+
{ key: "usedIn", title: "Used in" },
|
|
13895
|
+
{ key: "count", title: "Linked" },
|
|
13896
|
+
], false), data: rows, onClickRow: canOpen
|
|
13897
|
+
? function (rowId) {
|
|
13898
|
+
var _a, _b;
|
|
13899
|
+
var link = referenceDeleteTableData.find(function (each) { return handleGetRowKey(each) === rowId; });
|
|
13900
|
+
if (!link)
|
|
13901
|
+
return;
|
|
13902
|
+
// INFO: closed first, so it is not left over the datasheet
|
|
13903
|
+
// the app opens
|
|
13904
|
+
setReferenceDeleteTableData([]);
|
|
13905
|
+
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onOpenReferencingRecords) === null || _b === void 0 ? void 0 : _b.call(_a, link);
|
|
13906
|
+
}
|
|
13907
|
+
: undefined }),
|
|
13908
|
+
hiddenLinks > 0 && (react_1.default.createElement("p", { className: "mt-2 text-xs ".concat(((_e = props.organise) === null || _e === void 0 ? void 0 : _e.darkMode) ? "text-gray-400" : "text-gray-500") },
|
|
13909
|
+
"And ",
|
|
13910
|
+
hiddenLinks.toLocaleString(),
|
|
13911
|
+
" more.")),
|
|
13912
|
+
isDeleteAnywayConfirm && (react_1.default.createElement("p", { "data-testid": "dtw-delete-anyway-warning", className: "mt-4 text-sm ".concat(((_f = props.organise) === null || _f === void 0 ? void 0 : _f.darkMode) ? "text-red-300" : "text-red-600") },
|
|
13913
|
+
blockedDeleteIdsRef.current.length.toLocaleString(),
|
|
13914
|
+
" ",
|
|
13915
|
+
blockedDeleteIdsRef.current.length === 1 ? "record" : "records",
|
|
13916
|
+
" ",
|
|
13917
|
+
"will be deleted. The records linking to them keep the link, which will show as missing.")),
|
|
13490
13918
|
react_1.default.createElement("div", { className: "flex flex-row justify-end pt-5 mt-6 space-x-2" },
|
|
13491
|
-
react_1.default.createElement(button_1.Button, { text: "
|
|
13492
|
-
|
|
13493
|
-
|
|
13919
|
+
((_g = props.organise) === null || _g === void 0 ? void 0 : _g.canDeleteAnyway) && isBlockedFromListRef.current && (react_1.default.createElement(button_1.Button, { text: isDeleteAnywayConfirm ? "Yes, delete anyway" : "Delete anyway", size: "small", type: isDeleteAnywayConfirm ? "danger" : "light", className: isDeleteAnywayConfirm ? undefined : "!text-red-600", onClick: function () {
|
|
13920
|
+
return isDeleteAnywayConfirm
|
|
13921
|
+
? handleDeleteAnyway()
|
|
13922
|
+
: setIsDeleteAnywayConfirm(true);
|
|
13923
|
+
} })),
|
|
13924
|
+
react_1.default.createElement(button_1.Button, { text: "Close", size: "small", type: "light", onClick: function () {
|
|
13925
|
+
setIsDeleteAnywayConfirm(false);
|
|
13926
|
+
setReferenceDeleteTableData([]);
|
|
13494
13927
|
} }))));
|
|
13495
13928
|
};
|
|
13496
13929
|
var renderDeleteModalContent = function () {
|
|
@@ -13636,14 +14069,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13636
14069
|
};
|
|
13637
14070
|
return (react_1.default.createElement(context_1.ColumnTypeContext.Provider, { value: columnTypeActions },
|
|
13638
14071
|
renderNotification("root"),
|
|
13639
|
-
((
|
|
14072
|
+
((_117 = (_116 = props.renderSettings) === null || _116 === void 0 ? void 0 : _116.renderLoadingUI) === null || _117 === void 0 ? void 0 : _117.call(_116)) && loading ? ((_118 = props.renderSettings) === null || _118 === void 0 ? void 0 : _118.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_119 = props.organise) === null || _119 === void 0 ? void 0 : _119.darkMode, darkModeBg: (_120 = props.organise) === null || _120 === void 0 ? void 0 : _120.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
|
|
13640
14073
|
var _a, _b;
|
|
13641
14074
|
if (loading)
|
|
13642
14075
|
return;
|
|
13643
14076
|
handlePopUpModal(false);
|
|
13644
14077
|
setExportCSVEmail((_b = (_a = props.devSettings.currentUser) === null || _a === void 0 ? void 0 : _a.userEmail) !== null && _b !== void 0 ? _b : "");
|
|
13645
14078
|
}, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) })),
|
|
13646
|
-
react_1.default.createElement(modal_1.Modal, { darkMode: (
|
|
14079
|
+
react_1.default.createElement(modal_1.Modal, { darkMode: (_121 = props.organise) === null || _121 === void 0 ? void 0 : _121.darkMode, darkModeBg: (_122 = props.organise) === null || _122 === void 0 ? void 0 : _122.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
|
|
13647
14080
|
return (react_1.default.createElement(referenceModal_1.ReferenceModal, { referenceModelSchema: referenceModelSchema, referenceDataStructure: referenceCreationModal, devSettings: props.devSettings, handleCreateRefId: function (dataId) {
|
|
13648
14081
|
if (dataId) {
|
|
13649
14082
|
var currentValue = selectedData[referenceCreationModal.id];
|
|
@@ -13659,19 +14092,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13659
14092
|
}, onClose: function () {
|
|
13660
14093
|
setReferenceCreationModal({ id: "", name: "", type: "string" });
|
|
13661
14094
|
} }),
|
|
13662
|
-
react_1.default.createElement(modal_1.Modal, { darkMode: (
|
|
13663
|
-
setReferenceDeleteTableData(
|
|
14095
|
+
react_1.default.createElement(modal_1.Modal, { darkMode: (_123 = props.organise) === null || _123 === void 0 ? void 0 : _123.darkMode, darkModeBg: (_124 = props.organise) === null || _124 === void 0 ? void 0 : _124.darkModeBg, maxWidth: "2xl", open: referenceDeleteTableData.length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
|
|
14096
|
+
setReferenceDeleteTableData([]);
|
|
13664
14097
|
}, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
|
|
13665
|
-
react_1.default.createElement(modal_1.Modal, { darkMode: (
|
|
14098
|
+
react_1.default.createElement(modal_1.Modal, { darkMode: (_125 = props.organise) === null || _125 === void 0 ? void 0 : _125.darkMode, darkModeBg: (_126 = props.organise) === null || _126 === void 0 ? void 0 : _126.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
|
|
13666
14099
|
setDeletePasscodeInput("");
|
|
13667
14100
|
setDeleteModal(!deleteModal);
|
|
13668
14101
|
setDeleteFeedId("");
|
|
13669
14102
|
}, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
|
|
13670
|
-
react_1.default.createElement(modal_1.Modal, { darkMode: (
|
|
14103
|
+
react_1.default.createElement(modal_1.Modal, { darkMode: (_127 = props.organise) === null || _127 === void 0 ? void 0 : _127.darkMode, darkModeBg: (_128 = props.organise) === null || _128 === void 0 ? void 0 : _128.darkModeBg, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
|
|
13671
14104
|
setBatchUpdateData({ columnId: "", columnData: {} });
|
|
13672
14105
|
setBatchUpdateModal(false);
|
|
13673
14106
|
}, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
|
|
13674
|
-
react_1.default.createElement(modal_1.Modal, { darkMode: (
|
|
14107
|
+
react_1.default.createElement(modal_1.Modal, { darkMode: (_129 = props.organise) === null || _129 === void 0 ? void 0 : _129.darkMode, darkModeBg: (_130 = props.organise) === null || _130 === void 0 ? void 0 : _130.darkModeBg, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
|
|
13675
14108
|
var _a, _b;
|
|
13676
14109
|
if (props.space)
|
|
13677
14110
|
return (react_1.default.createElement(authModal_1.AuthModal, { space: props.space, userId: (_a = props.id) !== null && _a !== void 0 ? _a : "", client: (_b = props.lib) === null || _b === void 0 ? void 0 : _b.axios, type: selectedAuthMethod, authMethods: authMethods, onComplete: handleAuthComplete }));
|
|
@@ -13688,14 +14121,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
|
|
|
13688
14121
|
(0, react_dom_1.createPortal)(
|
|
13689
14122
|
// INFO: z-50 lifts it over a Modal the table may sit in (z-40)
|
|
13690
14123
|
react_1.default.createElement("div", { className: "relative z-50" },
|
|
13691
|
-
react_1.default.createElement(drawer_1.Drawer, { darkMode: (
|
|
14124
|
+
react_1.default.createElement(drawer_1.Drawer, { darkMode: (_131 = props.organise) === null || _131 === void 0 ? void 0 : _131.darkMode, darkModeBg: (_132 = props.organise) === null || _132 === void 0 ? void 0 : _132.darkModeBg, testId: "dt-activity-drawer", open: activityModal,
|
|
13692
14125
|
// INFO: the record stays set while the drawer slides out — clearing it
|
|
13693
14126
|
// would remount the hidden panel collection-wide and fetch again. The
|
|
13694
14127
|
// toolbar's collection-wide button clears it when it opens.
|
|
13695
14128
|
onClose: function () { return setActivityModal(false); }, anchor: "responsive", maxWidth: "2xl", maxHeight: "75",
|
|
13696
14129
|
// INFO: dragged like the read drawer; the width sticks across
|
|
13697
14130
|
// opens while the list stays mounted
|
|
13698
|
-
resizable: true, title: "Activity Log", content: renderActivityPanel(resolvedType === "read" ? ((
|
|
14131
|
+
resizable: true, title: "Activity Log", content: renderActivityPanel(resolvedType === "read" ? ((_133 = props.id) !== null && _133 !== void 0 ? _133 : "") : activityId) })), document.body),
|
|
13699
14132
|
renderScrollSentinel()));
|
|
13700
14133
|
});
|
|
13701
14134
|
//# sourceMappingURL=index.js.map
|