@pisell/private-materials 3.0.16 → 3.0.17

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 (93) 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 +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/addons/index.js +148 -32
  13. package/es/components/booking/addons/model.d.ts +1 -2
  14. package/es/components/booking/components/TabProduct/selectProductItem/index.js +21 -8
  15. package/es/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
  16. package/es/components/booking/components/collapsibleList/index.d.ts +11 -0
  17. package/es/components/booking/components/collapsibleList/index.js +99 -0
  18. package/es/components/booking/components/collapsibleList/index.less +61 -0
  19. package/es/components/booking/components/collapsibleList/utils.d.ts +2 -0
  20. package/es/components/booking/components/collapsibleList/utils.js +21 -0
  21. package/es/components/booking/components/footer/amount.js +9 -10
  22. package/es/components/booking/components/footer/utils.d.ts +18 -0
  23. package/es/components/booking/components/footer/utils.js +76 -4
  24. package/es/components/booking/forms/forms.d.ts +1 -1
  25. package/es/components/booking/forms/index.d.ts +1 -1
  26. package/es/components/booking/forms/model.d.ts +1 -2
  27. package/es/components/booking/forms/single/index.js +16 -82
  28. package/es/components/booking/index.d.ts +1 -1
  29. package/es/components/booking/info/index.d.ts +1 -1
  30. package/es/components/booking/info/model.d.ts +1 -2
  31. package/es/components/booking/info/service/addService/index.js +47 -24
  32. package/es/components/booking/info/service/editService/index.js +49 -24
  33. package/es/components/booking/info/service/editService/index.less +21 -0
  34. package/es/components/booking/info/service/index.d.ts +2 -2
  35. package/es/components/booking/info/service/index.js +5 -129
  36. package/es/components/booking/info/service/index.less +0 -100
  37. package/es/components/booking/info/service/serviceItem/index.d.ts +4 -0
  38. package/es/components/booking/info/service/serviceItem/index.js +63 -0
  39. package/es/components/booking/info/service/serviceItem/index.less +97 -0
  40. package/es/components/booking/info/service/serviceList/index.d.ts +4 -0
  41. package/es/components/booking/info/service/serviceList/index.js +105 -0
  42. package/es/components/booking/info/service/serviceList/index.less +0 -0
  43. package/es/components/booking/model.d.ts +1 -2
  44. package/es/components/booking/notes/index.d.ts +1 -1
  45. package/es/components/booking/notes/model.d.ts +1 -2
  46. package/es/components/booking/payments/index.d.ts +1 -1
  47. package/es/components/booking/payments/model.d.ts +1 -2
  48. package/es/components/booking/utils.d.ts +1 -0
  49. package/es/components/booking/utils.js +15 -0
  50. package/es/components/schedules/index.d.ts +1 -1
  51. package/es/components/schedules/model.d.ts +1 -2
  52. package/lib/components/booking/addons/index.d.ts +1 -1
  53. package/lib/components/booking/addons/index.js +159 -35
  54. package/lib/components/booking/addons/model.d.ts +1 -2
  55. package/lib/components/booking/components/TabProduct/selectProductItem/index.js +33 -8
  56. package/lib/components/booking/components/TabProduct/selectProductItem/index.less +34 -27
  57. package/lib/components/booking/components/collapsibleList/index.d.ts +11 -0
  58. package/lib/components/booking/components/collapsibleList/index.js +94 -0
  59. package/lib/components/booking/components/collapsibleList/index.less +61 -0
  60. package/lib/components/booking/components/collapsibleList/utils.d.ts +2 -0
  61. package/lib/components/booking/components/collapsibleList/utils.js +46 -0
  62. package/lib/components/booking/components/footer/amount.js +9 -10
  63. package/lib/components/booking/components/footer/utils.d.ts +18 -0
  64. package/lib/components/booking/components/footer/utils.js +46 -7
  65. package/lib/components/booking/forms/forms.d.ts +1 -1
  66. package/lib/components/booking/forms/index.d.ts +1 -1
  67. package/lib/components/booking/forms/model.d.ts +1 -2
  68. package/lib/components/booking/forms/single/index.js +12 -48
  69. package/lib/components/booking/index.d.ts +1 -1
  70. package/lib/components/booking/info/index.d.ts +1 -1
  71. package/lib/components/booking/info/model.d.ts +1 -2
  72. package/lib/components/booking/info/service/addService/index.js +57 -36
  73. package/lib/components/booking/info/service/editService/index.js +76 -56
  74. package/lib/components/booking/info/service/editService/index.less +21 -0
  75. package/lib/components/booking/info/service/index.d.ts +2 -2
  76. package/lib/components/booking/info/service/index.js +4 -112
  77. package/lib/components/booking/info/service/index.less +0 -100
  78. package/lib/components/booking/info/service/serviceItem/index.d.ts +4 -0
  79. package/lib/components/booking/info/service/serviceItem/index.js +98 -0
  80. package/lib/components/booking/info/service/serviceItem/index.less +97 -0
  81. package/lib/components/booking/info/service/serviceList/index.d.ts +4 -0
  82. package/lib/components/booking/info/service/serviceList/index.js +129 -0
  83. package/lib/components/booking/info/service/serviceList/index.less +0 -0
  84. package/lib/components/booking/model.d.ts +1 -2
  85. package/lib/components/booking/notes/index.d.ts +1 -1
  86. package/lib/components/booking/notes/model.d.ts +1 -2
  87. package/lib/components/booking/payments/index.d.ts +1 -1
  88. package/lib/components/booking/payments/model.d.ts +1 -2
  89. package/lib/components/booking/utils.d.ts +1 -0
  90. package/lib/components/booking/utils.js +15 -0
  91. package/lib/components/schedules/index.d.ts +1 -1
  92. package/lib/components/schedules/model.d.ts +1 -2
  93. package/package.json +1 -1
