@pisell/pisellos 3.0.22 → 3.0.24

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.
@@ -209,7 +209,18 @@ export var handleAvailableDatesByRules = function handleAvailableDatesByRules(da
209
209
  var disabledDate = _objectSpread(_objectSpread({}, date), {}, {
210
210
  status: 'unavailable'
211
211
  });
212
-
212
+ var hasScheduleConfig = rules.find(function (n) {
213
+ var _n$schedule;
214
+ return (_n$schedule = n.schedule) === null || _n$schedule === void 0 ? void 0 : _n$schedule.length;
215
+ });
216
+ // 如果外面穿了 schedule,但是这个时候scheduleMap为空,则设置为不可用
217
+ // 这种情况为,商品设置了 5.1-5.31 可用,资源设置了 5.1-6.30 可用,session 类商品详情弹窗里里看到的6 月以后的日期都应该是不可用的
218
+ if (Object.keys(scheduleMap).length === 0 && hasScheduleConfig) {
219
+ return _objectSpread(_objectSpread({}, date), {}, {
220
+ color: '',
221
+ status: 'unavailable'
222
+ });
223
+ }
213
224
  // 根据日程判断日期是否可用
214
225
  if (Object.keys(scheduleMap).length) {
215
226
  var schedule = scheduleMap[date.date];
@@ -205,6 +205,10 @@ export var getIsUsableByTimeItem = function getIsUsableByTimeItem(_ref2) {
205
205
  canBookingForOngoing = true;
206
206
  }
207
207
  }
208
+ } else if (type === 'ongoing' && (ongoing === null || ongoing === void 0 ? void 0 : ongoing.type) === 'before_end') {
209
+ if (dayjs(timeSlice.end_at).isAfter(earliest)) {
210
+ canBookingForOngoing = true;
211
+ }
208
212
  } else {
209
213
  if (unit) {
210
214
  earliest = earliest.add(unit, unit_type);
@@ -155,6 +155,13 @@ var handleAvailableDatesByRules = (dates, rules) => {
155
155
  newDates = newDates.map((date) => {
156
156
  var _a;
157
157
  const disabledDate = { ...date, status: "unavailable" };
158
+ const hasScheduleConfig = rules.find((n) => {
159
+ var _a2;
160
+ return (_a2 = n.schedule) == null ? void 0 : _a2.length;
161
+ });
162
+ if (Object.keys(scheduleMap).length === 0 && hasScheduleConfig) {
163
+ return { ...date, color: "", status: "unavailable" };
164
+ }
158
165
  if (Object.keys(scheduleMap).length) {
159
166
  const schedule = scheduleMap[date.date];
160
167
  if (!schedule || (schedule == null ? void 0 : schedule.isExcluded)) {
@@ -149,6 +149,10 @@ var getIsUsableByTimeItem = ({
149
149
  canBookingForOngoing = true;
150
150
  }
151
151
  }
152
+ } else if (type === "ongoing" && (ongoing == null ? void 0 : ongoing.type) === "before_end") {
153
+ if ((0, import_dayjs.default)(timeSlice.end_at).isAfter(earliest)) {
154
+ canBookingForOngoing = true;
155
+ }
152
156
  } else {
153
157
  if (unit) {
154
158
  earliest = earliest.add(unit, unit_type);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "3.0.22",
4
+ "version": "3.0.24",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",