@pisell/private-materials 6.11.661 → 6.11.662

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.
Files changed (33) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +18 -18
  6. package/build/lowcode/view.js +18 -18
  7. package/es/components/booking/utils.js +1 -1
  8. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.js +5 -1
  9. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.js +9 -1
  10. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.js +3 -1
  11. package/es/components/eventBooking/components/bookingAvailabilityCalendar/index.d.ts +5 -0
  12. package/es/components/eventBooking/components/bookingAvailabilityCalendar/index.js +2 -1
  13. package/es/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +103 -43
  14. package/es/plus/salesSdk/normalProductDetail/availabilityContextRouting.js +29 -0
  15. package/es/pro/skuDetailModal/flow/modules/date/availabilityWindow.js +71 -0
  16. package/es/pro/skuDetailModal/flow/modules/date/index.js +24 -9
  17. package/es/pro/skuDetailModal/flow/modules/time/index.js +28 -13
  18. package/es/pro/skuDetailModal/flow/modules/time/posCustomTime.js +7 -1
  19. package/es/pro/skuDetailModal/flow/types.d.ts +8 -0
  20. package/lib/components/booking/utils.js +1 -1
  21. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.js +5 -1
  22. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.js +9 -1
  23. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.js +3 -1
  24. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/index.d.ts +5 -0
  25. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/index.js +2 -1
  26. package/lib/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +103 -43
  27. package/lib/plus/salesSdk/normalProductDetail/availabilityContextRouting.js +32 -0
  28. package/lib/pro/skuDetailModal/flow/modules/date/availabilityWindow.js +74 -0
  29. package/lib/pro/skuDetailModal/flow/modules/date/index.js +24 -9
  30. package/lib/pro/skuDetailModal/flow/modules/time/index.js +27 -12
  31. package/lib/pro/skuDetailModal/flow/modules/time/posCustomTime.js +8 -0
  32. package/lib/pro/skuDetailModal/flow/types.d.ts +8 -0
  33. package/package.json +4 -4
@@ -9,13 +9,14 @@ import { resolveAvailabilityStatus } from "../../../../../components/eventBookin
9
9
  import { findFirstNormallyAvailableDate, validateAvailabilityDateAutoResolution } from "../autoResolution.js";
10
10
  import BookingAvailabilityCalendar from "../../../../../components/eventBooking/components/bookingAvailabilityCalendar/index.js";
11
11
  import MultiDayTimeSelect from "../../../../multiDayTimeSelect/MultiDayTimeSelect.js";
12
+ import { mergeAvailabilityDates, resolveSlidingAvailabilityDateRange } from "./availabilityWindow.js";
12
13
  import dayjs from "dayjs";
13
14
  import React, { useEffect, useMemo, useRef } from "react";
14
15
  import { Alert, DatePicker, Space } from "antd";
15
16
  import { locales } from "@pisell/utils";
16
17
  //#region src/pro/skuDetailModal/flow/modules/date/index.tsx
