@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
@@ -328,7 +328,7 @@ export var getServiceStartTimeAndEndTime = function getServiceStartTimeAndEndTim
328
328
  // 下一个商品的扩展参数
329
329
  var _extend = {
330
330
  // 时长: 当前商品时长 > 第一个时长
331
- duration: findNextDuration(cacheItem.duration, timeObj.durationSlicesBasedOnTime, cacheItem === null || cacheItem === void 0 || (_cacheItem$duration = cacheItem.duration) === null || _cacheItem$duration === void 0 ? void 0 : _cacheItem$duration.value)
331
+ duration: findNextDuration(cacheItem.duration, timeObj === null || timeObj === void 0 ? void 0 : timeObj.durationSlicesBasedOnTime, cacheItem === null || cacheItem === void 0 || (_cacheItem$duration = cacheItem.duration) === null || _cacheItem$duration === void 0 ? void 0 : _cacheItem$duration.value)
332
332
  };
333
333
 
334
334
  // 如果有上一个商品, 将上一个商品的某些参数 设置到新商品上
@@ -342,7 +342,8 @@ export var getServiceStartTimeAndEndTime = function getServiceStartTimeAndEndTim
342
342
  } else {
343
343
  // 如果上个服务商品的结束时间跨天, 那么设置为最后一个时间段, 不跨天则取上一个的结束时间
344
344
  if (dayjs(lastServerEndDate).isAfter(lastServerStartDate, "day")) {
345
- _extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1].value;
345
+ var _timeObj$timeSlices;
346
+ _extend.start_time = timeObj === null || timeObj === void 0 ? void 0 : timeObj.timeSlices[(timeObj === null || timeObj === void 0 || (_timeObj$timeSlices = timeObj.timeSlices) === null || _timeObj$timeSlices === void 0 ? void 0 : _timeObj$timeSlices.length) - 1].value;
346
347
  } else {
347
348
  _extend.start_time = lastServerEndDate.format("HH:mm");
348
349
  }
