@pisell/private-materials 3.4.8 → 3.4.10

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 (78) 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 +4 -4
  6. package/build/lowcode/view.js +4 -4
  7. package/es/components/booking/components/customSelect/index.js +1 -0
  8. package/es/components/booking/forms/single/RenderValueById.js +2 -2
  9. package/es/components/booking/hooks/useClearCart.js +11 -8
  10. package/es/components/booking/hooks/useQuotation.js +1 -1
  11. package/es/components/booking/info/client/index.js +3 -2
  12. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  13. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  14. package/es/components/booking/info/hooks/useInfoHolder.js +16 -9
  15. package/es/components/booking/info/service/Lists.d.ts +1 -0
  16. package/es/components/booking/info/service/Lists.js +36 -26
  17. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  18. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  19. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  20. package/es/components/booking/info/service2/utils.js +20 -21
  21. package/es/components/booking/info/utils.js +1 -1
  22. package/es/components/booking/info2/index.js +1 -0
  23. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  24. package/es/components/booking/info2/service/addService/utils.js +8 -4
  25. package/es/components/booking/info2/service/addTimeModal/index.js +3 -0
  26. package/es/components/booking/info2/service/editService/Resources/index.js +5 -0
  27. package/es/components/booking/info2/service/editService/index.js +266 -170
  28. package/es/components/booking/info2/service/index.js +19 -15
  29. package/es/components/booking/info2/utilsByBooking.js +3 -2
  30. package/es/components/booking/materiels/duration/index.js +9 -2
  31. package/es/components/booking/materiels/holder/index.d.ts +1 -0
  32. package/es/components/booking/materiels/startTime/index.d.ts +1 -0
  33. package/es/components/booking/materiels/startTime/index.js +2 -2
  34. package/es/components/booking/utils.js +3 -3
  35. package/es/components/schedules/components/CurrentDay/index.d.ts +1 -0
  36. package/es/components/schedules/products/index.d.ts +1 -0
  37. package/es/components/shoppingCart/components/Cart/Product.js +48 -41
  38. package/es/components/shoppingCart/components/Cart/index.js +21 -18
  39. package/es/components/ticketBooking/components/addServiceVariant/addService.js +249 -158
  40. package/es/components/ticketBooking/components/timeBar/index.js +78 -71
  41. package/es/components/ticketBooking/utils/index.d.ts +2 -0
  42. package/es/components/ticketBooking/utils/index.js +18 -1
  43. package/lib/components/booking/components/customSelect/index.js +1 -0
  44. package/lib/components/booking/forms/single/RenderValueById.js +6 -6
  45. package/lib/components/booking/hooks/useClearCart.js +16 -13
  46. package/lib/components/booking/hooks/useQuotation.js +1 -1
  47. package/lib/components/booking/info/client/index.js +5 -4
  48. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  49. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  50. package/lib/components/booking/info/hooks/useInfoHolder.js +10 -9
  51. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  52. package/lib/components/booking/info/service/Lists.js +35 -23
  53. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  54. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  55. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  56. package/lib/components/booking/info/service2/utils.js +17 -17
  57. package/lib/components/booking/info/utils.js +2 -1
  58. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  59. package/lib/components/booking/info2/service/addService/utils.js +7 -5
  60. package/lib/components/booking/info2/service/addTimeModal/index.js +3 -0
  61. package/lib/components/booking/info2/service/editService/Resources/index.js +2 -0
  62. package/lib/components/booking/info2/service/editService/index.js +139 -74
  63. package/lib/components/booking/info2/service/index.js +13 -9
  64. package/lib/components/booking/info2/utilsByBooking.js +4 -4
  65. package/lib/components/booking/materiels/duration/index.js +7 -2
  66. package/lib/components/booking/materiels/holder/index.d.ts +1 -0
  67. package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
  68. package/lib/components/booking/materiels/startTime/index.js +1 -1
  69. package/lib/components/booking/utils.js +3 -3
  70. package/lib/components/schedules/components/CurrentDay/index.d.ts +1 -0
  71. package/lib/components/schedules/products/index.d.ts +1 -0
  72. package/lib/components/shoppingCart/components/Cart/Product.js +31 -21
  73. package/lib/components/shoppingCart/components/Cart/index.js +18 -15
  74. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +196 -127
  75. package/lib/components/ticketBooking/components/timeBar/index.js +95 -88
  76. package/lib/components/ticketBooking/utils/index.d.ts +2 -0
  77. package/lib/components/ticketBooking/utils/index.js +22 -0
  78. package/package.json +4 -4