17
18
  const refreshAvailabilityDates = function() {
18
- var _ref = _asyncToGenerator(function* (context, module) {
19
+ var _ref = _asyncToGenerator(function* (context, module, requestedDateRange) {
19
20
  const availability = context.services.availability;
20
21
  const allowUnavailable = context.services.allowUnavailableBookingSelection === true;
21
22
  const previousData = context.getModuleData(module.key);
@@ -23,11 +24,13 @@ const refreshAvailabilityDates = function() {
23
24
  context.setModuleData(module.key, {
24
25
  requestVersion,
25
26
  status: "loading",
26
- hasResolvedInitialDate: previousData === null || previousData === void 0 ? void 0 : previousData.hasResolvedInitialDate
27
+ hasResolvedInitialDate: previousData === null || previousData === void 0 ? void 0 : previousData.hasResolvedInitialDate,
28
+ availabilityDates: previousData === null || previousData === void 0 ? void 0 : previousData.availabilityDates
27
29
  });
28
30
  context.setModuleStatus(module.key, "loading");
29
31
  try {
30
32
  var _context$getModuleDat;
33
+ if (requestedDateRange && availability.ensureDateRange) yield availability.ensureDateRange(requestedDateRange);
31
34
  const result = yield availability.queryBookingAvailability(availability.contextId, {
32
35
  target: "date",
33
36
  productIds: [availability.productId],
@@ -35,7 +38,8 @@ const refreshAvailabilityDates = function() {
35
38
  });
36
39
  if (((_context$getModuleDat = context.getModuleData(module.key)) === null || _context$getModuleDat === void 0 ? void 0 : _context$getModuleDat.requestVersion) !== requestVersion) return;
37
40
  const group = result.data.find((item) => String(item === null || item === void 0 ? void 0 : item.productId) === String(availability.productId));
38
- const availabilityDates = Array.isArray(group === null || group === void 0 ? void 0 : group.dates) ? group.dates : [];
41
+ const queriedAvailabilityDates = Array.isArray(group === null || group === void 0 ? void 0 : group.dates) ? group.dates : [];
42
+ const availabilityDates = requestedDateRange ? mergeAvailabilityDates(previousData === null || previousData === void 0 ? void 0 : previousData.availabilityDates, queriedAvailabilityDates) : queriedAvailabilityDates;
39
43
  const hasResolvedInitialDate = Boolean(previousData === null || previousData === void 0 ? void 0 : previousData.hasResolvedInitialDate);
40
44
  context.setModuleData(module.key, {
41
45
  requestVersion,
@@ -68,13 +72,15 @@ const refreshAvailabilityDates = function() {
68
72
  context.setModuleData(module.key, {
69
73
  requestVersion,
70
74
  status: "error",
71
- error
75
+ error,
76
+ availabilityDates: previousData === null || previousData === void 0 ? void 0 : previousData.availabilityDates,
77
+ hasResolvedInitialDate: previousData === null || previousData === void 0 ? void 0 : previousData.hasResolvedInitialDate
72
78
  });
73
79
  context.setModuleStatus(module.key, "error", message, error);
74
80
  throw error;
75
81
  }
76
82
  });
77
- return function refreshAvailabilityDates(_x, _x2) {
83
+ return function refreshAvailabilityDates(_x, _x2, _x3) {
78
84
  return _ref.apply(this, arguments);
79
85
  };
80
86
  }();
@@ -138,7 +144,7 @@ const hydrateProductDataForDate = function() {
138
144
  context.setModuleStatus(module.key, "loading");
139
145
  return promise;
140
146
  });
141
- return function hydrateProductDataForDate(_x3, _x4, _x5) {
147
+ return function hydrateProductDataForDate(_x4, _x5, _x6) {
142
148
  return _ref2.apply(this, arguments);
143
149
  };
144
150
  }();
@@ -154,7 +160,7 @@ const awaitLatestDateHydration = function() {
154
160
  }
155
161
  if ((data === null || data === void 0 ? void 0 : data.status) === "error") throw data.error instanceof Error ? data.error : new Error(selectionFlowText("pisell2.text.sku.detail.modal.validation.date.refresh.failed"));
156
162
  });
157
- return function awaitLatestDateHydration(_x6, _x7) {
163
+ return function awaitLatestDateHydration(_x7, _x8) {
158
164
  return _ref3.apply(this, arguments);
159
165
  };
160
166
  }();
@@ -290,7 +296,7 @@ const DateFlowModuleComponent = ({ context, module, registerHandle }) => {
290
296
  });
291
297
  }
292
298
  if (availability) {
293
- if ((availabilityData === null || availabilityData === void 0 ? void 0 : availabilityData.status) === "loading" || !(availabilityData === null || availabilityData === void 0 ? void 0 : availabilityData.availabilityDates)) return /* @__PURE__ */ React.createElement(SkuDetailLoadingPanel, null);
299
+ if (!(availabilityData === null || availabilityData === void 0 ? void 0 : availabilityData.availabilityDates)) return /* @__PURE__ */ React.createElement(SkuDetailLoadingPanel, null);
294
300
  if (availabilityData.status === "error") {
295
301
  var _context$moduleState$2;
296
302
  return /* @__PURE__ */ React.createElement(Alert, {
@@ -305,6 +311,15 @@ const DateFlowModuleComponent = ({ context, module, registerHandle }) => {
305
311
  availabilityDates: availabilityData.availabilityDates,
306
312
  currentDate: (startDate || dayjs()).format("YYYY-MM-DD"),
307
313
  onCurrentDateChange: () => void 0,
314
+ onVisibleDateRangeChange: (visibleRange) => {
315
+ if (!availability.ensureDateRange) return;
316
+ const requestedDateRange = resolveSlidingAvailabilityDateRange({
317
+ availabilityDates: availabilityData.availabilityDates,
318
+ visibleRange
319
+ });
320
+ if (!requestedDateRange) return;
321
+ refreshAvailabilityDates(context, module, requestedDateRange).catch(() => void 0);
322
+ },
308
323
  onDateChange: (value) => {
309
324
  const nextDate = dayjs(value);
310
325
  updateDates(nextDate, nextDate, ["booking.startDate", "booking.endDate"]);
@@ -375,7 +390,7 @@ const dateFlowModule = {
375
390
  yield awaitLatestDateHydration(context, module.key);
376
391
  }
377
392
  });
378
- return function refresh(_x8, _x9) {
393
+ return function refresh(_x9, _x10) {
379
394
  return _ref4.apply(this, arguments);
380
395
  };
381
396
  }(),
@@ -10,7 +10,7 @@ import { buildDraftCacheItem, getModuleOptions, getUnsupportedBookingFlowReason,
10
10
  import TimeResourceSelector from "../../../../../components/eventBooking/components/timeResourceSelector/index.js";
11
11
  import { resolveAvailabilityStatus } from "../../../../../components/eventBooking/components/bookingAvailabilityCalendar/utils.js";
12
12
  import { validateAvailabilityTimeAutoResolution } from "../autoResolution.js";
13
- import { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleDurationInitialCandidate, shouldResetPosFlexibleTimeForDate, shouldShowPosCustomTimeCandidateCards } from "./posCustomTime.js";
13
+ import { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleDurationInitialCandidate, resolvePosFlexibleDurationRequestIntent, shouldApplyPosFlexibleDurationOverride, shouldResetPosFlexibleTimeForDate, shouldShowPosCustomTimeCandidateCards } from "./posCustomTime.js";
14
14
  import dayjs from "dayjs";
15
15
  import React, { useEffect, useMemo } from "react";
16
16
  import { Alert, Space } from "antd";
@@ -170,16 +170,30 @@ const refreshAvailabilityTimes = function() {
170
170
  const posDurationAvailability = isPosDurationAvailabilityContext(context);
171
171
  const posSessionAvailability = isPosSessionAvailabilityContext(context);
172
172
  const posCustomTimeAvailability = posDurationAvailability || posSessionAvailability;
173
- const requestedDuration = getAvailabilityDurationOverride(context, durationOverride);
174
- const requestedStartTime = getAvailabilityStartTimeOverride(context, startTimeOverride);
173
+ const draftRequestedDuration = getAvailabilityDurationOverride(context, durationOverride);
174
+ const draftRequestedStartTime = getAvailabilityStartTimeOverride(context, startTimeOverride);
175
175
  const selectedDate = context.draft.booking.startDate.format("YYYY-MM-DD");
176
176
  const requestId = Date.now() + Math.random();
177
177
  const previousTimeData = context.getModuleData(module.key);
178
- const posCustomTimeHydrationKey = posCustomTimeAvailability && requestedDuration && requestedStartTime ? `${selectedDate}|${requestedStartTime}|${requestedDuration}` : void 0;
178
+ const posCustomTimeHydrationKey = posCustomTimeAvailability && draftRequestedDuration && draftRequestedStartTime ? `${selectedDate}|${draftRequestedStartTime}|${draftRequestedDuration}` : void 0;
179
+ const product = context.draft.productData;
180
+ const effectiveSelectionIntent = resolvePosFlexibleDurationRequestIntent({
181
+ selectionIntent,
182
+ previousSelectionIntent: previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.posCustomTimeSelectionIntent,
183
+ hydrationKey: posCustomTimeHydrationKey,
184
+ previousHydrationKey: previousTimeData === null || previousTimeData === void 0 ? void 0 : previousTimeData.posCustomTimeHydrationKey
185
+ });
186
+ const suppressFlexiblePresetOverride = posDurationAvailability && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && !shouldApplyPosFlexibleDurationOverride({
187
+ selectionIntent: effectiveSelectionIntent,
188
+ isEditMode: context.services.selectionFlowMode === "edit"
189
+ });
190
+ const requestedDuration = suppressFlexiblePresetOverride ? void 0 : draftRequestedDuration;
191
+ const requestedStartTime = suppressFlexiblePresetOverride ? void 0 : draftRequestedStartTime;
179
192
  context.setModuleData(module.key, {
180
193
  requestId,
181
194
  timeSlots: [],
182
- posCustomTimeHydrationKey
195
+ posCustomTimeHydrationKey,
196
+ posCustomTimeSelectionIntent: effectiveSelectionIntent === "restore" ? void 0 : effectiveSelectionIntent
183
197
  });
184
198
  const group = (yield availability.getProductTimeRanges(availability.contextId, _objectSpread2({
185
199
  productIds: [availability.productId],
@@ -190,8 +204,7 @@ const refreshAvailabilityTimes = function() {
190
204
  partySize: resolveSelectionFlowQueryPartySize(context.draft, availability.partySize)
191
205
  }, requestedDuration ? _objectSpread2({ durationMinutesByProductId: { [String(availability.productId)]: requestedDuration } }, requestedStartTime ? { durationStartTimesByProductId: { [String(availability.productId)]: [requestedStartTime] } } : {}) : {}))).find((item) => String(item.productId) === String(availability.productId));
192
206
  const candidates = (group === null || group === void 0 ? void 0 : group.ranges) || [];
193
- const product = context.draft.productData;
194
- if (posDurationAvailability && selectionIntent === "restore" && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && candidates.length === 0) {
207
+ if (posDurationAvailability && effectiveSelectionIntent === "restore" && isFlexibleDurationValue(product === null || product === void 0 ? void 0 : product.duration) && candidates.length === 0) {
195
208
  var _context$hostContext, _moduleOptions$slice, _context$draft$bookin2, _normalizeDurationMin3;
196
209
  const moduleOptions = getModuleOptions(module);
197
210
  const configuredSlice = (_context$hostContext = context.hostContext) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.bookingConfig) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.config) === null || _context$hostContext === void 0 || (_context$hostContext = _context$hostContext.basic) === null || _context$hostContext === void 0 ? void 0 : _context$hostContext.service_time;
@@ -232,7 +245,8 @@ const refreshAvailabilityTimes = function() {
232
245
  timeSlots: [],
233
246
  selectedCandidate: void 0,
234
247
  slotStepMinutes: group === null || group === void 0 ? void 0 : group.slotStepMinutes,
235
- posCustomTimeHydrationKey
248
+ posCustomTimeHydrationKey,
249
+ posCustomTimeSelectionIntent: effectiveSelectionIntent === "restore" ? void 0 : effectiveSelectionIntent
236
250
  });
237
251
  return;
238
252
  }
@@ -248,8 +262,8 @@ const refreshAvailabilityTimes = function() {
248
262
  const existingCandidate = context.draft.booking.selectedCandidate;
249
263
  const draftStartTime = normalizeStartTimeValue(context.draft.booking.startTime);
250
264
  const draftEndTime = normalizeStartTimeValue(context.draft.booking.endTime);
251
- const requestedPosStartTime = requestedStartTime || draftStartTime;
252
- const requestedPosDuration = (_ref4 = requestedDuration !== null && requestedDuration !== void 0 ? requestedDuration : normalizeDurationMinutesValue(context.draft.booking.duration)) !== null && _ref4 !== void 0 ? _ref4 : getDraftRangeDurationMinutes(context);
265
+ const requestedPosStartTime = suppressFlexiblePresetOverride ? requestedStartTime : requestedStartTime || draftStartTime;
266
+ const requestedPosDuration = suppressFlexiblePresetOverride ? requestedDuration : (_ref4 = requestedDuration !== null && requestedDuration !== void 0 ? requestedDuration : normalizeDurationMinutesValue(context.draft.booking.duration)) !== null && _ref4 !== void 0 ? _ref4 : getDraftRangeDurationMinutes(context);
253
267
  const restoredDraftCandidate = draftStartTime ? times.find((candidate) => isAvailabilityCandidateSelectable(candidate, allowUnavailable) && (posSessionAvailability ? isSameAvailabilityCandidateRange(candidate, {
254
268
  date: selectedDate,
255
269
  startTime: draftStartTime,
@@ -265,8 +279,8 @@ const refreshAvailabilityTimes = function() {
265
279
  startTime: requestedPosStartTime,
266
280
  durationMinutes: requestedPosDuration
267
281
  }) : isSameCandidateStart(candidate, selectedDate, requestedPosStartTime)) : void 0;
268
- const customSelectionIntent = posCustomTimeAvailability && selectionIntent === "custom";
269
- const fallbackSelectionIntent = posCustomTimeAvailability && selectionIntent === "fallback";
282
+ const customSelectionIntent = posCustomTimeAvailability && effectiveSelectionIntent === "custom";
283
+ const fallbackSelectionIntent = posCustomTimeAvailability && effectiveSelectionIntent === "fallback";
270
284
  const requestedCustomRange = requestedPosStartTime && requestedPosDuration ? {
271
285
  date: selectedDate,
272
286
  startTime: requestedPosStartTime,
@@ -307,7 +321,8 @@ const refreshAvailabilityTimes = function() {
307
321
  candidate
308
322
  })),
309
323
  selectedCandidate: initialCandidate,
310
- posCustomTimeHydrationKey
324
+ posCustomTimeHydrationKey,
325
+ posCustomTimeSelectionIntent: effectiveSelectionIntent === "restore" ? void 0 : effectiveSelectionIntent
311
326
  });
312
327
  const shouldWriteInitialCandidate = Boolean(initialCandidate) && (posCustomTimeAvailability || !existingCandidate || initialCandidate.key !== existingCandidate.key);
313
328
  if (initialCandidate && shouldWriteInitialCandidate) {
@@ -1,5 +1,11 @@
1
1
  import dayjs from "dayjs";
2
2
  //#region src/pro/skuDetailModal/flow/modules/time/posCustomTime.ts
3
+ const resolvePosFlexibleDurationRequestIntent = (params) => {
4
+ if (params.selectionIntent !== "restore") return params.selectionIntent;
5
+ if (params.hydrationKey && params.hydrationKey === params.previousHydrationKey && params.previousSelectionIntent) return params.previousSelectionIntent;
6
+ return "restore";
7
+ };
8
+ const shouldApplyPosFlexibleDurationOverride = (params) => params.isEditMode || params.selectionIntent !== "restore";
3
9
  const isFlexibleDurationValue = (value) => {
4
10
  if (typeof value === "string") {
5
11
  const text = value.trim().toLowerCase();
@@ -71,4 +77,4 @@ const resolvePosFlexibleDurationInitialCandidate = (params) => {
71
77
  return params.restoredCandidate || params.fallbackCandidate;
72
78
  };
73
79
  //#endregion
74
- export { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleDurationInitialCandidate, shouldResetPosFlexibleTimeForDate, shouldShowPosCustomTimeCandidateCards };
80
+ export { getAvailabilityCandidateDurationMinutes, getPosFlexibleDurationPresetCandidates, getSessionPresetCandidates, isFlexibleDurationValue, isSameAvailabilityCandidateRange, resolvePosCustomTimeBaseMinutes, resolvePosCustomTimeCandidate, resolvePosCustomTimeDefaultDurationMinutes, resolvePosCustomTimeDefaultStartTime, resolvePosFlexibleDurationInitialCandidate, resolvePosFlexibleDurationRequestIntent, shouldApplyPosFlexibleDurationOverride, shouldResetPosFlexibleTimeForDate, shouldShowPosCustomTimeCandidateCards };
@@ -163,6 +163,14 @@ interface SelectionFlowAvailabilityService {
163
163
  contextId: string;
164
164
  productId: number | string;
165
165
  partySize: number;
166
+ /**
167
+ * 日历浏览超出当前投影时,按新的可视日期窗口准备一个 Availability context。
168
+ * Host 负责复用已覆盖该范围的 context,并保留仍可能被当前选择引用的旧 context。
169
+ */
170
+ ensureDateRange?: (dateRange: {
171
+ startDate: string;
172
+ endDate: string;
173
+ }) => Promise<void>;
166
174
  getProductTimeRanges: (contextId: string, request: Record<string, unknown>) => Promise<Array<{
167
175
  productId: number | string;
168
176
  title?: string;
@@ -557,7 +557,7 @@ const getProductTotalPrice = (item, options) => {
557
557
  return accumulator.add(currentPrice.mul(currentNum));
558
558
  }, price);
559
559
  if (other === null || other === void 0 ? void 0 : other.option) price = other === null || other === void 0 ? void 0 : other.option.reduce((accumulator, currentValue) => {
560
- const currentPrice = new decimal_js.default(currentValue.price || 0);
560
+ const currentPrice = new decimal_js.default(currentValue.price || currentValue.add_price || 0);
561
561
  const currentNum = new decimal_js.default(currentValue.num || 0);
562
562
  return accumulator.add(currentPrice.mul(currentNum));
563
563
  }, price);
@@ -14,7 +14,7 @@ classnames = require_runtime.__toESM(classnames);
14
14
  require("./index.less");
15
15
  //#region src/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.tsx
16
16
  const CalenDateWeek = (props) => {
17
- const { currentDate, dateChange, productId, timeList, dateLimitData, getLimitData, cutTime, showStatusBar = true, showDisabledStatus = true, ignoreAvailabilityDisabled = false, minSelectableDate, minViewDate, enableRangeSelection = false, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader = false, enableSwipeNavigation = false, disableCallToBook = false, navigationVariant = "default" } = props;
17
+ const { currentDate, dateChange, productId, timeList, dateLimitData, getLimitData, cutTime, showStatusBar = true, showDisabledStatus = true, ignoreAvailabilityDisabled = false, minSelectableDate, minViewDate, enableRangeSelection = false, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader = false, enableSwipeNavigation = false, disableCallToBook = false, navigationVariant = "default", onVisibleDateRangeChange } = props;
18
18
  const [weekList, setWeekList] = (0, react.useState)([]);
19
19
  const [weekAnchorDate, setWeekAnchorDate] = (0, react.useState)(currentDate);
20
20
  const [pendingWeekList, setPendingWeekList] = (0, react.useState)(null);
@@ -166,6 +166,10 @@ const CalenDateWeek = (props) => {
166
166
  if (pendingWeekAnchorDate && pendingWeekList) {
167
167
  setWeekAnchorDate(pendingWeekAnchorDate);
168
168
  setWeekList(pendingWeekList);
169
+ onVisibleDateRangeChange === null || onVisibleDateRangeChange === void 0 || onVisibleDateRangeChange({
170
+ startDate: pendingWeekList[0],
171
+ endDate: pendingWeekList[pendingWeekList.length - 1]
172
+ });
169
173
  }
170
174
  setPendingWeekAnchorDate(null);
171
175
  setPendingWeekList(null);
@@ -15,7 +15,7 @@ require("./index.less");
15
15
  //#region src/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.tsx
16
16
  dayjs.default.extend(dayjs_plugin_isSameOrBefore.default);
17
17
  const CalendarDate = (props, ref) => {
18
- const { cutTime, getLimitData, dateLimitData, loading, disableCallToBook = false, enforceAvailabilitySelection = false, ignoreAvailabilityDisabled = false, availabilityRange, minSelectableDate, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), closeOnSelect = false } = props;
18
+ const { cutTime, getLimitData, dateLimitData, loading, disableCallToBook = false, enforceAvailabilitySelection = false, ignoreAvailabilityDisabled = false, availabilityRange, minSelectableDate, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), closeOnSelect = false, onVisibleDateRangeChange } = props;
19
19
  const [productId, setProductId] = (0, react.useState)("");
20
20
  const [currentDate, setCurrentDate] = (0, react.useState)("");
21
21
  const [dateMonthList, setDateMonthList] = (0, react.useState)([]);
@@ -79,6 +79,10 @@ const CalendarDate = (props, ref) => {
79
79
  let newLastMonth = (0, dayjs.default)(currentMonth.format("YYYY-MM")).subtract(1, "month");
80
80
  setCurrentMonth(newLastMonth);
81
81
  setDateMonthList(getMonthData(newLastMonth.format("YYYY-MM")));
82
+ onVisibleDateRangeChange === null || onVisibleDateRangeChange === void 0 || onVisibleDateRangeChange({
83
+ startDate: newLastMonth.startOf("month").format("YYYY-MM-DD"),
84
+ endDate: newLastMonth.endOf("month").format("YYYY-MM-DD")
85
+ });
82
86
  };
83
87
  /**
84
88
  * @title: 切换下个月
@@ -92,6 +96,10 @@ const CalendarDate = (props, ref) => {
92
96
  let newNextMonth = (0, dayjs.default)(currentMonth.format("YYYY-MM")).add(1, "month");
93
97
  setCurrentMonth(newNextMonth);
94
98
  setDateMonthList(getMonthData(newNextMonth.format("YYYY-MM")));
99
+ onVisibleDateRangeChange === null || onVisibleDateRangeChange === void 0 || onVisibleDateRangeChange({
100
+ startDate: newNextMonth.startOf("month").format("YYYY-MM-DD"),
101
+ endDate: newNextMonth.endOf("month").format("YYYY-MM-DD")
102
+ });
95
103
  };
96
104
  /**
97
105
  * @title: 根据当前选择的月份剩余量
@@ -16,7 +16,7 @@ let classnames = require("classnames");
16
16
  classnames = require_runtime.__toESM(classnames);
17
17
  require("./index.less");
18
18
  //#region src/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.tsx
19
- const SelectDate = ({ currentDate, detail, currentDateChange, setSurplusDisabledChange, cutTime, setCutTime, showCalendarPopup, showStatusLegend = true, showDateStatusBar = true, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), showHeader = true, showDisabledStatus = true, ignoreAvailabilityDisabled = false, minSelectableDate, minViewDate, enableRangeSelection = false, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader = false, enableWeekSwipe = false, weekNavigationVariant = "default", closeCalendarOnSelect = false, availabilityDates }, ref) => {
19
+ const SelectDate = ({ currentDate, detail, currentDateChange, onVisibleDateRangeChange, setSurplusDisabledChange, cutTime, setCutTime, showCalendarPopup, showStatusLegend = true, showDateStatusBar = true, title = _pisell_utils.locales.getText("pisell2.event.calendar.select.date"), showHeader = true, showDisabledStatus = true, ignoreAvailabilityDisabled = false, minSelectableDate, minViewDate, enableRangeSelection = false, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader = false, enableWeekSwipe = false, weekNavigationVariant = "default", closeCalendarOnSelect = false, availabilityDates }, ref) => {
20
20
  const [dateLimitData, setDateLimitData] = (0, react.useState)(require_mock.mock.availability_calendar.limitData);
21
21
  /**
22
22
  * UBS 日期结果只负责状态展示,不伪造旧事件预约的 times/库存结构。
@@ -80,6 +80,7 @@ const SelectDate = ({ currentDate, detail, currentDateChange, setSurplusDisabled
80
80
  productId: detail === null || detail === void 0 ? void 0 : detail.id,
81
81
  cutTime,
82
82
  dateLimitData: resolvedDateLimitData,
83
+ onVisibleDateRangeChange,
83
84
  showStatusBar: showDateStatusBar,
84
85
  showDisabledStatus,
85
86
  ignoreAvailabilityDisabled,
@@ -100,6 +101,7 @@ const SelectDate = ({ currentDate, detail, currentDateChange, setSurplusDisabled
100
101
  },
101
102
  cutTime,
102
103
  dateLimitData: resolvedDateLimitData,
104
+ onVisibleDateRangeChange,
103
105
  disableCallToBook: usesExternalAvailability,
104
106
  enforceAvailabilitySelection: usesExternalAvailability,
105
107
  ignoreAvailabilityDisabled,
@@ -25,6 +25,11 @@ interface BookingAvailabilityCalendarProps {
25
25
  currentDate?: string;
26
26
  cutTime?: any;
27
27
  onCurrentDateChange?: (date: string) => void;
28
+ /** 周历或月历切换后,通知外层当前可视日期范围。 */
29
+ onVisibleDateRangeChange?: (range: {
30
+ startDate: string;
31
+ endDate: string;
32
+ }) => void;
28
33
  onCutTimeChange?: (date: string) => void;
29
34
  onSurplusDisabledChange?: (date: boolean) => void;
30
35
  showStatusLegend?: boolean;
@@ -21,7 +21,7 @@ const BookingAvailabilityCalendar = (0, react.forwardRef)((props, ref) => {
21
21
  * 日历挂载后日期图例、Add Note、Cancel 等文案又闪回英文。
22
22
  */
23
23
  _pisell_utils.locales.init(require_locales.default, _pisell_utils.locales.getLocale() || "en");
24
- const { showCalendarPopup, onDateChange, detail = (_mock$availability_ca = require_mock.mock.availability_calendar) === null || _mock$availability_ca === void 0 ? void 0 : _mock$availability_ca.detail, currentDate = (_mock$availability_ca2 = require_mock.mock.availability_calendar) === null || _mock$availability_ca2 === void 0 ? void 0 : _mock$availability_ca2.currentDate, cutTime = (_mock$availability_ca3 = require_mock.mock.availability_calendar) === null || _mock$availability_ca3 === void 0 ? void 0 : _mock$availability_ca3.cutTime, onCurrentDateChange, onCutTimeChange, onSurplusDisabledChange, showStatusLegend = true, showDateStatusBar = true, theme = "light", className, title, showHeader, showDisabledStatus, ignoreAvailabilityDisabled, minSelectableDate, minViewDate, enableRangeSelection, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader, enableWeekSwipe, weekNavigationVariant, closeCalendarOnSelect, availabilityDates } = props;
24
+ const { showCalendarPopup, onDateChange, detail = (_mock$availability_ca = require_mock.mock.availability_calendar) === null || _mock$availability_ca === void 0 ? void 0 : _mock$availability_ca.detail, currentDate = (_mock$availability_ca2 = require_mock.mock.availability_calendar) === null || _mock$availability_ca2 === void 0 ? void 0 : _mock$availability_ca2.currentDate, cutTime = (_mock$availability_ca3 = require_mock.mock.availability_calendar) === null || _mock$availability_ca3 === void 0 ? void 0 : _mock$availability_ca3.cutTime, onCurrentDateChange, onVisibleDateRangeChange, onCutTimeChange, onSurplusDisabledChange, showStatusLegend = true, showDateStatusBar = true, theme = "light", className, title, showHeader, showDisabledStatus, ignoreAvailabilityDisabled, minSelectableDate, minViewDate, enableRangeSelection, selectedRangeStartDate, selectedRangeEndDate, showMonthHeader, enableWeekSwipe, weekNavigationVariant, closeCalendarOnSelect, availabilityDates } = props;
25
25
  const selectDateRef = (0, react.useRef)(null);
26
26
  (0, react.useImperativeHandle)(ref, () => ({ openCalendarPopup: () => {
27
27
  var _selectDateRef$curren;
@@ -37,6 +37,7 @@ const BookingAvailabilityCalendar = (0, react.forwardRef)((props, ref) => {
37
37
  onCurrentDateChange(date);
38
38
  if (currentDate !== date) onDateChange(date);
39
39
  },
40
+ onVisibleDateRangeChange,
40
41
  setSurplusDisabledChange: onSurplusDisabledChange,
41
42
  cutTime,
42
43
  setCutTime: onCutTimeChange,