@pisell/pisellos 3.0.23 → 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];
@@ -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)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "3.0.23",
4
+ "version": "3.0.24",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",