blixify-ui-web 1.2.131 → 1.2.133

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA2Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AA2E1B,eAAO,MAAM,YAAY,mFAk4avB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA2Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAoG1B,eAAO,MAAM,YAAY,mFAy7avB,CAAC"}
@@ -190,6 +190,21 @@ var handleIsEmptyElement = function (element) {
190
190
  };
191
191
  // INFO: rows-per-page choices offered in the view settings panel
192
192
  var PAGE_LIMIT_OPTIONS = [10, 25, 50, 100];
193
+ var CALENDAR_VIEW_BY_SWITCH = {
194
+ month: "dayGridMonth",
195
+ week: "timeGridWeek",
196
+ day: "timeGridDay",
197
+ agenda: "dayGridMonth",
198
+ };
199
+ // INFO: the range a bareNewDTW calendar view shows around a date — the same
200
+ // bounds the calendar's own range query uses
201
+ var handleGetCalendarSwitchRange = function (date, view) {
202
+ var unit = view === "day" ? "day" : view === "week" ? "isoWeek" : "month";
203
+ return {
204
+ start: (0, dayjs_1.default)(date).startOf(unit).toDate(),
205
+ end: (0, dayjs_1.default)(date).endOf(unit).toDate(),
206
+ };
207
+ };
193
208
  exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
194
209
  // INFO: props.type is what the caller asked for; resolvedType is what THIS
195
210
  // instance renders. They differ in exactly one case: readDrawer is on and the
@@ -350,6 +365,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
350
365
  // (calendarView above drives the matching range query)
351
366
  var _114 = (0, react_1.useState)("month"), newCalendarViewMode = _114[0], setNewCalendarViewMode = _114[1];
352
367
  var _115 = (0, react_1.useState)(new Date()), calendarTabMonth = _115[0], setCalendarTabMonth = _115[1];
368
+ // INFO: defaultViewSwitch picks the opening view only — the tab re-inits
369
+ // whenever its settings change, and that must not undo the user's switch
370
+ var calendarViewInitRef = (0, react_1.useRef)(false);
353
371
  var _116 = (0, react_1.useState)(true), kanbanDroppable = _116[0], setKanbanDroppable = _116[1];
354
372
  var _117 = (0, react_1.useState)([]), kanbanOptions = _117[0], setKanbanOptions = _117[1];
355
373
  var _118 = (0, react_1.useState)(false), queryForm = _118[0], setQueryForm = _118[1];