@@ -9,6 +9,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
9
9
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
10
  import dayjs from 'dayjs';
11
11
  import { isNormalProductByDurationSchedule } from "../../booking/info/service2/utils";
12
+ import { getUniqueId } from "@pisell/utils";
12
13
 
13
14
  /** dayjs对象格式化为字符串时间 */
14
15
  export var formatDateToStr = function formatDateToStr(date) {
@@ -104,7 +105,7 @@ export var restoreProductOtherData = function restoreProductOtherData(data) {
104
105
  };
105
106
 
106
107
  // 是相同的商品
107
- var isSameProduct = function isSameProduct(a, b) {
108
+ export var isSameProduct = function isSameProduct(a, b) {
108
109
  var _a$_extend2, _b$_extend2;
109
110
  if (isNormalProductByDurationSchedule(a) && isNormalProductByDurationSchedule(b)) {
110
111
  var _a$_extend, _b$_extend;
@@ -217,4 +218,20 @@ export var genServiceKey = function genServiceKey(item) {
217
218
  });
218
219
  });
219
220
  return "".concat(product_id, "-").concat(durationKey, "-").concat(resourceKey, "-").concat(start_time, "-").concat(total);
221
+ };
222
+ export var createSimpleCacheItem = function createSimpleCacheItem(item, e, state) {
223
+ var cacheItem = _objectSpread(_objectSpread({}, item), {}, {
224
+ product_id: item.id,
225
+ _id: getUniqueId(),
226
+ _key: e.key,
227
+ _extend: {
228
+ start_date: state.date.value,
229
+ quantity: (e === null || e === void 0 ? void 0 : e.quantity) || 1,
230
+ price: item.price,
231
+ product_name: item.title,
232
+ other: e
233
+ },
234
+ new: 1
235
+ });
236
+ return cacheItem;
220
237
  };
@@ -78,6 +78,7 @@ var CustomSelect = (props, ref) => {
78
78
  handleOpenModal: propsHandleOpenModal,
79
79
  handleDayChange
80
80
  } = props;
81
+ console.log("custom select");
81
82
  const searchRef = (0, import_react.useRef)();
82
83
  const [_value, set_value] = (0, import_react.useState)([]);
83
84
  const [search, setSearch] = (0, import_react.useState)("");
@@ -39,12 +39,12 @@ var import_ahooks = require("ahooks");
39
39
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
40
40
  var import_serve = require("../serve");
41
41
  var RenderValueById = (props) => {
42
- var _a, _b, _c, _d, _e, _f;
42
+ var _a, _b, _c, _d, _e, _f, _g, _h;
43
43
  const { field, value: propsValue } = props;
44
44
  const { appHelper } = (0, import_useEngineContext.default)();
45
45
  const _getFormData = (0, import_ahooks.useRequest)(import_serve.getFormData, {
46
46
  manual: true,
47
- cacheKey: `formOption-${(_a = field.setting) == null ? void 0 : _a.linkedTable}`,
47
+ cacheKey: `formOption-${(_a = field.setting) == null ? void 0 : _a.linkedTable}-${(_c = (_b = propsValue || []) == null ? void 0 : _b.toString) == null ? void 0 : _c.call(_b)}`,
48
48
  staleTime: 500,
49
49
  cacheTime: 5e3
50
50
  });
@@ -81,7 +81,7 @@ var RenderValueById = (props) => {
81
81
  }))) || [];
82
82
  }
83
83
  return (_e2 = field == null ? void 0 : field.setting) == null ? void 0 : _e2.customTypeList;