@@ -43,27 +43,59 @@ var import_selectProductItem = __toESM(require("../components/TabProduct/selectP
43
43
  var import_TabProduct = __toESM(require("../components/TabProduct"));
44
44
  var import_emptyBooking = __toESM(require("../components/emptyBooking"));
45
45
  var import_footer = __toESM(require("../components/footer"));
46
- var import_utils = require("../utils");
47
- var import_utils2 = require("@pisell/utils");
46
+ var import_utils = require("../components/footer/utils");
47
+ var import_utils2 = require("../utils");
48
+ var import_utils3 = require("@pisell/utils");
48
49
  var import_index = require("./index.less");
49
50
  var formatProducts = (values) => {
50
51
  let arr = [];
51
52
  arr = values.map((item) => {
53
+ var _a, _b, _c;
52
54
  return {
53
55
  order_detail_id: item.order_detail_id || 0,
54
- num: item.quantity,
55
- price: item.price,
56
+ num: item._extend.quantity,
57
+ price: item._extend.price,
56
58
  product_id: item.id,
57
59
  discount_amount: 0,
58
60
  product_discount_reason: "",
59
61
  is_charge_tax: item.is_charge_tax,
60
62
  note: "",
61
63
  discountway: "num",
62
- discount_type: "discount"
64
+ discount_type: "discount",
65
+ bundle_edit: (_a = item._extend) == null ? void 0 : _a.bundle_edit,
66
+ product_bundle: (0, import_utils.formatProductBundle)((_c = (_b = item._extend) == null ? void 0 : _b.other) == null ? void 0 : _c.bundle)
63
67
  };
64
68
  });
65
69
  return arr;
66
70
  };
71
+ var restoreProductOtherData = (data) => {
72
+ let detail = data;
73
+ return {
74
+ product_id: detail.product_id,
75
+ option: [],
76
+ bundle: (detail.product_bundle || []).map((bundleItem) => {
77
+ return {
78
+ ...bundleItem,
79
+ title: bundleItem.bundle_title,
80
+ group_id: bundleItem.bundle_group_id,
81
+ id: bundleItem.bundle_id,
82
+ product_id: bundleItem.bundle_product_id,
83
+ bundle_variant_id: bundleItem.bundle_variant_id,
84
+ quantity: bundleItem.num,
85
+ option: bundleItem.option.map((optionItem) => {
86
+ return {
87
+ ...optionItem,
88
+ name: optionItem.name["auto"],
89
+ quantity: bundleItem.num,
90
+ product_option_item_id: optionItem.option_group_item_id
91
+ };
92
+ })
93
+ };
94
+ }),
95
+ product_variant_id: 0,
96
+ quantity: Number(detail.product_quantity)
97
+ };
98
+ };
67
99
  var formatProductValues = (data) => {
68
100
  return data.map((d) => {
69
101
  return {
@@ -72,7 +104,15 @@ var formatProductValues = (data) => {
72
104
  title: d.product_title,
73
105
  quantity: d.product_quantity,
74
106
  cover: d.product_cover,
75
- price: Number(d.selling_price),
107
+ price: Number(d.source_product_price),
108
+ _extend: {
109
+ total: Number(d.selling_price),
110
+ payment_price: Number(d.payment_price),
111
+ price: Number(d.source_product_price),
112
+ quantity: d.product_quantity,
113
+ bundle_edit: 0,
114
+ other: restoreProductOtherData(d)
115
+ },
76
116
  payment_price: Number(d.payment_price)
77
117
  };
78
118
  });
@@ -125,12 +165,17 @@ var Addons = (0, import_model.Provider)((props) => {
125
165
  let data = await state.apis.getProducts({
126
166
  skip: 1,
127
167
  num: 500,
128
- extension_type: ["normal"],
168
+ extension_type: [
169
+ "normal",
170
+ "product_bundle",
171
+ "product_package_ticket",
172
+ "ticket"
173
+ ],
129
174
  with: ["category"],
130
- include_formula: "no",
131
- include_bundle: "no",
132
- include_option: "no",
133
- include_variant: "no",
175
+ // include_formula: "no",
176
+ // include_bundle: "no",
177
+ // include_option: "no",
178
+ // include_variant: "no",
134
179
  open_quotation: 1,
135
180
  with_schedule: 0
136
181
  });
@@ -143,26 +188,52 @@ var Addons = (0, import_model.Provider)((props) => {
143
188
  };
144
189
  const handleAddProduct = (item) => {
145
190
  let _list = [...state.addons.value];
146
- let _item = _list.find((d) => d.id === item.id);
147
- if (_item) {
148
- _item.quantity = _item.quantity + 1;
149
- } else {
150
- _list.push({
151
- ...item,
152
- quantity: 1
153
- });
154
- }
155
- dispatch({
156
- type: "setAddons",
157
- payload: {
158
- value: _list,
159
- showModal: false,
160
- // 编辑态
161
- edit: true
191
+ state.action({
192
+ type: "pisell1.handleOpenProductModal",
193
+ data: {
194
+ id: item.id,
195
+ date: state.date.value.format("YYYY-MM-DD"),
196
+ showConfig: {
197
+ option: false,
198
+ session: false,
199
+ variant: false,
200
+ package: true
201
+ }
202
+ },
203
+ callback: (e) => {
204
+ let product = {
205
+ ...item,
206
+ _id: (0, import_utils3.getUniqueId)(),
207
+ _key: e.key,
208
+ _extend: {
209
+ price: item.price,
210
+ other: e,
211
+ quantity: 1
212
+ },
213
+ quantity: 1
214
+ };
215
+ let _total = (0, import_utils2.getProductTotalPrice)(product);
216
+ product._extend.total = _total;
217
+ let _item = _list.find((d) => d._extend.other.key === e.key);
218
+ if (_item) {
219
+ _item._extend.quantity = _item.quantity + 1;
220
+ } else {
221
+ _list.push(product);
222
+ }
223
+ dispatch({
224
+ type: "setAddons",
225
+ payload: {
226
+ value: _list,
227
+ showModal: false,
228
+ // 编辑态
229
+ edit: true
230
+ }
231
+ });
162
232
  }
163
233
  });
164
234
  };
165
235
  const onChangeQuantity = (e, item) => {
236
+ var _a2;
166
237
  let quantity = e.target.value;
167
238
  let _list = [...state.addons.value];
168
239
  if (quantity == 0) {
@@ -170,8 +241,16 @@ var Addons = (0, import_model.Provider)((props) => {
170
241
  } else {
171
242
  let _item = {
172
243
  ...item,
173
- quantity: Number(e.target.value)
244
+ _extend: {
245
+ ...item._extend,
246
+ quantity: Number(e.target.value)
247
+ }
174
248
  };
249
+ let _total = (0, import_utils2.getProductTotalPrice)(_item);
250
+ _item._extend.total = _total;
251
+ if (((_a2 = _item._extend) == null ? void 0 : _a2.bundle_edit) !== void 0) {
252
+ _item._extend.bundle_edit = 1;
253
+ }
175
254
  _list = _list.map((d) => d.id === item.id ? _item : d);
176
255
  }
177
256
  dispatch({
@@ -188,7 +267,7 @@ var Addons = (0, import_model.Provider)((props) => {
188
267
  const isIncludes = (str) => {
189
268
  return str.toLowerCase().indexOf(search.toLowerCase()) !== -1;
190
269
  };
191
- return (0, import_utils.formatProductListByCategory)(
270
+ return (0, import_utils2.formatProductListByCategory)(
192
271
  _list,
193
272
  search ? (item) => isIncludes(item.title) : void 0
194
273
  );
@@ -222,7 +301,7 @@ var Addons = (0, import_model.Provider)((props) => {
222
301
  disabled: loading,
223
302
  onClick: handleOpenAdd
224
303
  },
225
- import_utils2.locales.getText("pisell2.text.add")
304
+ import_utils3.locales.getText("pisell2.text.add")
226
305
  )
227
306
  ];
228
307
  return arr;
@@ -233,14 +312,58 @@ var Addons = (0, import_model.Provider)((props) => {
233
312
  }
234
313
  return /* @__PURE__ */ import_react.default.createElement(import_footer.default, { state, buttons: _footer, source: "addons" });
235
314
  }, [state, _footer]);
315
+ const editProductDetail = (item) => {
316
+ console.log("item._extend.other", item._extend.other);
317
+ state.action({
318
+ type: "pisell1.handleOpenProductModal",
319
+ data: {
320
+ id: item.id,
321
+ date: state.date.value.format("YYYY-MM-DD"),
322
+ showConfig: {
323
+ option: false,
324
+ session: false,
325
+ variant: false,
326
+ package: true
327
+ },
328
+ value: item._extend.other
329
+ },
330
+ callback: (e) => {
331
+ var _a2;
332
+ let product = {
333
+ ...item,
334
+ _extend: {
335
+ ...item._extend,
336
+ other: e
337
+ }
338
+ };
339
+ if (((_a2 = product._extend) == null ? void 0 : _a2.bundle_edit) !== void 0) {
340
+ product._extend.bundle_edit = 1;
341
+ }
342
+ let _total = (0, import_utils2.getProductTotalPrice)(product);
343
+ product._extend.total = _total;
344
+ let _list = [...state.addons.value];
345
+ console.log("cacheItem", product);
346
+ _list = _list.map((d) => d._id === product._id ? product : d);
347
+ dispatch({
348
+ type: "setAddons",
349
+ payload: {
350
+ value: _list,
351
+ showModal: false,
352
+ // 编辑态
353
+ edit: true
354
+ }
355
+ });
356
+ }
357
+ });
358
+ };
236
359
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
237
360
  import_tabPane.default,
238
361
  {
239
362
  loading,
240
- header: import_utils2.locales.getText("pisell2.text.addons"),
363
+ header: import_utils3.locales.getText("pisell2.text.addons"),
241
364
  footer
242
365
  },
243
- !state.bookingId ? /* @__PURE__ */ import_react.default.createElement(import_emptyBooking.default, null) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, state.addons.value.length ? /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { margin: "0 -16px" } }, state.addons.value.map((d) => {
366
+ !state.bookingId ? /* @__PURE__ */ import_react.default.createElement(import_emptyBooking.default, null) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, state.addons.value.length ? /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { margin: "0 -32px" } }, state.addons.value.map((d) => {
244
367
  return /* @__PURE__ */ import_react.default.createElement(
245
368
  import_selectProductItem.default,
246
369
  {
@@ -248,6 +371,7 @@ var Addons = (0, import_model.Provider)((props) => {
248
371
  item: d,
249
372
  key: d.id,
250
373
  amountSymbol: state.amountSymbol,
374
+ onClick: editProductDetail,
251
375
  onChangeQuantity: (e) => {
252
376
  onChangeQuantity(e, d);
253
377
  }
@@ -256,13 +380,13 @@ var Addons = (0, import_model.Provider)((props) => {
256
380
  })) : /* @__PURE__ */ import_react.default.createElement(
257
381
  import_emptyBooking.default,
258
382
  {
259
- description: import_utils2.locales.getText("pisell1.text.no-addons")
383
+ description: import_utils3.locales.getText("pisell1.text.no-addons")
260
384
  }
261
385
  ), /* @__PURE__ */ import_react.default.createElement(
262
386
  import_drawer.default,
263
387
  {
264
388
  open: state.addons.showModal,
265
- title: import_utils2.locales.getText("pisell2.text.addons"),
389
+ title: import_utils3.locales.getText("pisell2.text.addons"),
266
390
  onClose: () => {
267
391
  dispatch({
268
392
  type: "setAddons",
@@ -277,7 +401,7 @@ var Addons = (0, import_model.Provider)((props) => {
277
401
  {
278
402
  prefix: /* @__PURE__ */ import_react.default.createElement(import_SearchLg.default, null),
279
403
  style: { marginTop: 16, height: 44 },
280
- placeholder: import_utils2.locales.getText("pisell2.text.search"),
404
+ placeholder: import_utils3.locales.getText("pisell2.text.search"),
281
405
  allowClear: true,
282
406
  value: search,
283
407
  onChange: (e) => {
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -36,6 +36,8 @@ var import_react = __toESM(require("react"));
36
36
  var import_utils = require("@pisell/utils");
37
37
  var import_classnames = __toESM(require("classnames"));
38
38
  var import_browserSelect = __toESM(require("../../browserSelect"));
39
+ var import_collapsibleList = __toESM(require("../../collapsibleList"));
40
+ var import_utils2 = require("../../collapsibleList/utils");
39
41
  var import_index = require("./index.less");
40
42
  var SelectProductItem = ({
41
43
  item,
@@ -46,6 +48,7 @@ var SelectProductItem = ({
46
48
  className,
47
49
  disabled
48
50
  }) => {
51
+ var _a, _b, _c, _d;
49
52
  const list = (0, import_utils.createArray)(100, (d, i) => {
50
53
  let item2 = {
51
54
  label: i,
@@ -72,16 +75,38 @@ var SelectProductItem = ({
72
75
  className: "server-select-product-cover"
73
76
  }
74
77
  ) : /* @__PURE__ */ import_react.default.createElement("div", null),
75
- /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-content-left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-subtitle" }, item.subtitle || ""), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-quantity" }, /* @__PURE__ */ import_react.default.createElement(
76
- import_browserSelect.default,
78
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-subtitle" }, item.subtitle || ""), (((_b = (_a = item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) || []).length ? /* @__PURE__ */ import_react.default.createElement(
79
+ import_collapsibleList.default,
77
80
  {
78
- options: list,
79
- value: item.quantity,
80
- onChange: onChangeQuantity,
81
- style: { minWidth: 50 },
82
- disabled
81
+ style: { width: "100%" },
82
+ list: ((_d = (_c = item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.bundle) || [],
83
+ renderItem: (item2) => (0, import_utils2.renderBundles)(item2, amountSymbol)
83
84
  }
84
- ))), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-content-right" }, (0, import_utils.formatAmount)(item.price * item.quantity, 2, amountSymbol)))
85
+ ) : null, /* @__PURE__ */ import_react.default.createElement(
86
+ "div",
87
+ {
88
+ className: "server-select-product-quantity",
89
+ onClick: (e) => {
90
+ e.preventDefault();
91
+ e.stopPropagation();
92
+ }
93
+ },
94
+ /* @__PURE__ */ import_react.default.createElement(
95
+ import_browserSelect.default,
96
+ {
97
+ options: list,
98
+ value: item._extend.quantity,
99
+ onChange: onChangeQuantity,
100
+ style: { minWidth: 50 },
101
+ disabled
102
+ }
103
+ ),
104
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-total" }, (0, import_utils.formatAmount)(
105
+ item._extend.total * item._extend.quantity,
106
+ 2,
107
+ amountSymbol
108
+ ))
109
+ ))
85
110
  );
86
111
  };
87
112
  var selectProductItem_default = SelectProductItem;
@@ -3,7 +3,7 @@
3
3
  padding: 16px;
4
4
  position: relative;
5
5
  display: flex;
6
- align-items: center;
6
+ align-items: flex-start;
7
7
  gap: 12px;
8
8
 
9
9
  &::before {
@@ -33,42 +33,49 @@
33
33
  .server-select-product-content {
34
34
  flex: 1;
35
35
  display: flex;
36
- align-items: center;
36
+ flex-direction: column;
37
+ justify-content: space-between;
38
+ align-items: flex-start;
39
+ gap: 4px;
40
+ min-height: 80px;
37
41
 
38
- .server-select-product-content-left {
39
- flex: 1;
42
+ .server-select-product-title {
43
+ color: var(--Base-Black, #000);
44
+ font-size: 20px;
45
+ font-style: normal;
46
+ font-weight: 600;
47
+ line-height: 30px;
48
+ }
40
49
 
41
- .server-select-product-title {
42
- color: var(--Base-Black, #000);
43
- font-size: 20px;
44
- font-style: normal;
45
- font-weight: 600;
46
- line-height: 30px;
47
- }
50
+ .server-select-product-subtitle {
51
+ color: var(--Gray-600, #475467);
52
+ font-size: 16px;
53
+ font-style: normal;
54
+ font-weight: 400;
55
+ line-height: 24px;
56
+ }
48
57
 
49
- .server-select-product-subtitle {
50
- color: var(--Gray-600, #475467);
51
- font-size: 16px;
52
- font-style: normal;
53
- font-weight: 400;
54
- line-height: 24px;
55
- }
58
+ .server-select-product-quantity {
59
+ width: 100%;
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: space-between;
63
+ color: var(--Gray-600, #475467);
56
64
 
57
- .server-select-product-quantity {
58
- color: var(--Gray-600, #475467);
65
+ font-size: 16px;
66
+ font-style: normal;
67
+ font-weight: 400;
59
68
 
69
+ .server-select-product-total {
70
+ color: var(--Base-Black, #000);
60
71
  font-size: 16px;
61
72
  font-style: normal;
62
- font-weight: 400;
73
+ font-weight: 500;
74
+ line-height: 24px;
63
75
  }
64
76
  }
65
77
 
66
- .server-select-product-content-right {
67
- color: var(--Base-Black, #000);
68
- font-size: 20px;
69
- font-style: normal;
70
- font-weight: 600;
71
- }
78
+
72
79
 
73
80
  }
74
81
 
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import "./index.less";
3
+ interface CollapsibleListProps<T> {
4
+ list: T[];
5
+ renderItem: (item: T, index: number) => React.ReactNode;
6
+ className?: string;
7
+ style?: React.CSSProperties;
8
+ border?: boolean;
9
+ }
10
+ declare const CollapsibleList: React.FC<CollapsibleListProps<any>>;
11
+ export default CollapsibleList;
@@ -0,0 +1,94 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
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
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/booking/components/collapsibleList/index.tsx
30
+ var collapsibleList_exports = {};
31
+ __export(collapsibleList_exports, {
32
+ default: () => collapsibleList_default
33
+ });
34
+ module.exports = __toCommonJS(collapsibleList_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
37
+ var import_classnames = __toESM(require("classnames"));
38
+ var import_index = require("./index.less");
39
+ var MAX_LIMIT = 3;
40
+ var CollapsibleList = (props) => {
41
+ const { list = [], renderItem, className, style, border } = props;
42
+ const [maxLimit, setMaxLimit] = (0, import_react.useState)(MAX_LIMIT);
43
+ const handlePreviewAll = () => {
44
+ let _maxLimit = maxLimit;
45
+ if (_maxLimit === MAX_LIMIT) {
46
+ _maxLimit = 99;
47
+ } else {
48
+ _maxLimit = MAX_LIMIT;
49
+ }
50
+ setMaxLimit(_maxLimit);
51
+ };
52
+ const showAll = (0, import_react.useMemo)(() => {
53
+ return list.length > MAX_LIMIT;
54
+ }, [list]);
55
+ const viewAllText = (0, import_react.useMemo)(() => {
56
+ let _maxLimit = maxLimit;
57
+ if (_maxLimit === MAX_LIMIT) {
58
+ return import_utils.locales.getText("pisell2.text.view-all");
59
+ }
60
+ return import_utils.locales.getText("pisell2.text.view-less");
61
+ }, [maxLimit]);
62
+ const _list = (0, import_react.useMemo)(() => {
63
+ let arr = [...list];
64
+ let _maxLimit = maxLimit;
65
+ if (list.length > _maxLimit) {
66
+ arr = arr.slice(0, _maxLimit);
67
+ }
68
+ return arr;
69
+ }, [list.length, maxLimit]);
70
+ return /* @__PURE__ */ import_react.default.createElement(
71
+ "div",
72
+ {
73
+ className: (0, import_classnames.default)("pisell2-collapsible-list-wrap", className),
74
+ style
75
+ },
76
+ border ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell2-collapsible-list-top-border" }) : null,
77
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell2-collapsible-list" }, _list.map((d, i) => {
78
+ return renderItem(d, i);
79
+ })),
80
+ showAll ? /* @__PURE__ */ import_react.default.createElement(
81
+ "div",
82
+ {
83
+ className: "pisell2-collapsible-list-view-all",
84
+ onClick: (e) => {
85
+ e.preventDefault();
86
+ e.stopPropagation();
87
+ handlePreviewAll();
88
+ }
89
+ },
90
+ viewAllText
91
+ ) : null
92
+ );
93
+ };
94
+ var collapsibleList_default = CollapsibleList;
@@ -0,0 +1,61 @@
1
+ .pisell2-collapsible-list-wrap {
2
+ .pisell2-collapsible-list-top-border {
3
+ height: 1px;
4
+ background: #f1f1f1;
5
+ width: 100%;
6
+ margin: 8px 0;
7
+ }
8
+
9
+ .pisell2-collapsible-list {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 4px;
13
+ }
14
+
15
+ .pisell2-collapsible-list-view-all {
16
+ margin-top: 4px;
17
+ color: #7f56d9;
18
+ font-size: 16px;
19
+ font-style: normal;
20
+ font-weight: 700;
21
+ line-height: 24px;
22
+ user-select: none;
23
+ }
24
+
25
+ }
26
+
27
+
28
+ .product-bundle-item {
29
+ width: 100%;
30
+
31
+ .product-bundle-info {
32
+ width: 100%;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: space-between;
36
+
37
+ .product-bundle-info-title {
38
+ color: var(--gray-500, #667085);
39
+ font-size: 14px;
40
+ font-style: normal;
41
+ font-weight: 500;
42
+ line-height: 20px;
43
+ }
44
+
45
+ .product-bundle-info-num {
46
+ color: var(--Gray-500, #667085);
47
+ font-size: 14px;
48
+ font-style: normal;
49
+ font-weight: 400;
50
+ line-height: 20px;
51
+ flex-shrink: 0;
52
+ }
53
+ }
54
+
55
+ .product-bundle-option {
56
+ color: var(--gray-500, #667085);
57
+ font-size: 12px;
58
+ margin-top: 4px;
59
+ }
60
+
61
+ }
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const renderBundles: (item: any, amountSymbol: string) => React.JSX.Element;
@@ -0,0 +1,46 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
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
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/booking/components/collapsibleList/utils.tsx
30
+ var utils_exports = {};
31
+ __export(utils_exports, {
32
+ renderBundles: () => renderBundles
33
+ });
34
+ module.exports = __toCommonJS(utils_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
37
+ var renderBundles = (item, amountSymbol) => {
38
+ const options = (item == null ? void 0 : item.option) || [];
39
+ return /* @__PURE__ */ import_react.default.createElement("div", { key: item.id, className: "product-bundle-item" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "product-bundle-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "product-bundle-info-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "product-bundle-info-num" }, (0, import_utils.formatAmount)(item.price, 2, amountSymbol), " × ", item.num)), /* @__PURE__ */ import_react.default.createElement("div", { className: "product-bundle-option" }, options.map((option, index) => {
40
+ return /* @__PURE__ */ import_react.default.createElement("span", { key: option.id }, option.name, " x ", option.num, " ", index < options.length - 1 && ",", " ");
41
+ })));
42
+ };
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ renderBundles
46
+ });