@@ -20,6 +20,9 @@ var Duration = function Duration(props) {
20
20
  startDate = props.startDate,
21
21
  timeObj = props.timeObj,
22
22
  resetProps = _objectWithoutProperties(props, _excluded);
23
+ var startDateStr = useMemo(function () {
24
+ return dayjs(startDate).format('YYYY-MM-DD HH:mm:ss');
25
+ }, [startDate]);
23
26
 
24
27
  /**
25
28
  * @title: 时间切片
@@ -57,7 +60,7 @@ var Duration = function Duration(props) {
57
60
  });
58
61
  }
59
62
  return durationSlicesBasedOnTime;
60
- }, [timeObj, slice, locale, duration, startDate, usableTime]);
63
+ }, [timeObj === null || timeObj === void 0 ? void 0 : timeObj.durationSlicesBasedOnTime, slice, locale, duration, startDateStr, usableTime === null || usableTime === void 0 ? void 0 : usableTime.end_at]);
61
64
  useEffect(function () {
62
65
  timeObjChange === null || timeObjChange === void 0 || timeObjChange(times);
63
66
  }, [times]);
@@ -72,6 +75,10 @@ var Duration = function Duration(props) {
72
75
  }, d[label]);
73
76
  });
74
77
  }, []);
75
- return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), renderOptions(times));
78
+ var options = useMemo(function () {
79
+ console.log('render form options');
80
+ return renderOptions(times);
81
+ }, [times]);
82
+ return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), options);
76
83
  };
77
84
  export default Duration;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SelectProps } from 'antd';
2
3
  interface HolderProps extends SelectProps {
3
4
  selectProps?: SelectProps;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SelectProps } from "antd";
2
3
  interface StartTimeProps extends SelectProps {
3
4
  locale?: string;
@@ -25,7 +25,7 @@ var StartTime = function StartTime(props) {
25
25
  return sliceDayIntoFiveMinutes(slice, locale);
26
26
  }, [slice, locale]);
27
27
  useEffect(function () {
28
- timeObjChange === null || timeObjChange === void 0 ? void 0 : timeObjChange(timeObj);
28
+ timeObjChange === null || timeObjChange === void 0 || timeObjChange(timeObj);
29
29
  }, [timeObj]);
30
30
  var renderOptions = useCallback(function (array) {
31
31
  var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "value";
@@ -37,6 +37,6 @@ var StartTime = function StartTime(props) {
37
37
  }, d[label]);
38
38
  });
39
39
  }, []);
40
- return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), renderOptions(timeObj.timeSlices));
40
+ return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), renderOptions(timeObj === null || timeObj === void 0 ? void 0 : timeObj.timeSlices));
41
41
  };
42
42
  export default StartTime;
@@ -670,7 +670,7 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
670
670
  if (isSession) {
671
671
  return getDays(cacheItem, 'minutes');
672
672
  }
673
- return findNextDuration(cacheItem.duration, timeObj.durationSlicesBasedOnTime, cacheItem === null || cacheItem === void 0 || (_cacheItem$duration = cacheItem.duration) === null || _cacheItem$duration === void 0 ? void 0 : _cacheItem$duration.value);
673
+ return findNextDuration(cacheItem.duration, timeObj === null || timeObj === void 0 ? void 0 : timeObj.durationSlicesBasedOnTime, cacheItem === null || cacheItem === void 0 || (_cacheItem$duration = cacheItem.duration) === null || _cacheItem$duration === void 0 ? void 0 : _cacheItem$duration.value);
674
674
  };
675
675
 
676
676
  // 获取上一个服务商品
@@ -694,7 +694,7 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
694
694
  } else {
695
695
  // 如果上个服务商品的结束时间跨天, 那么设置为最后一个时间段, 不跨天则取上一个的结束时间
696
696
  if (dayjs(lastServerEndDate).isAfter(lastServerStartDate, 'day')) {
697
- _extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1].value;
697
+ _extend.start_time = timeObj === null || timeObj === void 0 ? void 0 : timeObj.timeSlices[(timeObj === null || timeObj === void 0 ? void 0 : timeObj.timeSlices.length) - 1].value;
698
698
  } else {
699
699
  _extend.start_time = lastServerEndDate.format("HH:mm");
700
700
  }
@@ -704,7 +704,7 @@ export var getServerItemExtend = function getServerItemExtend(state, cacheItem,
704
704
  // _extend.resource = 0;
705
705
 
706
706
  var findNextSliceProps = {
707
- timeSlices: timeObj.timeSlices,
707
+ timeSlices: timeObj === null || timeObj === void 0 ? void 0 : timeObj.timeSlices,
708
708
  index: 0,
709
709
  date: ''
710
710
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  declare type CurrentDayProps = {
3
4
  onClose: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Products: () => JSX.Element;
3
4
  export default Products;
@@ -5,6 +5,7 @@ import { ProductCard } from '@pisell/materials';
5
5
  import useClearCart from "../../hooks/useClearCart";
6
6
  import { useContext } from "../../hooks/useContext";
7
7
  import useAddService from "../../hooks/useAddService";
8
+ import { useMemoizedFn, useTrackedEffect } from "ahooks";
8
9
  var Product = function Product(props) {
9
10
  var id = props.id,
10
11
  lists = props.lists,
@@ -35,10 +36,10 @@ var Product = function Product(props) {
35
36
  * @Author: WangHan
36
37
  * @Date: 2024-11-28 22:02
37
38
  */
38
- var handleChange = function handleChange(item, type, other) {
39
+ var handleChange = useMemoizedFn(function (item, type, other) {
39
40
  if (disabledEdit && !(other !== null && other !== void 0 && other.disabled)) return;
40
41
  onChange(item, type, other);
41
- };
42
+ });
42
43
  var productParams = useMemo(function () {
43
44
  return {
44
45
  isShowNote: isShowNote,
@@ -52,44 +53,50 @@ var Product = function Product(props) {
52
53
  isShowEditProduct: isShowEditProduct
53
54
  };
54
55
  }, [isShowNote, isShowPackageNote, disabledEdit, isShowChangeResource, isShowDelete, isShowHolder, isShowAddHolderButton, isShowChangeHolder, isShowEditProduct]);
55
- return /*#__PURE__*/React.createElement("div", {
56
- className: "pisell-lowcode__shopping-cart-content"
57
- }, clearCart, lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
58
- return /*#__PURE__*/React.createElement(ProductCard, _extends({
59
- key: item._id,
60
- dataSource: item,
61
- onAction: function onAction(e) {
62
- return _onAction === null || _onAction === void 0 ? void 0 : _onAction(e);
63
- },
64
- onDelete: function onDelete(e) {
65
- return handleChange(e, 'delete', item);
66
- },
67
- onNote: function onNote(e) {
68
- return handleChange(e, 'note', {
69
- note: e.note
70
- });
71
- },
72
- onLike: function onLike(e) {
73
- return handleChange(e, 'like', {
74
- like_status: e.like_status
75
- });
76
- },
77
- onEditProduct: function onEditProduct(e) {
78
- return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'edit_product');
79
- },
80
- onCard: function onCard(e) {
81
- return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'view');
82
- },
83
- onChangeResource: function onChangeResource(e) {
84
- return handleChange(item, 'change_resource', e);
85
- },
86
- onChangeHolder: function onChangeHolder(e) {
87
- return handleChange(item, 'change_holder', e);
88
- },
89
- onAddHolder: function onAddHolder(e) {
90
- return handleChange(item, 'add_holder', e);
91
- }
92
- }, productParams));
93
- }), !hideAddBtn && platform !== 'h5' && isAdd ? useAddService(id, 'more') : null);
56
+ useTrackedEffect(function (changes) {
57
+ console.log('Index of changed dependencies: ', changes);
58
+ }, [clearCart, lists, productParams, hideAddBtn, isAdd, platform]);
59
+ return useMemo(function () {
60
+ console.log('render cart');
61
+ return /*#__PURE__*/React.createElement("div", {
62
+ className: "pisell-lowcode__shopping-cart-content"
63
+ }, clearCart, lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
64
+ return /*#__PURE__*/React.createElement(ProductCard, _extends({
65
+ key: item._id,
66
+ dataSource: item,
67
+ onAction: function onAction(e) {
68
+ return _onAction === null || _onAction === void 0 ? void 0 : _onAction(e);
69
+ },
70
+ onDelete: function onDelete(e) {
71
+ return handleChange(e, 'delete', item);
72
+ },
73
+ onNote: function onNote(e) {
74
+ return handleChange(e, 'note', {
75
+ note: e.note
76
+ });
77
+ },
78
+ onLike: function onLike(e) {
79
+ return handleChange(e, 'like', {
80
+ like_status: e.like_status
81
+ });
82
+ },
83
+ onEditProduct: function onEditProduct(e) {
84
+ return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'edit_product');
85
+ },
86
+ onCard: function onCard(e) {
87
+ return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'view');
88
+ },
89
+ onChangeResource: function onChangeResource(e) {
90
+ return handleChange(item, 'change_resource', e);
91
+ },
92
+ onChangeHolder: function onChangeHolder(e) {
93
+ return handleChange(item, 'change_holder', e);
94
+ },
95
+ onAddHolder: function onAddHolder(e) {
96
+ return handleChange(item, 'add_holder', e);
97
+ }
98
+ }, productParams));
99
+ }), !hideAddBtn && platform !== 'h5' && isAdd ? useAddService(id, 'more') : null);
100
+ }, [clearCart, lists, productParams, hideAddBtn, isAdd, platform]);
94
101
  };