@@ -1570,10 +1588,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1570
1588
  (0, react_1.useEffect)(function () {
1571
1589
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1572
1590
  var handleInitTab = function () { return __awaiter(void 0, void 0, void 0, function () {
1573
- var currentTab, kanbanSettings, kanbanTitle_1, kanbanRefRQ_1, kanbanRefOption_1, kanbanRefLabel_1, kanbanRefQuery;
1574
- var _a, _b, _c, _d, _e, _f, _g;
1575
- return __generator(this, function (_h) {
1576
- switch (_h.label) {
1591
+ var currentTab, defaultViewSwitch, kanbanSettings, kanbanTitle_1, kanbanRefRQ_1, kanbanRefOption_1, kanbanRefLabel_1, kanbanRefQuery;
1592
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1593
+ return __generator(this, function (_j) {
1594
+ switch (_j.label) {
1577
1595
  case 0:
1578
1596
  currentTab = (0, listModule_1.renderSelectedRefreshTab)(props.localURLEndpoint, resolvedType, props.collectionId, props.id, (_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs, (_b = props.organise) === null || _b === void 0 ? void 0 : _b.viewId);
1579
1597
  if (!(resolvedType === "list")) return [3 /*break*/, 5];
@@ -1582,13 +1600,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1582
1600
  if ((_c = currentTab === null || currentTab === void 0 ? void 0 : currentTab.calendarSettings) === null || _c === void 0 ? void 0 : _c.defaultStartDate) {
1583
1601
  setCalendarTabMonth((0, dayjs_1.default)(currentTab.calendarSettings.defaultStartDate).toDate());
1584
1602
  }
1603
+ defaultViewSwitch = (_d = currentTab === null || currentTab === void 0 ? void 0 : currentTab.calendarSettings) === null || _d === void 0 ? void 0 : _d.defaultViewSwitch;
1604
+ if (defaultViewSwitch && !calendarViewInitRef.current) {
1605
+ setNewCalendarViewMode(defaultViewSwitch);
1606
+ setCalendarView(CALENDAR_VIEW_BY_SWITCH[defaultViewSwitch]);
1607
+ }
1608
+ calendarViewInitRef.current = true;
1585
1609
  setFilterSearch({});
1586
1610
  setFilterSearchParams({});
1587
1611
  return [3 /*break*/, 5];
1588
1612
  case 1:
1589
1613
  if (!((currentTab === null || currentTab === void 0 ? void 0 : currentTab.viewType) === "kanban")) return [3 /*break*/, 4];
1590
1614
  kanbanSettings = currentTab === null || currentTab === void 0 ? void 0 : currentTab.kanbanSettings;
1591
- kanbanTitle_1 = (_d = kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.title) !== null && _d !== void 0 ? _d : "";
1615
+ kanbanTitle_1 = (_e = kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.title) !== null && _e !== void 0 ? _e : "";
1592
1616
  kanbanRefRQ_1 = null;
1593
1617
  kanbanRefOption_1 = [];
1594
1618
  kanbanRefLabel_1 = "";
@@ -1613,10 +1637,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1613
1637
  return [4 /*yield*/, kanbanRefRQ_1.call({
1614
1638
  type: "list",
1615
1639
  limit: limit,
1616
- query: ((_e = currentTab === null || currentTab === void 0 ? void 0 : currentTab.kanbanSettings) === null || _e === void 0 ? void 0 : _e.query) || undefined,
1640
+ query: ((_f = currentTab === null || currentTab === void 0 ? void 0 : currentTab.kanbanSettings) === null || _f === void 0 ? void 0 : _f.query) || undefined,
1617
1641
  })];
1618
1642
  case 2:
1619
- kanbanRefQuery = _h.sent();
1643
+ kanbanRefQuery = _j.sent();
1620
1644
  if (kanbanRefQuery.data) {
1621
1645
  kanbanRefQuery.data.map(function (eachData) {
1622
1646
  kanbanRefOption_1.push({
@@ -1626,7 +1650,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1626
1650
  return null;
1627
1651
  });
1628
1652
  }
1629
- _h.label = 3;
1653
+ _j.label = 3;
1630
1654
  case 3:
1631
1655
  setKanbanOptions(kanbanRefOption_1);
1632
1656
  return [3 /*break*/, 5];
@@ -1639,14 +1663,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1639
1663
  setFilterSearch({});
1640
1664
  setFilterSearchParams({});
1641
1665
  if (currentTab.structure)
1642
- setStructure((_f = currentTab.structure) !== null && _f !== void 0 ? _f : []);
1666
+ setStructure((_g = currentTab.structure) !== null && _g !== void 0 ? _g : []);
1643
1667
  if (currentTab.additionalQuery)
1644
- setAdditionalQuery((_g = currentTab.additionalQuery) !== null && _g !== void 0 ? _g : []);
1668
+ setAdditionalQuery((_h = currentTab.additionalQuery) !== null && _h !== void 0 ? _h : []);
1645
1669
  if (currentTab.groupBy)
1646
1670
  setGroupId(currentTab.groupBy);
1647
1671
  setExportPDFTitle(currentTab === null || currentTab === void 0 ? void 0 : currentTab.name);
1648
1672
  }
1649
- _h.label = 5;
1673
+ _j.label = 5;
1650
1674
  case 5: return [2 /*return*/];
1651
1675
  }
1652
1676
  });
@@ -2306,6 +2330,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2306
2330
  // props.collectionId, and any state values without requiring the SSE
2307
2331
  // useEffect to re-run (which would tear down and rebuild the EventSource).
2308
2332
  handleApplyEnvelopeRef.current = handleApplyEnvelope;
2333
+ // INFO: tells the app which range the calendar now shows — fired only on a
2334
+ // user's paging or view switch, never on render, so an app that feeds the
2335
+ // range back through defaultStartDate cannot loop
2336
+ var handleEmitCalendarRange = function (date, view) {
2337
+ var _a;
2338
+ if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareCalendarOnChangeRange))
2339
+ return;
2340
+ var _b = handleGetCalendarSwitchRange(date, view), start = _b.start, end = _b.end;
2341
+ props.bareSettings.bareCalendarOnChangeRange(start, end, view);
2342
+ };
2309
2343
  var handleReadQueryHocSort = function (query) {
2310
2344
  // INFO: Use persisted sort when persistViewState is active, otherwise fall back to prop sort
2311
2345
  var sort = activeSortId || undefined;
@@ -7941,8 +7975,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7941
7975
  }
7942
7976
  // INFO: View settings — columns (hide, reorder, search), sort and rows
7943
7977
  // per page in one panel. Standard on the new DTW; videColumnEnabled
7944
- // keeps it available to legacy and bare DTWs.
7945
- if (isViewSettingsEnabled) {
7978
+ // keeps it available to legacy and bare DTWs. A calendar has no
7979
+ // columns, sort or pages, so it gets no panel.
7980
+ if (isViewSettingsEnabled && (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.viewType) !== "calendar") {
7946
7981
  var hiddenColumnCount_1 = getViewSettingsColumns().filter(getIsColumnHidden).length;
7947
7982
  // INFO: desktop and mobile both render, CSS decides which is shown —
7948
7983
  // distinct test ids keep the two unambiguous for e2e
@@ -9392,10 +9427,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9392
9427
  if (calendarSettings_1 === null || calendarSettings_1 === void 0 ? void 0 : calendarSettings_1.startDate) {
9393
9428
  for (var _i = 0, spaceTableData_1 = spaceTableData; _i < spaceTableData_1.length; _i++) {
9394
9429
  var eachData = spaceTableData_1[_i];
9430
+ // INFO: skip only the undated row — a union mixes collections, so
9431
+ // one row without a date must not hide every row after it
9395
9432
  if (!eachData[calendarSettings_1.startDate])
9396
- break;
9433
+ continue;
9397
9434
  else if (!(0, dayjs_1.default)(eachData[calendarSettings_1.startDate], "YYYY-MM-DD HH:mm A").isValid()) {
9398
- break;
9435
+ continue;
9399
9436
  }
9400
9437
  else {
9401
9438
  var id = eachData.id;
@@ -9450,7 +9487,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9450
9487
  }
9451
9488
  eventAvailability["bgColor"] = color;
9452
9489
  eventAvailability["hoverColor"] = hoverColor;
9453
- eventAvailabilities["textColor"] = "text-white";
9490
+ eventAvailability["textColor"] = "text-white";
9454
9491
  }
9455
9492
  eventAvailabilities.push(eventAvailability);
9456
9493
  }
@@ -9460,7 +9497,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9460
9497
  };
9461
9498
  // INFO: when bareNewDTW is enabled, render NewCalendar instead of legacy Calendar
9462
9499
  if ((_35 = props.bareSettings) === null || _35 === void 0 ? void 0 : _35.bareNewDTW) {
9463
- var newCalendarEvents = renderEventAvailabilities().map(function (ev) {
9500
+ var mappedCalendarEvents = renderEventAvailabilities().map(function (ev) {
9464
9501
  var _a, _b, _c, _d;
9465
9502
  return ({
9466
9503
  id: (_a = ev.id) !== null && _a !== void 0 ? _a : "",
@@ -9474,8 +9511,22 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9474
9511
  textColor: ev.textColor,
9475
9512
  status: ev.status,
9476
9513
  date: ev.date,
9514
+ // INFO: the unformatted row, so a tap handler can tell which
9515
+ // collection a union event came from
9516
+ meta: {
9517
+ rawData: tableData.find(function (eachRow) {
9518
+ return [eachRow === null || eachRow === void 0 ? void 0 : eachRow[serverId], eachRow === null || eachRow === void 0 ? void 0 : eachRow._id, eachRow === null || eachRow === void 0 ? void 0 : eachRow.id].some(function (eachId) {
9519
+ return eachId !== undefined && String(eachId) === String(ev.id);
9520
+ });
9521
+ }),
9522
+ },
9477
9523
  });
9478
9524
  });
9525
+ // INFO: lets the app reshape the fetched events — e.g. expand one
9526
+ // repeating row into an event per day, or colour by a derived status
9527
+ var newCalendarEvents = props.bareSettings.bareCalendarMapEvents
9528
+ ? props.bareSettings.bareCalendarMapEvents(mappedCalendarEvents)
9529
+ : mappedCalendarEvents;
9479
9530
  // INFO: viewSwitch — optional Month/Week/Agenda toggle. The range
9480
9531
  // query follows via calendarView ("dayGridMonth" ↔ "timeGridWeek");
9481
9532
  // agenda lists the fetched month chronologically.
@@ -9483,6 +9534,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9483
9534
  var VIEW_VARIANT_MAP = {
9484
9535
  month: "fullMonth",
9485
9536
  week: "weekTimeGrid",
9537
+ day: "dayTimeline",
9486
9538
  agenda: "agenda",
9487
9539
  };
9488
9540
  var activeVariant = (_37 = VIEW_VARIANT_MAP[newCalendarViewMode]) !== null && _37 !== void 0 ? _37 : "fullMonth";
@@ -9492,11 +9544,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9492
9544
  if (view === newCalendarViewMode)
9493
9545
  return;
9494
9546
  setNewCalendarViewMode(view);
9547
+ handleEmitCalendarRange(calendarTabMonth, view);
9495
9548
  // INFO: month and agenda share the month range —
9496
- // only week changes the query cond. Only set loading
9497
- // when a refetch will actually fire, otherwise
9498
- // nothing clears it and the spinner hangs forever.
9499
- var nextCalendarView = view === "week" ? "timeGridWeek" : "dayGridMonth";
9549
+ // only week and day change the query cond. Only set
9550
+ // loading when a refetch will actually fire,
9551
+ // otherwise nothing clears it and the spinner hangs
9552
+ // forever.
9553
+ var nextCalendarView = CALENDAR_VIEW_BY_SWITCH[view];
9500
9554
  if (nextCalendarView !== calendarView) {
9501
9555
  setCalendarView(nextCalendarView);
9502
9556
  setTableLoading(true);
@@ -9509,6 +9563,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9509
9563
  var endOfMonth = (0, dayjs_1.default)(calendarTabMonth).endOf("month");
9510
9564
  if (!(0, dayjs_1.default)(date).isBetween(startOfMonth, endOfMonth)) {
9511
9565
  setTableLoading(true);
9566
+ handleEmitCalendarRange(date, newCalendarViewMode);
9512
9567
  }
9513
9568
  setCalendarTabMonth(date);
9514
9569
  },
@@ -9517,16 +9572,29 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9517
9572
  onChangeMonth: function (monthStart) {
9518
9573
  setTableLoading(true);
9519
9574
  setCalendarTabMonth(monthStart);
9575
+ handleEmitCalendarRange(monthStart, newCalendarViewMode);
9520
9576
  },
9521
9577
  // INFO: Week paging in weekTimeGrid — anchor the isoWeek
9522
9578
  // range query on the new week's Monday
9523
9579
  onChangeWeek: function (weekStart) {
9524
9580
  setTableLoading(true);
9525
9581
  setCalendarTabMonth(weekStart);
9582
+ handleEmitCalendarRange(weekStart, "week");
9583
+ },
9584
+ // INFO: Day paging in dayTimeline — the timeGridDay range
9585
+ // query follows calendarTabMonth
9586
+ onChangeDay: function (day) {
9587
+ setTableLoading(true);
9588
+ setCalendarTabMonth(day);
9589
+ handleEmitCalendarRange(day, "day");
9526
9590
  }, onClickEvent: function (event) {
9527
- var _a, _b;
9591
+ var _a, _b, _c, _d;
9592
+ if ((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareCalendarOnClickEvent) {
9593
+ props.bareSettings.bareCalendarOnClickEvent(event, (_b = event.meta) === null || _b === void 0 ? void 0 : _b.rawData);
9594
+ return;
9595
+ }
9528
9596
  if (event.id)
9529
- (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", event.id, "general");
9597
+ (_d = (_c = props.organise) === null || _c === void 0 ? void 0 : _c.handleNavigate) === null || _d === void 0 ? void 0 : _d.call(_c, "read", event.id, "general");
9530
9598
  }, darkMode: (_38 = props.organise) === null || _38 === void 0 ? void 0 : _38.darkMode, className: "w-full" }))));
9531
9599
  }
9532
9600
  return (react_1.default.createElement("div", { className: "mt-4" }, tableLoading ? (react_1.default.createElement(loading_1.Loading, null)) : (react_1.default.createElement(calendar_1.Calendar, { currentDate: calendarTabMonth, calendarView: (_39 = calendarSettings_1 === null || calendarSettings_1 === void 0 ? void 0 : calendarSettings_1.defaultView) !== null && _39 !== void 0 ? _39 : calendarView, handleMonthChange: function (date) {