84
- }, [field.filed_type, (_b = field == null ? void 0 : field.setting) == null ? void 0 : _b.customTypeList, _getFormData.data]);
84
+ }, [field.filed_type, (_d = field == null ? void 0 : field.setting) == null ? void 0 : _d.customTypeList, _getFormData.data]);
85
85
  if ((0, import_utils.isArr)(value)) {
86
86
  let _list = options == null ? void 0 : options.filter((i) => {
87
87
  return value == null ? void 0 : value.includes((i == null ? void 0 : i.id) || i.value);
@@ -93,12 +93,12 @@ var RenderValueById = (props) => {
93
93
  return /* @__PURE__ */ import_react.default.createElement("span", null, _str || "-");
94
94
  }
95
95
  if (!(0, import_utils.isUndefined)(value)) {
96
- if ((field == null ? void 0 : field.filed_type) === "select" && !((_c = field == null ? void 0 : field.setting) == null ? void 0 : _c.version)) {
96
+ if ((field == null ? void 0 : field.filed_type) === "select" && !((_e = field == null ? void 0 : field.setting) == null ? void 0 : _e.version)) {
97
97
  return /* @__PURE__ */ import_react.default.createElement("span", null, value || "-");
98
98
  }
99
99
  let _item = options == null ? void 0 : options.filter((i) => (i == null ? void 0 : i.id) == value);
100
- return ((_f = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _f.translationShop(
101
- ((_d = _item == null ? void 0 : _item[0]) == null ? void 0 : _d.title) || ((_e = _item == null ? void 0 : _item[0]) == null ? void 0 : _e.label)
100
+ return ((_h = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _h.translationShop(
101
+ ((_f = _item == null ? void 0 : _item[0]) == null ? void 0 : _f.title) || ((_g = _item == null ? void 0 : _item[0]) == null ? void 0 : _g.label)
102
102
  )) || "-";
103
103
  }
104
104
  return null;
@@ -37,7 +37,7 @@ var import_classnames = __toESM(require("classnames"));
37
37
  var import_materials = require("@pisell/materials");
38
38
  var import_utils = require("@pisell/utils");
39
39
  var useClearCart = (state, dispatch) => {
40
- var _a, _b, _c, _d;
40
+ var _a, _b;
41
41
  const handleClear = () => {
42
42
  dispatch({
43
43
  type: "setService",
@@ -46,17 +46,20 @@ var useClearCart = (state, dispatch) => {
46
46
  }
47
47
  });
48
48
  };
49
- return !!((_b = (_a = state.service) == null ? void 0 : _a.value) == null ? void 0 : _b.length) && !state.channelDisabledEdit && /* @__PURE__ */ import_react.default.createElement(
50
- "span",
51
- {
52
- className: (0, import_classnames.default)("pisell-lowcode__booking-service-clear-btn", {
53
- ["pisell-lowcode__booking-service-clear-btn-disabled"]: !((_d = (_c = state.service) == null ? void 0 : _c.value) == null ? void 0 : _d.length)
54
- }),
55
- onClick: handleClear
56
- },
57
- /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-trash-01" }),
58
- " ",
59
- /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.booking.info.text.clear-cart"))
60
- );
49
+ return (0, import_react.useMemo)(() => {
50
+ var _a2, _b2, _c, _d;
51
+ return !!((_b2 = (_a2 = state.service) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length) && !state.channelDisabledEdit && /* @__PURE__ */ import_react.default.createElement(
52
+ "span",
53
+ {
54
+ className: (0, import_classnames.default)("pisell-lowcode__booking-service-clear-btn", {
55
+ ["pisell-lowcode__booking-service-clear-btn-disabled"]: !((_d = (_c = state.service) == null ? void 0 : _c.value) == null ? void 0 : _d.length)
56
+ }),
57
+ onClick: handleClear
58
+ },
59
+ /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-trash-01" }),
60
+ " ",
61
+ /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.booking.info.text.clear-cart"))
62
+ );
63
+ }, [(_b = (_a = state.service) == null ? void 0 : _a.value) == null ? void 0 : _b.length, state.channelDisabledEdit]);
61
64
  };
62
65
  var useClearCart_default = useClearCart;
@@ -35,7 +35,7 @@ __export(useQuotation_exports, {
35
35
  module.exports = __toCommonJS(useQuotation_exports);
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_utils = require("../utils");
38
- var import_useEngineContext = __toESM(require("../../../../es/hooks/useEngineContext"));
38
+ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
39
39
  var import_utils2 = require("@pisell/utils");
40
40
  var import_materials = require("@pisell/materials");
41
41
  var import_serve = require("../info/service/serve");
@@ -48,7 +48,7 @@ var import_utils3 = require("../clientVariant/utils");
48
48
  var import_useGetHolderList = __toESM(require("../hooks/useGetHolderList"));
49
49
  var isLoadClient = false;
50
50
  var Client = () => {
51
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
52
52
  const modalRef = (0, import_react.useRef)();
53
53
  const [loadLoading, setLoadLoading] = (0, import_react.useState)(false);
54
54
  const [loading, setLoading] = (0, import_react.useState)(false);
@@ -298,6 +298,7 @@ var Client = () => {
298
298
  )) : null;
299
299
  }, [loadLoading, params, state.client.clients.length]);
300
300
  const customSelect = (0, import_react.useMemo)(() => {
301
+ console.log("render customSelect");
301
302
  return /* @__PURE__ */ import_react.default.createElement(
302
303
  import_customSelect.default,
303
304
  {
@@ -340,7 +341,7 @@ var Client = () => {
340
341
  }
341
342
  }
342
343
  );
343
- }, [state, renderList, loading, franchiseeLoading, params.search, loadMore]);
344
+ }, [state.isTerminal, state.modalOpen, (_b = state.client) == null ? void 0 : _b.value, state.drawerMask, renderList, loading, franchiseeLoading, params.search, loadMore]);
344
345
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
345
346
  "div",
346
347
  {
@@ -357,11 +358,11 @@ var Client = () => {
357
358
  import_antd.Avatar,
358
359
  {
359
360
  className: "pisell-lowcode__booking-client-list-item-avatar",
360
- src: import_utils.image.ali((_b = state.client.value) == null ? void 0 : _b.cover, 100),
361
+ src: import_utils.image.ali((_c = state.client.value) == null ? void 0 : _c.cover, 100),
361
362
  icon: /* @__PURE__ */ import_react.default.createElement(import_User01.default, { className: "pisell-lowcode__booking-client-list-item-avatar-icon" })
362
363
  }
363
364
  ),
364
- /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-name" }, getNickname(state.client.value)), isWalkIn ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-desc" }, import_utils.locales.getText("pisell2.text.leave-empty-for-walk-in")) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, ((_c = state.client.value) == null ? void 0 : _c.email) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-email" }, (_d = state.client.value) == null ? void 0 : _d.email) : null, ((_e = state.client.value) == null ? void 0 : _e.phone) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-phone" }, (_f = state.client.value) == null ? void 0 : _f.phone) : null, !!((_h = (_g = state.client.value) == null ? void 0 : _g.waiver_form) == null ? void 0 : _h.length) && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-waiver", title: (0, import_utils3.getWaiverTitle)((_i = state.client.value) == null ? void 0 : _i.waiver_form) }, (_l = (_k = (_j = state.client.value) == null ? void 0 : _j.waiver_form) == null ? void 0 : _k.map) == null ? void 0 : _l.call(_k, (item) => {
365
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-name" }, getNickname(state.client.value)), isWalkIn ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-desc" }, import_utils.locales.getText("pisell2.text.leave-empty-for-walk-in")) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, ((_d = state.client.value) == null ? void 0 : _d.email) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-email" }, (_e = state.client.value) == null ? void 0 : _e.email) : null, ((_f = state.client.value) == null ? void 0 : _f.phone) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-phone" }, (_g = state.client.value) == null ? void 0 : _g.phone) : null, !!((_i = (_h = state.client.value) == null ? void 0 : _h.waiver_form) == null ? void 0 : _i.length) && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-waiver", title: (0, import_utils3.getWaiverTitle)((_j = state.client.value) == null ? void 0 : _j.waiver_form) }, (_m = (_l = (_k = state.client.value) == null ? void 0 : _k.waiver_form) == null ? void 0 : _l.map) == null ? void 0 : _m.call(_l, (item) => {
365
366
  return /* @__PURE__ */ import_react.default.createElement("span", null, item.form_title, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-client-waiver-colon" }, ":"), item.is_filled ? /* @__PURE__ */ import_react.default.createElement(
366
367
  "span",
367
368
  {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  export declare const disabledDate: (current: any, position: any, currentDate: any) => any;
3
4
  declare const DateRange: ({ state, dispatch, key }: any) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { EditServiceRef } from "../service/editService";
2
3
  declare const useInfoHolder: (state: any, dispatch: any) => {
3
4
  detailRef: import("react").MutableRefObject<EditServiceRef | undefined>;
@@ -32,6 +32,7 @@ __export(useInfoHolder_exports, {
32
32
  default: () => useInfoHolder_default
33
33
  });
34
34
  module.exports = __toCommonJS(useInfoHolder_exports);
35
+ var import_ahooks = require("ahooks");
35
36
  var import_react = require("react");
36
37
  var import_useHolderConfig = __toESM(require("./useHolderConfig"));
37
38
  var import_utils = require("../utils");
@@ -54,21 +55,21 @@ var useInfoHolder = (state, dispatch) => {
54
55
  };
55
56
  }, [(_d = (_c = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _c.config) == null ? void 0 : _d.information_tab]);
56
57
  const showAddTimeModal = (0, import_react.useMemo)(() => {
57
- return (0, import_utils.isOpenAddTime)(state);
58
+ return (0, import_utils.isOpenAddTime)(state) && !state.isBookingTicket2;
58
59
  }, [state, appointment_card.quick_time]);
59
- const handleEdit = (cacheItem, type) => {
60
- setTimeout(() => {
61
- var _a2, _b2;
62
- (_b2 = (_a2 = detailRef.current) == null ? void 0 : _a2.init) == null ? void 0 : _b2.call(_a2, cacheItem, false, type === "edit_product");
63
- }, 100);
64
- };
60
+ const handleEdit = (0, import_ahooks.useMemoizedFn)((cacheItem, type) => {
61
+ var _a2, _b2;
62
+ console.time("handleEdit");
63
+ console.log(performance.now() - window.pp1, "打开商品4");
64
+ (_b2 = (_a2 = detailRef.current) == null ? void 0 : _a2.init) == null ? void 0 : _b2.call(_a2, cacheItem, false, type === "edit_product");
65
+ });
65
66
  const dispatchService = (type, payload) => {
66
67
  dispatch({
67
68
  type,
68
69
  payload: { ...payload }
69
70
  });
70
71
  };
71
- const handleAction = (dataSource) => {
72
+ const handleAction = (0, import_ahooks.useMemoizedFn)((dataSource) => {
72
73
  const cacheItem = (0, import_utils2.getProductExtend)({
73
74
  cacheItem: { ...dataSource._origin, new: 0 },
74
75
  state
@@ -80,7 +81,7 @@ var useInfoHolder = (state, dispatch) => {
80
81
  cacheItem
81
82
  }
82
83
  });
83
- };
84
+ });
84
85
  return {
85
86
  detailRef,
86
87
  handleEdit,
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const Lists: ({ onEdit, onChange, onAction, isParallelResource }: any) => JSX.Element;
2
3
  export default Lists;
@@ -48,10 +48,12 @@ var Lists = ({ onEdit, onChange, onAction, isParallelResource }) => {
48
48
  const { handleAddHolder } = (0, import_useAddHolder.default)(state, dispatch);
49
49
  const handleChange = (0, import_ahooks.useMemoizedFn)(
50
50
  (currentItem, type, other) => {
51
+ console.time("handleChange");
52
+ console.log(window.pp1 = performance.now(), "打开商品");
51
53
  if (state.disabledEdit || state.disableEventBookingEdit) {
52
54
  return;
53
55
  }
54
- let products = (0, import_utils.updateServices)(state, currentItem, type, other, {
56
+ let products2 = (0, import_utils.updateServices)(state, currentItem, type, other, {
55
57
  handleAddHolder
56
58
  });
57
59
  if (type === "view" || type === "edit_product") {
@@ -64,11 +66,11 @@ var Lists = ({ onEdit, onChange, onAction, isParallelResource }) => {
64
66
  });
65
67
  }
66
68
  onChange({ editModal: true, cacheItem });
67
- return onEdit == null ? void 0 : onEdit({ ...product, new: 0 }, type);
69
+ return onEdit == null ? void 0 : onEdit(cacheItem, type);
68
70
  }
69
71
  const params = {
70
72
  editModal: false,
71
- value: products,
73
+ value: products2,
72
74
  edit: true,
73
75
  cacheItem: null
74
76
  };
@@ -95,26 +97,36 @@ var Lists = ({ onEdit, onChange, onAction, isParallelResource }) => {
95
97
  isShowChangeHolder,
96
98
  state.isBookingCreatePage
97
99
  ]);
98
- return /* @__PURE__ */ import_react.default.createElement(import_Provider.CartContext.Provider, { value: { state } }, /* @__PURE__ */ import_react.default.createElement(
99
- import_shoppingCart.default,
100
- {
101
- isParallelResource,
102
- onAction,
103
- onChange: handleChange,
104
- isOpenGroup: false,
105
- isHideClearCart: true,
106
- onAddProduct: () => onChange({ addModal: true }),
107
- productParams: {
108
- ...productParams,
109
- products: (0, import_utils.formatProducts)(
110
- ((_a = state == null ? void 0 : state.service) == null ? void 0 : _a.value) || [],
111
- state,
112
- false,
113
- true,
114
- isParallelResource
115
- )
100
+ const products = (0, import_react.useMemo)(() => {
101
+ var _a2;
102
+ console.time("products");
103
+ const p = (0, import_utils.formatProducts)(
104
+ ((_a2 = state == null ? void 0 : state.service) == null ? void 0 : _a2.value) || [],
105
+ state,
106
+ false,
107
+ true,
108
+ isParallelResource
109
+ );
110
+ console.timeEnd("products");
111
+ return p;
112
+ }, [(_a = state == null ? void 0 : state.service) == null ? void 0 : _a.value, state]);
113
+ return (0, import_react.useMemo)(() => {
114
+ console.log("render List");
115
+ return /* @__PURE__ */ import_react.default.createElement(import_Provider.CartContext.Provider, { value: { state } }, /* @__PURE__ */ import_react.default.createElement(
116
+ import_shoppingCart.default,
117
+ {
118
+ isParallelResource,
119
+ onAction,
120
+ onChange: handleChange,
121
+ isOpenGroup: false,
122
+ isHideClearCart: true,
123
+ onAddProduct: () => onChange({ addModal: true }),
124
+ productParams: {
125
+ ...productParams,
126
+ products
127
+ }
116
128
  }
117
- }
118
- ));
129
+ ));
130
+ }, [products, state, productParams]);
119
131
  };
120
132
  var Lists_default = Lists;
@@ -6,7 +6,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
6
6
  type: string;
7
7
  value: number;
8
8
  };
9
- locale: string;
9
+ locale: any;
10
10
  slice: any;
11
11
  selectProps: {
12
12
  size: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const BookingList: ({ items }: {
2
3
  items: any[];
3
4
  }) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const Lists: ({ onEdit, onChange }: any) => JSX.Element;
2
3
  export default Lists;
@@ -579,25 +579,25 @@ var formatProducts = (lists, state, isRenderGroup = true, isGeneral, isParallelR
579
579
  _origin: item
580
580
  };
581
581
  };
582
- lists.forEach((item) => {
583
- var _a;
584
- if (!((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId)) {
585
- normalList.push(formItem(item));
586
- } else {
587
- groupList.push(item);
588
- }
589
- });
590
- let groups = groupList.reduce((prev, item) => {
591
- var _a;
592
- const groupId = (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId;
593
- if (!prev[groupId]) {
594
- prev[groupId] = [];
595
- }
596
- prev[groupId].push(item);
597
- return prev;
598
- }, {});
599
582
  console.log(normalList, "normalList");
600
583
  if (isRenderGroup) {
584
+ lists.forEach((item) => {
585
+ var _a;
586
+ if (!((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId)) {
587
+ normalList.push(formItem(item));
588
+ } else {
589
+ groupList.push(item);
590
+ }
591
+ });
592
+ let groups = groupList.reduce((prev, item) => {
593
+ var _a;
594
+ const groupId = (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId;
595
+ if (!prev[groupId]) {
596
+ prev[groupId] = [];
597
+ }
598
+ prev[groupId].push(item);
599
+ return prev;
600
+ }, {});
601
601
  return Object.values(groups).map((d) => formItem((0, import_utils3.concatBookings)(d))).concat(normalList);
602
602
  } else {
603
603
  return lists == null ? void 0 : lists.map((item) => formItem(item));
@@ -145,7 +145,8 @@ var isBooking4Shop = (shopId, renderType, businessUtils) => {
145
145
  8824,
146
146
  8913,
147
147
  8918,
148
- 6413
148
+ 6413,
149
+ 8943
149
150
  ];
150
151
  return booking4Shops.includes(shopId) || (businessUtils == null ? void 0 : businessUtils.getAppByModal("resourcekit"));
151
152
  };
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
7
7
  type: string;
8
8
  value: number;
9
9
  };
10
- locale: string;
10
+ locale: any;
11
11
  slice: any;
12
12
  selectProps: {
13
13
  size: string;
@@ -142,7 +142,8 @@ var getTimeObj = ({
142
142
  cacheItem,
143
143
  useStartTime,
144
144
  currentResource,
145
- state,
145
+ // 没有使用该参数
146
+ // state,
146
147
  durationProps
147
148
  });
148
149
  let obj = (0, import_utils.sliceDayIntoFiveMinutes)(
@@ -242,7 +243,8 @@ var setDefaultResource = ({ cacheItem, resources }) => {
242
243
  }
243
244
  const defaultResource = defaultOriginalResource.map((d) => {
244
245
  return {
245
- ...d,
246
+ // ...d,
247
+ children: d.children,
246
248
  relation_type: d.relation_type,
247
249
  form_id: item.form_id,
248
250
  relation_id: d.id,
@@ -382,7 +384,7 @@ var getIsAutoClose = (cacheItem) => {
382
384
  );
383
385
  };
384
386
  var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
385
- var _a, _b, _c, _d;
387
+ var _a, _b, _c, _d, _e, _f, _g;
386
388
  const isNew = cacheItem.new || !cacheItem._extend.endDate;
387
389
  let _cacheItem = { ...cacheItem };
388
390
  const resourcesOriginMap = state.service.resourcesOriginMap || {};
@@ -430,7 +432,7 @@ var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
430
432
  state
431
433
  });
432
434
  if ((0, import_utils.getDuration)(_cacheItem == null ? void 0 : _cacheItem.duration) === "flexible") {
433
- _cacheItem._extend.duration = _cacheItem._data.timeObj.durationSlicesBasedOnTime[0].value;
435
+ _cacheItem._extend.duration = (_e = (_d = (_c = _cacheItem._data.timeObj) == null ? void 0 : _c.durationSlicesBasedOnTime) == null ? void 0 : _d[0]) == null ? void 0 : _e.value;
434
436
  const { startDate, endDate } = (0, import_utils.getServiceTimes)({
435
437
  _extend: _cacheItem._extend
436
438
  });
@@ -464,7 +466,7 @@ var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
464
466
  {
465
467
  extraResources,
466
468
  // 此数据用来控制 该商品所展示的资源是自身关联的, 还是全部的
467
- resourceTab: (_d = (_c = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _c.config) == null ? void 0 : _d.resource_tab,
469
+ resourceTab: (_g = (_f = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _f.config) == null ? void 0 : _g.resource_tab,
468
470
  resourcesOrigin: state.service.resourcesOrigin
469
471
  }
470
472
  );
@@ -65,6 +65,7 @@ var AddTimeModal = () => {
65
65
  const [number, setNumber] = (0, import_react.useState)(1);
66
66
  const originServices = (0, import_react.useRef)([]);
67
67
  const [renderList, setRenderList] = (0, import_react.useState)([]);
68
+ console.log(renderList, "renderListrenderList");
68
69
  const context = (0, import_useEngineContext.default)();
69
70
  const { interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
70
71
  const statusMap = {
@@ -126,6 +127,7 @@ var AddTimeModal = () => {
126
127
  }
127
128
  return arr.filter(Boolean);
128
129
  }, [(_f = (_e = (_d = state.service) == null ? void 0 : _d.cacheItem) == null ? void 0 : _e._extend) == null ? void 0 : _f.resource]);
130
+ console.log(currentResource, "currentResource");
129
131
  const getTimeUsableStatus = (time) => {
130
132
  var _a2, _b2;
131
133
  if (!((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend) || !currentResource.length) {
@@ -206,6 +208,7 @@ var AddTimeModal = () => {
206
208
  setLoading("list");
207
209
  const newList = await _getAddTimeProducts();
208
210
  let list = newList.map((d) => {
211
+ debugger;
209
212
  let isUsable = (0, import_utils2.isUsableProduct)(d.add_time, state.service.cacheItem);
210
213
  return {
211
214
  ...d,
@@ -168,9 +168,11 @@ var Resources = ({
168
168
  const getIsAutoAllocation = (id) => {
169
169
  return (0, import_utils2.getAutoAllocationStorage)(id);
170
170
  };
171
+ console.log("resourcesss");
171
172
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, data.map((item) => {
172
173
  var _a2;
173
174
  const cur = _value[item.form_id];
175
+ console.log(cur, "curcur");
174
176
  const errors = (cur || []).reduce((pre, d) => {
175
177
  return pre.concat((d == null ? void 0 : d.errors) || []);
176
178
  }, []);