95
102
  export default Product;
@@ -51,23 +51,26 @@ var Cart = function Cart() {
51
51
  });
52
52
  });
53
53
  }, [carts, platform]);
54
- return /*#__PURE__*/React.createElement("div", {
55
- className: classNames('pisell-lowcode__shopping-cart')
56
- }, isProductList ? /*#__PURE__*/React.createElement(Product, {
57
- id: undefined,
58
- lists: state === null || state === void 0 ? void 0 : state.products
59
- }) : /*#__PURE__*/React.createElement(Collapse, _extends({
60
- items: cartsMap,
61
- showHeader: true,
62
- panelBackground: "#ffffff",
63
- collapsible: platform !== 'shop' ? 'disabled' : '-',
64
- accordion: platform === 'shop',
65
- onChange: function onChange(key) {
66
- updateState({
67
- activeKey: key
68
- });
69
- onActiveKey(key);
70
- }
71
- }, collapseParams)));
54
+ return useMemo(function () {
55
+ console.log('render cart 22222');
56
+ return /*#__PURE__*/React.createElement("div", {
57
+ className: classNames('pisell-lowcode__shopping-cart')
58
+ }, isProductList ? /*#__PURE__*/React.createElement(Product, {
59
+ id: undefined,
60
+ lists: state === null || state === void 0 ? void 0 : state.products
61
+ }) : /*#__PURE__*/React.createElement(Collapse, _extends({
62
+ items: cartsMap,
63
+ showHeader: true,
64
+ panelBackground: "#ffffff",
65
+ collapsible: platform !== 'shop' ? 'disabled' : '-',
66
+ accordion: platform === 'shop',
67
+ onChange: function onChange(key) {
68
+ updateState({
69
+ activeKey: key
70
+ });
71
+ onActiveKey(key);
72
+ }
73
+ }, collapseParams)));
74
+ }, [isProductList, cartsMap, platform, collapseParams, state === null || state === void 0 ? void 0 : state.products]);
72
75
  };
73
76
  export default Cart;