@pisell/private-materials 3.0.201 → 3.0.202

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 (129) 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/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -27
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -33
  11. package/es/components/booking/addons/model.d.ts +1 -1
  12. package/es/components/booking/components/footer/amount.js +5 -4
  13. package/es/components/booking/components/footer/utils.js +49 -29
  14. package/es/components/booking/forms/model.d.ts +1 -1
  15. package/es/components/booking/info/Provider.d.ts +0 -0
  16. package/es/components/booking/info/Provider.js +54 -0
  17. package/es/components/booking/info/clientVariant/vertical/index.js +93 -7
  18. package/es/components/booking/info/main.js +10 -9
  19. package/es/components/booking/info/pet/ChangePetModal/index.js +38 -23
  20. package/es/components/booking/info/service/addService/index.js +70 -99
  21. package/es/components/booking/info/service/addService/utils.d.ts +1 -0
  22. package/es/components/booking/info/service/addService/utils.js +55 -3
  23. package/es/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  24. package/es/components/booking/info/service/editService/BookingList/index.js +39 -0
  25. package/es/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  26. package/es/components/booking/info/service/editService/EditTabs/index.js +35 -0
  27. package/es/components/booking/info/service/editService/index.js +234 -142
  28. package/es/components/booking/info/service/serve.d.ts +10 -0
  29. package/es/components/booking/info/service/serve.js +28 -0
  30. package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  31. package/es/components/booking/info/service/serviceManager/distributeDiscount.js +55 -0
  32. package/es/components/booking/info/service/serviceManager/index.d.ts +20 -0
  33. package/es/components/booking/info/service/serviceManager/index.js +277 -0
  34. package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  35. package/es/components/booking/info/service/serviceManager/utils.js +0 -0
  36. package/es/components/booking/info/service2/Group/utils.d.ts +14 -0
  37. package/es/components/booking/info/service2/Group/utils.js +146 -0
  38. package/es/components/booking/info/service2/Lists.js +27 -33
  39. package/es/components/booking/info/service2/index.d.ts +4 -1
  40. package/es/components/booking/info/service2/index.js +5 -6
  41. package/es/components/booking/info/service2/status.js +1 -1
  42. package/es/components/booking/info/service2/utils.d.ts +95 -3
  43. package/es/components/booking/info/service2/utils.js +676 -52
  44. package/es/components/booking/info/utils.d.ts +11 -0
  45. package/es/components/booking/info/utils.js +24 -0
  46. package/es/components/booking/locales.d.ts +6 -0
  47. package/es/components/booking/locales.js +9 -3
  48. package/es/components/booking/model.d.ts +1 -0
  49. package/es/components/booking/notes/index.d.ts +1 -1
  50. package/es/components/booking/notes/model.d.ts +1 -1
  51. package/es/components/booking/payments/index.d.ts +1 -1
  52. package/es/components/booking/payments/model.d.ts +1 -1
  53. package/es/components/booking/utils.js +5 -4
  54. package/es/components/eftpos/hooks.d.ts +4 -4
  55. package/es/components/eftposPay/amount.d.ts +1 -1
  56. package/es/components/eftposPay/component/step/index.d.ts +6 -6
  57. package/es/components/eftposPay/component/step/step.d.ts +4 -4
  58. package/es/components/eftposPay/hooks.d.ts +1 -1
  59. package/es/components/eftposPay/store/index.d.ts +1 -1
  60. package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
  61. package/es/components/eftposPay/windcave/helper.d.ts +1 -1
  62. package/es/components/schedules/index.d.ts +1 -1
  63. package/es/components/schedules/model.d.ts +1 -1
  64. package/es/components/shoppingCart/components/Cart/Product.js +11 -39
  65. package/es/components/shoppingCart/components/Render/index.js +8 -7
  66. package/es/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  67. package/es/components/shoppingCart/hooks/useClearCart.js +10 -5
  68. package/es/components/shoppingCart/type.d.ts +1 -1
  69. package/es/components/shoppingCart/utils.js +2 -5
  70. package/lib/components/booking/addons/model.d.ts +1 -1
  71. package/lib/components/booking/components/footer/amount.js +4 -3
  72. package/lib/components/booking/components/footer/utils.js +28 -28
  73. package/lib/components/booking/forms/model.d.ts +1 -1
  74. package/lib/components/booking/info/Provider.d.ts +0 -0
  75. package/lib/components/booking/info/Provider.js +0 -0
  76. package/lib/components/booking/info/clientVariant/vertical/index.js +51 -1
  77. package/lib/components/booking/info/main.js +6 -5
  78. package/lib/components/booking/info/pet/ChangePetModal/index.js +33 -23
  79. package/lib/components/booking/info/service/addService/index.js +50 -92
  80. package/lib/components/booking/info/service/addService/utils.d.ts +1 -0
  81. package/lib/components/booking/info/service/addService/utils.js +27 -0
  82. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +5 -0
  83. package/lib/components/booking/info/service/editService/BookingList/index.js +55 -0
  84. package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +3 -0
  85. package/lib/components/booking/info/service/editService/EditTabs/index.js +75 -0
  86. package/lib/components/booking/info/service/editService/index.js +309 -234
  87. package/lib/components/booking/info/service/serve.d.ts +10 -0
  88. package/lib/components/booking/info/service/serve.js +7 -2
  89. package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +11 -0
  90. package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +70 -0
  91. package/lib/components/booking/info/service/serviceManager/index.d.ts +20 -0
  92. package/lib/components/booking/info/service/serviceManager/index.js +207 -0
  93. package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
  94. package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
  95. package/lib/components/booking/info/service2/Group/utils.d.ts +14 -0
  96. package/lib/components/booking/info/service2/Group/utils.js +142 -0
  97. package/lib/components/booking/info/service2/Lists.js +14 -12
  98. package/lib/components/booking/info/service2/index.d.ts +4 -1
  99. package/lib/components/booking/info/service2/index.js +5 -5
  100. package/lib/components/booking/info/service2/status.js +1 -1
  101. package/lib/components/booking/info/service2/utils.d.ts +95 -3
  102. package/lib/components/booking/info/service2/utils.js +401 -48
  103. package/lib/components/booking/info/utils.d.ts +11 -0
  104. package/lib/components/booking/info/utils.js +35 -0
  105. package/lib/components/booking/locales.d.ts +6 -0
  106. package/lib/components/booking/locales.js +9 -3
  107. package/lib/components/booking/model.d.ts +1 -0
  108. package/lib/components/booking/notes/index.d.ts +1 -1
  109. package/lib/components/booking/notes/model.d.ts +1 -1
  110. package/lib/components/booking/payments/index.d.ts +1 -1
  111. package/lib/components/booking/payments/model.d.ts +1 -1
  112. package/lib/components/booking/utils.js +3 -4
  113. package/lib/components/eftpos/hooks.d.ts +4 -4
  114. package/lib/components/eftposPay/amount.d.ts +1 -1
  115. package/lib/components/eftposPay/component/step/index.d.ts +6 -6
  116. package/lib/components/eftposPay/component/step/step.d.ts +4 -4
  117. package/lib/components/eftposPay/hooks.d.ts +1 -1
  118. package/lib/components/eftposPay/store/index.d.ts +1 -1
  119. package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
  120. package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
  121. package/lib/components/schedules/index.d.ts +1 -1
  122. package/lib/components/schedules/model.d.ts +1 -1
  123. package/lib/components/shoppingCart/components/Cart/Product.js +6 -22
  124. package/lib/components/shoppingCart/components/Render/index.js +6 -10
  125. package/lib/components/shoppingCart/components/SelectHolderModal/index.js +12 -4
  126. package/lib/components/shoppingCart/hooks/useClearCart.js +4 -9
  127. package/lib/components/shoppingCart/type.d.ts +1 -1
  128. package/lib/components/shoppingCart/utils.js +2 -8
  129. package/package.json +3 -3
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/components/booking/info/utils.ts
@@ -21,6 +31,7 @@ var utils_exports = {};
21
31
  __export(utils_exports, {
22
32
  formatServiceListByTime: () => formatServiceListByTime,
23
33
  getIsBundleOrCombination: () => getIsBundleOrCombination,
34
+ getMultiDayPrices: () => getMultiDayPrices,
24
35
  isBooking4Shop: () => isBooking4Shop,
25
36
  isDayBooking: () => isDayBooking,
26
37
  isInterval: () => isInterval,
@@ -28,6 +39,7 @@ __export(utils_exports, {
28
39
  uniqueByField: () => uniqueByField
29
40
  });
30
41
  module.exports = __toCommonJS(utils_exports);
42
+ var import_dayjs = __toESM(require("dayjs"));
31
43
  var getIsBundleOrCombination = (productDetail) => {
32
44
  var _a;
33
45
  if ((_a = productDetail == null ? void 0 : productDetail.bundle_group) == null ? void 0 : _a.length) {
@@ -57,6 +69,9 @@ var moveItemToFront = (arr, targetId) => {
57
69
  return arr;
58
70
  };
59
71
  var isInterval = (time1, time2, interval = 1e3) => {
72
+ if (time2 === time1) {
73
+ return false;
74
+ }
60
75
  return Math.abs(time2 - time1) < interval;
61
76
  };
62
77
  var formatServiceListByTime = (list) => {
@@ -87,6 +102,25 @@ var isBooking4Shop = (shopId, renderType) => {
87
102
  const booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726, 8191];
88
103
  return booking4Shops.includes(shopId);
89
104
  };
105
+ function generateDateRange(start, end) {
106
+ const dateRange = [];
107
+ let currentDate = (0, import_dayjs.default)(start);
108
+ while (currentDate.isBefore((0, import_dayjs.default)(end).add(1, "day"))) {
109
+ dateRange.push(currentDate.format("YYYY-MM-DD"));
110
+ currentDate = currentDate.add(1, "day");
111
+ }
112
+ return dateRange;
113
+ }
114
+ var getMultiDayPrices = (data) => {
115
+ const result = {};
116
+ data.forEach((entry) => {
117
+ const dateRange = generateDateRange(entry.start_date, entry.end_date);
118
+ dateRange.forEach((date) => {
119
+ result[date] = entry;
120
+ });
121
+ });
122
+ return result;
123
+ };
90
124
  var isDayBooking = (shopId) => {
91
125
  const dayBookingShops = [9];
92
126
  return dayBookingShops.includes(shopId);
@@ -95,6 +129,7 @@ var isDayBooking = (shopId) => {
95
129
  0 && (module.exports = {
96
130
  formatServiceListByTime,
97
131
  getIsBundleOrCombination,
132
+ getMultiDayPrices,
98
133
  isBooking4Shop,
99
134
  isDayBooking,
100
135
  isInterval,
@@ -238,6 +238,8 @@ declare const _default: {
238
238
  'pisell2.text.change.pet.content1': string;
239
239
  'pisell2.text.change.pet.confirm': string;
240
240
  'pisell2.text.change.pet.cancel': string;
241
+ 'pisell2.text.booking-list': string;
242
+ 'pisell2.text.edit-booking': string;
241
243
  };
242
244
  'zh-CN': {
243
245
  'pisell2.text.refunded-amount': string;
@@ -478,6 +480,8 @@ declare const _default: {
478
480
  'pisell2.text.change.pet.content1': string;
479
481
  'pisell2.text.change.pet.confirm': string;
480
482
  'pisell2.text.change.pet.cancel': string;
483
+ 'pisell2.text.booking-list': string;
484
+ 'pisell2.text.edit-booking': string;
481
485
  };
482
486
  'zh-HK': {
483
487
  'pisell2.text.refunded-amount': string;
@@ -718,6 +722,8 @@ declare const _default: {
718
722
  'pisell2.text.change.pet.content1': string;
719
723
  'pisell2.text.change.pet.confirm': string;
720
724
  'pisell2.text.change.pet.cancel': string;
725
+ 'pisell2.text.booking-list': string;
726
+ 'pisell2.text.edit-booking': string;
721
727
  };
722
728
  };
723
729
  export default _default;
@@ -293,7 +293,9 @@ var locales_default = {
293
293
  "pisell2.text.change.pet.content": "Selecting “Keep” will move the items to Open Items. Selecting “Discard” will clear all items under the holder’s name.",
294
294
  "pisell2.text.change.pet.content1": "Reservation-type items cannot be added to the Open Items cart and will be removed.",
295
295
  "pisell2.text.change.pet.confirm": "Keep (Add to open items)",
296
- "pisell2.text.change.pet.cancel": "Discard (Clear items)"
296
+ "pisell2.text.change.pet.cancel": "Discard (Clear items)",
297
+ "pisell2.text.booking-list": "List",
298
+ "pisell2.text.edit-booking": "Edit"
297
299
  },
298
300
  "zh-CN": {
299
301
  "pisell2.text.refunded-amount": "已退金额",
@@ -559,7 +561,9 @@ var locales_default = {
559
561
  "pisell2.text.change.pet.content": "选择“保留”将商品添加到未分配商品(公共购物车)中;选择“不保留”将清空该持有人名下的所有商品。",
560
562
  "pisell2.text.change.pet.content1": "预约类商品无法添加到公共购物车,将会被删除。",
561
563
  "pisell2.text.change.pet.confirm": "保留(添加到未分配中)",
562
- "pisell2.text.change.pet.cancel": "不保留(清空商品)"
564
+ "pisell2.text.change.pet.cancel": "不保留(清空商品)",
565
+ "pisell2.text.booking-list": "列表",
566
+ "pisell2.text.edit-booking": "编辑"
563
567
  },
564
568
  "zh-HK": {
565
569
  "pisell2.text.refunded-amount": "已退金額",
@@ -825,6 +829,8 @@ var locales_default = {
825
829
  "pisell2.text.change.pet.content": "選擇“保留”將商品添加到未分配商品(公共購物車)中;選擇“不保留”將清空該持有人名下的所有商品。",
826
830
  "pisell2.text.change.pet.content1": "預約類商品無法添加到公共購物車,將會被刪除。",
827
831
  "pisell2.text.change.pet.confirm": "保留(添加到未分配中)",
828
- "pisell2.text.change.pet.cancel": "不保留(清空商品)"
832
+ "pisell2.text.change.pet.cancel": "不保留(清空商品)",
833
+ "pisell2.text.booking-list": "列表",
834
+ "pisell2.text.edit-booking": "編輯"
829
835
  }
830
836
  };
@@ -99,6 +99,7 @@ export interface FormState {
99
99
  loading: boolean;
100
100
  isTerminalDayBookingPage?: boolean;
101
101
  activeCartId?: any[];
102
+ isDayBooking: boolean;
102
103
  }
103
104
  export declare const walkInData: {
104
105
  id: number;
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => any;
7
+ declare const Notes: any;
8
8
  export default Notes;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -5,5 +5,5 @@ export interface InfoProps {
5
5
  globalState: any;
6
6
  setGlobalState: any;
7
7
  }
8
- declare const Payments: (props: any) => any;
8
+ declare const Payments: any;
9
9
  export default Payments;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -561,15 +561,15 @@ var getServerItemExtend = (state, cacheItem, timeObj) => {
561
561
  ...cacheItem._extend
562
562
  };
563
563
  if (isDay) {
564
+ _extend.end_date = (0, import_dayjs.default)(_extend.start_date).add(_extend.duration, "day");
564
565
  const { start_date, end_date } = (0, import_utils2.formatDayDate)(_extend);
565
- _extend = { ..._extend, start_date, end_date };
566
+ _extend = { ..._extend, start_date, startDate: start_date, end_date, endDate: end_date };
566
567
  }
567
568
  return _extend;
568
569
  };
569
570
  var getProductTotalPrice = (item) => {
570
571
  var _a;
571
- let price = 0;
572
- price += Number(item._extend.price);
572
+ let price = Number(item._extend.price);
573
573
  let other = (_a = item._extend) == null ? void 0 : _a.other;
574
574
  if (other == null ? void 0 : other.product_variant_id) {
575
575
  price = Number(other == null ? void 0 : other.price);
@@ -584,7 +584,6 @@ var getProductTotalPrice = (item) => {
584
584
  return accumulator + Number(currentValue.price) * Number(currentValue.num);
585
585
  }, price);
586
586
  }
587
- price = price;
588
587
  return price;
589
588
  };
590
589
  var getDuration = (duration) => {
@@ -6,8 +6,8 @@ import { Eftpos } from './const';
6
6
  * @Date: 2024-08-20 13:23
7
7
  */
8
8
  export declare const usePairTerminalo: (type: Eftpos, params: {
9
- url?: string | undefined;
10
- version?: string | undefined;
9
+ url?: string;
10
+ version?: string;
11
11
  }) => ({ mid, tid, apiKey, posProductData, }: {
12
12
  mid: string;
13
13
  tid: string;
@@ -29,6 +29,6 @@ export declare const usePairTerminalo: (type: Eftpos, params: {
29
29
  * @Date: 2024-08-19 18:36
30
30
  */
31
31
  export declare const useTyro: (params: {
32
- url?: string | undefined;
33
- version?: string | undefined;
32
+ url?: string;
33
+ version?: string;
34
34
  }) => readonly [import("react").MutableRefObject<any>, boolean];
@@ -9,7 +9,7 @@ import { PosProps } from './const';
9
9
  */
10
10
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
11
11
  className?: string | undefined;
12
- onChange?: ((status: "page" | "success" | "fail", params?: string | {
12
+ onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
13
13
  [keys: string]: unknown;
14
14
  } | undefined, other?: any) => void) | undefined;
15
15
  onClose: () => void;
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { StatusType } from '../../const';
3
3
  declare const _default: (props: {
4
4
  status: StatusType;
5
- warn?: string | undefined;
6
- text?: string | undefined;
7
- tip?: string | undefined;
8
- loading?: string | undefined;
9
- success?: string | undefined;
10
- fail?: string | undefined;
5
+ warn?: string;
6
+ text?: string;
7
+ tip?: string;
8
+ loading?: string;
9
+ success?: string;
10
+ fail?: string;
11
11
  }) => React.JSX.Element;
12
12
  export default _default;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  declare const _default: (props: {
3
3
  status: string;
4
- pedding?: string | undefined;
5
- resolve?: string | undefined;
6
- reject?: string | undefined;
7
- className?: string | undefined;
4
+ pedding?: string;
5
+ resolve?: string;
6
+ reject?: string;
7
+ className?: string;
8
8
  }) => React.JSX.Element;
9
9
  export default _default;
@@ -30,5 +30,5 @@ export declare const useStoreRef: <T extends {
30
30
  * @Date: 2024-08-12 11:54
31
31
  */
32
32
  export declare const useFail: (index: number) => (res: {
33
- code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | "701008" | "701009" | "701010" | undefined;
33
+ code?: `${PayStatus}`;
34
34
  }, isMark?: boolean) => void;
@@ -297,7 +297,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "payo" | "tyro" | "windcave" | "stripe" | undefined;
300
+ eftpos?: "tyro" | "windcave" | "payo" | "stripe" | undefined;
301
301
  action?: "amount" | "deviceList" | "pay" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
@@ -9,6 +9,6 @@
9
9
  * @Date: 2024-08-19 18:36
10
10
  */
11
11
  export declare const useTyro: (params: {
12
- url?: string | undefined;
13
- version?: string | undefined;
12
+ url?: string;
13
+ version?: string;
14
14
  }) => readonly [import("react").MutableRefObject<any>, boolean];
@@ -9,7 +9,7 @@ import XhrTimer from './timer';
9
9
  * @Date: 2024-08-12 10:29
10
10
  */
11
11
  export declare const useFail: () => (res: {
12
- code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | "701008" | "701009" | "701010" | undefined;
12
+ code?: `${PayStatus}`;
13
13
  }, isMark?: boolean) => void;
14
14
  /**
15
15
  * @title: 轮询 check 接口
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => any;
2
+ declare const Schedules: any;
3
3
  export default Schedules;
@@ -69,7 +69,7 @@ export interface FormState {
69
69
  };
70
70
  setGlobalState: Function | null;
71
71
  }
72
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
72
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
73
73
  state: FormState;
74
74
  } & {
75
75
  dispatch: (params: {
@@ -35,33 +35,17 @@ module.exports = __toCommonJS(Product_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_materials = require("@pisell/materials");
37
37
  var import_useClearCart = __toESM(require("../../hooks/useClearCart"));
38
- var import_utils = require("../../utils");
39
38
  var import_useContext = require("../../hooks/useContext");
40
39
  var import_useAddService = __toESM(require("../../hooks/useAddService"));
41
40
  var Product = (props) => {
42
41
  const { id, lists } = props;
43
- const { state, updateState, onAction, onChange, onCard } = (0, import_useContext.useContext)();
42
+ const { state, onAction, onChange } = (0, import_useContext.useContext)();
44
43
  const { disabledEdit, isShowPackageNote, isShowNote, hideAddBtn } = state;
45
44
  const clearCart = (0, import_useClearCart.default)(id);
46
- const handleChange = (item, type) => {
45
+ const handleChange = (item, type, other) => {
47
46
  if (disabledEdit)
48
47
  return;
49
- let products = [...state.products];
50
- if (type === "delete") {
51
- products = products.filter((product) => product._id !== item._id);
52
- } else {
53
- products = products.map((product) => {
54
- if (product._id === item._id) {
55
- return {
56
- ...product,
57
- ...item
58
- };
59
- }
60
- return product;
61
- });
62
- }
63
- updateState((0, import_utils.updateProduct)(state, products));
64
- onChange == null ? void 0 : onChange(products);
48
+ onChange(item, type, other);
65
49
  };
66
50
  const productParams = (0, import_react.useMemo)(() => {
67
51
  return {
@@ -78,9 +62,9 @@ var Product = (props) => {
78
62
  dataSource: item,
79
63
  onAction: (e) => onAction == null ? void 0 : onAction(e),
80
64
  onDelete: (e) => handleChange(e, "delete"),
81
- onNote: (e) => handleChange(e),
82
- onLike: (e) => handleChange(e),
83
- onCard: (e) => onCard == null ? void 0 : onCard(e),
65
+ onNote: (e) => handleChange(e, "note", { note: e.note }),
66
+ onLike: (e) => handleChange(e, "like", { like_status: e.like_status }),
67
+ onCard: (e) => handleChange == null ? void 0 : handleChange(e, "view"),
84
68
  ...productParams
85
69
  }
86
70
  );
@@ -46,15 +46,17 @@ var Content = () => {
46
46
  const [pet, setPet] = (0, import_react.useState)([]);
47
47
  const { isEmpty, className, holders, products, isEdit } = state;
48
48
  (0, import_react.useEffect)(() => {
49
- var _a, _b, _c;
49
+ var _a, _b, _c, _d;
50
50
  let _holders = holders == null ? void 0 : holders.filter((item) => (item == null ? void 0 : item.key) > 0);
51
51
  console.log(isEdit, products, _holders, pet, "wh_holder");
52
52
  if ((_holders == null ? void 0 : _holders.length) && !(pet == null ? void 0 : pet.length) && (products == null ? void 0 : products.length) && !isEdit) {
53
53
  if (_holders.length === 1) {
54
- const _products = (0, import_utils.formatService)(products, (_a = _holders[0]) == null ? void 0 : _a.key);
54
+ onChange(products, "update_holders", (_a = _holders[0]) == null ? void 0 : _a.key);
55
+ return;
56
+ const _products = (0, import_utils.formatService)(products, (_b = _holders[0]) == null ? void 0 : _b.key);
55
57
  onChange(_products);
56
58
  } else {
57
- (_c = (_b = selectPetRef.current) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b, {
59
+ (_d = (_c = selectPetRef.current) == null ? void 0 : _c.open) == null ? void 0 : _d.call(_c, {
58
60
  products,
59
61
  holders
60
62
  });
@@ -68,12 +70,6 @@ var Content = () => {
68
70
  className: (0, import_classnames.default)("pisell-lowcode__shopping-cart-wrap", className)
69
71
  },
70
72
  isEmpty ? /* @__PURE__ */ import_react.default.createElement(import_Empty.default, null) : /* @__PURE__ */ import_react.default.createElement(import_Cart.default, null)
71
- ), /* @__PURE__ */ import_react.default.createElement(
72
- import_SelectHolderModal.default,
73
- {
74
- ref: selectPetRef,
75
- onChange: (e) => onChange(e)
76
- }
77
- ));
73
+ ), /* @__PURE__ */ import_react.default.createElement(import_SelectHolderModal.default, { ref: selectPetRef, onChange }));
78
74
  };
79
75
  var Render_default = Content;
@@ -54,7 +54,7 @@ var SelectPetModal = ({ onChange }, ref) => {
54
54
  });
55
55
  const handleChange = (e, index) => {
56
56
  const _lists = [...params == null ? void 0 : params.service];
57
- _lists[index]._extend.holder_id = e;
57
+ _lists[index].holder_id = e;
58
58
  console.log(e, index, _lists, "wh79876");
59
59
  setParams({ ...params, service: _lists });
60
60
  };
@@ -75,13 +75,14 @@ var SelectPetModal = ({ onChange }, ref) => {
75
75
  className: "pisell-lowcode__booking-select-pet-item",
76
76
  key: item._id
77
77
  },
78
- /* @__PURE__ */ import_react.default.createElement("span", null, " ", item.title),
78
+ /* @__PURE__ */ import_react.default.createElement("span", null, " ", item.name),
79
79
  /* @__PURE__ */ import_react.default.createElement(
80
80
  import_antd.Select,
81
81
  {
82
82
  defaultValue: (_a2 = options[0]) == null ? void 0 : _a2.value,
83
83
  onChange: (e) => handleChange(e, index),
84
- options
84
+ options,
85
+ popupMatchSelectWidth: false
85
86
  }
86
87
  )
87
88
  );
@@ -91,7 +92,14 @@ var SelectPetModal = ({ onChange }, ref) => {
91
92
  setOpen(false);
92
93
  };
93
94
  const handleOk = () => {
94
- onChange(params == null ? void 0 : params.service);
95
+ const { service } = params;
96
+ const holders = service == null ? void 0 : service.map((item) => {
97
+ return {
98
+ _id: item._id,
99
+ holder_id: item.holder_id
100
+ };
101
+ });
102
+ onChange(service, "update_holders", holders);
95
103
  handleCancel();
96
104
  };
97
105
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
@@ -37,7 +37,6 @@ var import_classnames = __toESM(require("classnames"));
37
37
  var import_materials = require("@pisell/materials");
38
38
  var import_useContext = require("./useContext");
39
39
  var import_utils = require("@pisell/utils");
40
- var import_utils2 = require("../utils");
41
40
  var useClearCart = (key) => {
42
41
  const { state, updateState, onChange } = (0, import_useContext.useContext)();
43
42
  const { isProductList, disabledEdit } = state;
@@ -46,15 +45,11 @@ var useClearCart = (key) => {
46
45
  if (typeof key === "undefined") {
47
46
  products = [];
48
47
  } else {
49
- products = products.filter(
50
- (item) => {
51
- var _a;
52
- return ((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.holder_id) !== key;
53
- }
54
- );
48
+ const ids = products == null ? void 0 : products.map((item) => item == null ? void 0 : item._id);
49
+ onChange(ids, "delete_holders", key);
50
+ return;
51
+ products = products.filter((item) => (item == null ? void 0 : item.holder_id) !== key);
55
52
  }
56
- updateState((0, import_utils2.updateProduct)(state, products));
57
- onChange(products);
58
53
  };
59
54
  return !disabledEdit ? /* @__PURE__ */ import_react.default.createElement(
60
55
  "span",
@@ -17,7 +17,7 @@ export interface shoppingCartProps {
17
17
  defaultActiveKey?: string[] | number[];
18
18
  className?: string;
19
19
  onCard?: (e: any) => void;
20
- onChange?: (e: any) => void;
20
+ onChange?: (items: any, type?: string, other?: any) => void;
21
21
  onAddProduct?: (e?: any) => void;
22
22
  onActiveKey?: (e: any) => void;
23
23
  isShowImage?: boolean;
@@ -33,10 +33,7 @@ var formatCartList = (state) => {
33
33
  return {
34
34
  ...holder,
35
35
  products: products == null ? void 0 : products.filter(
36
- (product) => {
37
- var _a;
38
- return ((_a = product == null ? void 0 : product._extend) == null ? void 0 : _a.holder_id) === (holder == null ? void 0 : holder.key);
39
- }
36
+ (product) => (product == null ? void 0 : product.holder_id) === (holder == null ? void 0 : holder.key)
40
37
  )
41
38
  };
42
39
  });
@@ -74,10 +71,7 @@ var formatService = (service, id) => {
74
71
  return service.map((item) => {
75
72
  return {
76
73
  ...item,
77
- _extend: {
78
- ...item._extend || {},
79
- holder_id: id
80
- }
74
+ holder_id: id
81
75
  };
82
76
  });
83
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.201",
3
+ "version": "3.0.202",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,9 +60,9 @@
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "1.0.42",
63
+ "@pisell/materials": "3.0.62",
63
64
  "@pisell/icon": "0.0.11",
64
- "@pisell/date-picker": "3.0.1",
65
- "@pisell/materials": "3.0.61"
65
+ "@pisell/date-picker": "3.0.1"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",