blixify-ui-web 1.2.132 → 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,mFAq6avB,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;
@@ -9510,15 +9544,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9510
9544
  if (view === newCalendarViewMode)
9511
9545
  return;
9512
9546
  setNewCalendarViewMode(view);
9547
+ handleEmitCalendarRange(calendarTabMonth, view);
9513
9548
  // INFO: month and agenda share the month range —
9514
- // only week changes the query cond. Only set loading
9515
- // when a refetch will actually fire, otherwise
9516
- // nothing clears it and the spinner hangs forever.
9517
- var nextCalendarView = view === "week"
9518
- ? "timeGridWeek"
9519
- : view === "day"
9520
- ? "timeGridDay"
9521
- : "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];
9522
9554
  if (nextCalendarView !== calendarView) {
9523
9555
  setCalendarView(nextCalendarView);
9524
9556
  setTableLoading(true);
@@ -9531,6 +9563,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9531
9563
  var endOfMonth = (0, dayjs_1.default)(calendarTabMonth).endOf("month");
9532
9564
  if (!(0, dayjs_1.default)(date).isBetween(startOfMonth, endOfMonth)) {
9533
9565
  setTableLoading(true);
9566
+ handleEmitCalendarRange(date, newCalendarViewMode);
9534
9567
  }
9535
9568
  setCalendarTabMonth(date);
9536
9569
  },
@@ -9539,18 +9572,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9539
9572
  onChangeMonth: function (monthStart) {
9540
9573
  setTableLoading(true);
9541
9574
  setCalendarTabMonth(monthStart);
9575
+ handleEmitCalendarRange(monthStart, newCalendarViewMode);
9542
9576
  },
9543
9577
  // INFO: Week paging in weekTimeGrid — anchor the isoWeek
9544
9578
  // range query on the new week's Monday
9545
9579
  onChangeWeek: function (weekStart) {
9546
9580
  setTableLoading(true);
9547
9581
  setCalendarTabMonth(weekStart);
9582
+ handleEmitCalendarRange(weekStart, "week");
9548
9583
  },
9549
9584
  // INFO: Day paging in dayTimeline — the timeGridDay range
9550
9585
  // query follows calendarTabMonth
9551
9586
  onChangeDay: function (day) {
9552
9587
  setTableLoading(true);
9553
9588
  setCalendarTabMonth(day);
9589
+ handleEmitCalendarRange(day, "day");
9554
9590
  }, onClickEvent: function (event) {
9555
9591
  var _a, _b, _c, _d;
9556
9592
  if ((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareCalendarOnClickEvent) {