@pisell/pisellos 0.0.108 → 0.0.109

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.
@@ -15,6 +15,7 @@ export declare class DateModule extends BaseModule implements Module, DateModule
15
15
  getDateRange(): ITime[];
16
16
  getResourceDates(params: IGetAvailableTimeListParams): Promise<ITime[]>;
17
17
  getDateList(): ITime[];
18
+ setDateList(dateList: ITime[]): void;
18
19
  fetchResourceDates(params: IGetAvailableTimeListParams): Promise<any>;
19
20
  getResourceAvailableTimeList(params: IGetAvailableTimeListParams): Promise<ITime[]>;
20
21
  clearDateRange(): void;
@@ -112,6 +112,11 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
112
112
  value: function getDateList() {
113
113
  return this.store.dateList;
114
114
  }
115
+ }, {
116
+ key: "setDateList",
117
+ value: function setDateList(dateList) {
118
+ this.store.dateList = dateList;
119
+ }
115
120
  }, {
116
121
  key: "fetchResourceDates",
117
122
  value: function () {
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -211,7 +211,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
211
211
  }): void;
212
212
  setOtherData(key: string, value: any): void;
213
213
  getOtherData(key: string): any;
214
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
214
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
215
215
  /**
216
216
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
217
217
  *
@@ -36,7 +36,7 @@ dayjs.extend(isSameOrAfter);
36
36
  import { getResourcesMap } from "../../modules/Resource/utils";
37
37
  import { cloneDeep } from 'lodash-es';
38
38
  import { calcCalendarDataByScheduleResult, calcMinTimeMaxTimeBySchedules, getAllSortedDateRanges } from "../../modules/Schedule/utils";
39
- import { disableAllDates, disableDatesBeforeOneDay, generateMonthDates } from "../../modules/Date/utils";
39
+ import { disableAllDates, disableDatesBeforeOneDay, generateMonthDates, handleAvailableDateByResource } from "../../modules/Date/utils";
40
40
  export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
41
41
  _inherits(BookingByStepImpl, _BaseModule);
42
42
  var _super = _createSuper(BookingByStepImpl);
@@ -2801,6 +2801,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2801
2801
  _context30.next = 22;
2802
2802
  break;
2803
2803
  case 28:
2804
+ // 最终把资源数据也加到日期内
2805
+ dates = handleAvailableDateByResource(res.data, dates);
2806
+ this.store.date.setDateList(dates);
2807
+
2804
2808
  // 缓存这次结果,以防后面他小幅度范围内去修改天数
2805
2809
  (_this$store$currentPr6 = this.store.currentProduct) === null || _this$store$currentPr6 === void 0 || _this$store$currentPr6.setOtherParams('timeSlotBySchedule', {
2806
2810
  dateList: dates,
@@ -2812,7 +2816,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2812
2816
  dateList: dates,
2813
2817
  firstAvailableDate: firstAvailableDate
2814
2818
  });
2815
- case 30:
2819
+ case 32:
2816
2820
  case "end":
2817
2821
  return _context30.stop();
2818
2822
  }
@@ -15,6 +15,7 @@ export declare class DateModule extends BaseModule implements Module, DateModule
15
15
  getDateRange(): ITime[];
16
16
  getResourceDates(params: IGetAvailableTimeListParams): Promise<ITime[]>;
17
17
  getDateList(): ITime[];
18
+ setDateList(dateList: ITime[]): void;
18
19
  fetchResourceDates(params: IGetAvailableTimeListParams): Promise<any>;
19
20
  getResourceAvailableTimeList(params: IGetAvailableTimeListParams): Promise<ITime[]>;
20
21
  clearDateRange(): void;
@@ -65,6 +65,9 @@ var DateModule = class extends import_BaseModule.BaseModule {
65
65
  getDateList() {
66
66
  return this.store.dateList;
67
67
  }
68
+ setDateList(dateList) {
69
+ this.store.dateList = dateList;
70
+ }
68
71
  async fetchResourceDates(params) {
69
72
  const { url, query } = params;
70
73
  const fetchUrl = url || "/schedule/resource/list";
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -211,7 +211,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
211
211
  }): void;
212
212
  setOtherData(key: string, value: any): void;
213
213
  getOtherData(key: string): any;
214
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
214
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
215
215
  /**
216
216
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
217
217
  *
@@ -1904,7 +1904,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1904
1904
  resource_ids: tempResourceIds
1905
1905
  }
1906
1906
  });
1907
- const dates = [];
1907
+ let dates = [];
1908
1908
  let currentDate = (0, import_dayjs.default)(startDate);
1909
1909
  let firstAvailableDate = "";
1910
1910
  const openResources = ((_e = (_d = tempProducts == null ? void 0 : tempProducts.product_resource) == null ? void 0 : _d.resources) == null ? void 0 : _e.filter(
@@ -1995,6 +1995,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1995
1995
  }
1996
1996
  currentDate = (0, import_dayjs.default)(currentDate).add(1, "day");
1997
1997
  }
1998
+ dates = (0, import_utils3.handleAvailableDateByResource)(res.data, dates);
1999
+ this.store.date.setDateList(dates);
1998
2000
  (_f = this.store.currentProduct) == null ? void 0 : _f.setOtherParams("timeSlotBySchedule", {
1999
2001
  dateList: dates,
2000
2002
  firstAvailableDate,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.108",
4
+ "version": "0.0.109",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",