@pisell/private-materials 3.0.211 → 3.0.212

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 (63) 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 +5 -5
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/Sales/Cart/index.js +3 -1
  12. package/es/components/Sales/Event/Detail.js +1 -1
  13. package/es/components/Sales/Init/index.d.ts +4 -0
  14. package/es/components/Sales/Init/index.js +6 -2
  15. package/es/components/Sales/Resource/serve.d.ts +1 -0
  16. package/es/components/Sales/Summary/index.d.ts +3 -0
  17. package/es/components/Sales/Summary/index.js +9 -3
  18. package/es/components/Sales/Summary/serve.d.ts +0 -2
  19. package/es/components/Sales/Summary/serve.js +0 -11
  20. package/es/components/Sales/Summary/utils.d.ts +15 -1
  21. package/es/components/Sales/Summary/utils.js +32 -3
  22. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +4 -0
  23. package/es/components/eventBooking/components/Provider/Cart/Item/Total.js +40 -0
  24. package/es/components/eventBooking/components/Provider/Cart/Item/index.js +2 -8
  25. package/es/components/eventBooking/components/Provider/Cart/Item/index.less +42 -10
  26. package/es/components/eventBooking/components/Provider/Footer/index.js +2 -2
  27. package/es/components/eventBooking/components/Provider/Header/index.js +4 -2
  28. package/es/components/eventBooking/components/Provider/Resource/index.js +4 -21
  29. package/es/components/eventBooking/components/bookingDetailModal/index.js +98 -32
  30. package/es/components/eventBooking/components/bookingDetailModal/index.less +1 -1
  31. package/es/components/eventBooking/components/resourceDisplay/index.less +14 -0
  32. package/es/components/eventBooking/index.js +2 -1
  33. package/es/components/eventBooking/locales.d.ts +6 -3
  34. package/es/components/eventBooking/locales.js +22 -7
  35. package/es/components/eventBooking/utils.d.ts +9 -0
  36. package/es/components/eventBooking/utils.js +17 -0
  37. package/lib/components/Sales/Cart/index.js +6 -4
  38. package/lib/components/Sales/Event/Detail.js +1 -1
  39. package/lib/components/Sales/Init/index.d.ts +4 -0
  40. package/lib/components/Sales/Init/index.js +5 -2
  41. package/lib/components/Sales/Resource/serve.d.ts +1 -0
  42. package/lib/components/Sales/Summary/index.d.ts +3 -0
  43. package/lib/components/Sales/Summary/index.js +11 -3
  44. package/lib/components/Sales/Summary/serve.d.ts +0 -2
  45. package/lib/components/Sales/Summary/serve.js +0 -37
  46. package/lib/components/Sales/Summary/utils.d.ts +15 -1
  47. package/lib/components/Sales/Summary/utils.js +25 -5
  48. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +4 -0
  49. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.js +75 -0
  50. package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +2 -9
  51. package/lib/components/eventBooking/components/Provider/Cart/Item/index.less +42 -10
  52. package/lib/components/eventBooking/components/Provider/Footer/index.js +2 -2
  53. package/lib/components/eventBooking/components/Provider/Header/index.js +5 -2
  54. package/lib/components/eventBooking/components/Provider/Resource/index.js +4 -12
  55. package/lib/components/eventBooking/components/bookingDetailModal/index.js +73 -17
  56. package/lib/components/eventBooking/components/bookingDetailModal/index.less +1 -1
  57. package/lib/components/eventBooking/components/resourceDisplay/index.less +14 -0
  58. package/lib/components/eventBooking/index.js +2 -1
  59. package/lib/components/eventBooking/locales.d.ts +6 -3
  60. package/lib/components/eventBooking/locales.js +10 -7
  61. package/lib/components/eventBooking/utils.d.ts +9 -0
  62. package/lib/components/eventBooking/utils.js +12 -2
  63. package/package.json +2 -2
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  calculatePriceDetails: () => calculatePriceDetails,
33
- calculateSubtotal: () => calculateSubtotal
33
+ calculateSubtotal: () => calculateSubtotal,
34
+ calculateTaxFee: () => calculateTaxFee
34
35
  });
35
36
  module.exports = __toCommonJS(utils_exports);
36
37
  var import_decimal = __toESM(require("decimal.js"));
@@ -45,16 +46,35 @@ var calculateSubtotal = (items) => {
45
46
  }, new import_decimal.default(0));
46
47
  return subtotal.toFixed(2);
47
48
  };
48
- var calculatePriceDetails = (items) => {
49
+ var calculateTaxFee = (shopInfo, items) => {
50
+ if (!(items == null ? void 0 : items.length)) {
51
+ return "0.00";
52
+ }
53
+ const { is_price_include_tax, tax_rate } = shopInfo || {};
54
+ const totalTaxFee = items.reduce((sum, item) => {
55
+ const price = new import_decimal.default(item.price || 0);
56
+ const taxRate = new import_decimal.default(tax_rate || 0).div(100);
57
+ const productTaxRate = price.times(taxRate).times((item == null ? void 0 : item.is_charge_tax) || 0).div(taxRate.times(is_price_include_tax || 0).plus(1));
58
+ return sum.plus(productTaxRate);
59
+ }, new import_decimal.default(0));
60
+ return totalTaxFee;
61
+ };
62
+ var calculatePriceDetails = (shopInfo, items) => {
49
63
  const subtotal = new import_decimal.default(calculateSubtotal(items));
50
- const total = subtotal;
64
+ const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
65
+ console.log("totalTaxFee", totalTaxFee.toFixed(2));
66
+ const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal : subtotal.plus(totalTaxFee);
51
67
  return {
52
68
  subtotal: subtotal.toFixed(2),
53
- total: total.toFixed(2)
69
+ total: total.toFixed(2),
70
+ taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
71
+ totalTaxFee: totalTaxFee.toFixed(2),
72
+ isPriceIncludeTax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax
54
73
  };
55
74
  };
56
75
  // Annotate the CommonJS export names for ESM import in node:
57
76
  0 && (module.exports = {
58
77
  calculatePriceDetails,
59
- calculateSubtotal
78
+ calculateSubtotal,
79
+ calculateTaxFee
60
80
  });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const Total: () => React.JSX.Element;
4
+ export default Total;
@@ -0,0 +1,75 @@
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/eventBooking/components/Provider/Cart/Item/Total.tsx
30
+ var Total_exports = {};
31
+ __export(Total_exports, {
32
+ default: () => Total_default
33
+ });
34
+ module.exports = __toCommonJS(Total_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
37
+ var import_materials = require("@pisell/materials");
38
+ var import_Sales = require("../../../../../Sales");
39
+ var import_useEngineContext = __toESM(require("../../../../../../hooks/useEngineContext"));
40
+ var import_index = require("./index.less");
41
+ var import_classnames = __toESM(require("classnames"));
42
+ var Total = () => {
43
+ var _a, _b, _c, _d, _e, _f;
44
+ const { taxTitle, totalTaxFee, isPriceIncludeTax, total } = (0, import_Sales.useSummary)();
45
+ const context = (0, import_useEngineContext.default)();
46
+ console.log(
47
+ taxTitle,
48
+ isPriceIncludeTax,
49
+ totalTaxFee,
50
+ total,
51
+ (_c = (_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.getSymbolic) == null ? void 0 : _c.call(_b),
52
+ "wh97978"
53
+ );
54
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "event-total-wrap" }, !isPriceIncludeTax && Number(totalTaxFee) > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: "gst-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", null, taxTitle), /* @__PURE__ */ import_react.default.createElement(import_materials.PisellText.Amount, { value: totalTaxFee, showCurrencySymbol: true })) : null, /* @__PURE__ */ import_react.default.createElement(
55
+ "div",
56
+ {
57
+ className: (0, import_classnames.default)("event-total", {
58
+ [["total-gst-wrap"]]: !isPriceIncludeTax && Number(totalTaxFee) > 0
59
+ })
60
+ },
61
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "left" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.event.total")), isPriceIncludeTax && Number(totalTaxFee) > 0 ? /* @__PURE__ */ import_react.default.createElement("span", { className: "gst" }, import_utils.locales.getText("pisell2.event.total.gst")(
62
+ taxTitle,
63
+ `${(_f = (_e = (_d = context == null ? void 0 : context.appHelper) == null ? void 0 : _d.utils) == null ? void 0 : _e.getSymbolic) == null ? void 0 : _f.call(_e)}${totalTaxFee}`
64
+ )) : null),
65
+ /* @__PURE__ */ import_react.default.createElement(
66
+ import_materials.PisellText.Amount,
67
+ {
68
+ value: total,
69
+ showCurrencySymbol: true,
70
+ className: "event-amount"
71
+ }
72
+ )
73
+ ));
74
+ };
75
+ var Total_default = Total;
@@ -34,11 +34,11 @@ __export(Item_exports, {
34
34
  module.exports = __toCommonJS(Item_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_utils = require("@pisell/utils");
37
- var import_materials = require("@pisell/materials");
38
37
  var import_shoppingCart = __toESM(require("../../../../../shoppingCart"));
39
38
  var import_Sales = require("../../../../../Sales");
40
39
  var import_SelectHolderModal = __toESM(require("../../SelectHolderModal"));
41
40
  var import_ContinueButton = __toESM(require("../ContinueButton"));
41
+ var import_Total = __toESM(require("./Total"));
42
42
  var import_index = require("./index.less");
43
43
  var CartItem = () => {
44
44
  const { open, holderData, selectedHolderIds } = (0, import_Sales.useHolder)();
@@ -86,14 +86,7 @@ var CartItem = () => {
86
86
  onChange: (e, type, key) => handleClickCard(e, type, key)
87
87
  }
88
88
  )),
89
- /* @__PURE__ */ import_react.default.createElement("div", { className: "event-footer" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "event-total-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.event.total")), /* @__PURE__ */ import_react.default.createElement(
90
- import_materials.PisellText.Amount,
91
- {
92
- value: subtotal,
93
- showCurrencySymbol: true,
94
- className: "event-amount"
95
- }
96
- )), /* @__PURE__ */ import_react.default.createElement(import_ContinueButton.default, null))
89
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "event-footer" }, /* @__PURE__ */ import_react.default.createElement(import_Total.default, null), /* @__PURE__ */ import_react.default.createElement(import_ContinueButton.default, null))
97
90
  ), /* @__PURE__ */ import_react.default.createElement(import_SelectHolderModal.default, { open }));
98
91
  };
99
92
  var Item_default = CartItem;
@@ -17,19 +17,51 @@
17
17
  flex-direction: column;
18
18
  gap: 14px;
19
19
  margin-top: 6px;
20
- .event-total-wrap {
21
- color: var(--Text-Text_1, #1b1b1b);
22
- font-size: 20px;
23
- font-weight: 600;
24
- line-height: 28px;
20
+ }
21
+ }
22
+
23
+ .event-total-wrap {
24
+ color: var(--Text-Text_1, #1b1b1b);
25
+ font-size: 20px;
26
+ font-weight: 600;
27
+ line-height: 28px;
28
+ display: flex;
29
+ flex-direction: column;
30
+ align-items: start;
31
+
32
+ > div {
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: space-between;
36
+ width: 100%;
37
+ }
38
+
39
+ .gst-wrap {
40
+ font-size: 16px;
41
+ font-weight: 500;
42
+ line-height: 24px;
43
+ }
44
+
45
+ .event-total {
46
+ .left {
25
47
  display: flex;
26
- align-items: center;
27
- justify-content: space-between;
28
- .event-amount {
29
- color: var(--Blue-600, #1570ef);
48
+ flex-direction: column;
49
+ .gst {
50
+ color: var(--Gray-500, #667085);
51
+ font-size: 14px;
52
+ font-weight: 400;
53
+ line-height: 20px;
30
54
  }
31
55
  }
32
56
  }
57
+
58
+ .total-gst-wrap {
59
+ padding: 14px 0 0;
60
+ }
61
+
62
+ .event-amount {
63
+ color: var(--Blue-600, #1570ef);
64
+ }
33
65
  }
34
66
 
35
67
  .cart-mobile-item-wrap {
@@ -40,7 +72,7 @@
40
72
  .content {
41
73
  flex: 1;
42
74
  overflow-y: auto;
43
- padding: 0 0 120px;
75
+ padding: 0 0 140px;
44
76
  }
45
77
  .event-footer {
46
78
  z-index: 10;
@@ -46,7 +46,7 @@ var Footer = () => {
46
46
  var _a;
47
47
  const { open } = (0, import_Sales.useHolder)();
48
48
  const { onOpenCart, openCart, onCloseCart, cartData } = (0, import_Sales.useCart)();
49
- const { subtotal } = (0, import_Sales.useSummary)();
49
+ const { total } = (0, import_Sales.useSummary)();
50
50
  const [selectedItem, setSelectedItem] = (0, import_react2.useState)(null);
51
51
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
52
52
  import_materials.SectionFooters,
@@ -55,7 +55,7 @@ var Footer = () => {
55
55
  left: /* @__PURE__ */ import_react.default.createElement("div", { className: "section-footer-left" }, /* @__PURE__ */ import_react.default.createElement(import_materials.PisellText, null, import_utils.locales.getText("pisell2.event.total")), /* @__PURE__ */ import_react.default.createElement(
56
56
  import_materials.PisellText.Amount,
57
57
  {
58
- value: subtotal,
58
+ value: total,
59
59
  showCurrencySymbol: true,
60
60
  className: "amount"
61
61
  }
@@ -36,15 +36,18 @@ var import_react = __toESM(require("react"));
36
36
  var import_utils = require("@pisell/utils");
37
37
  var import_Sales = require("../../../../Sales");
38
38
  var import_progressBar = __toESM(require("../../progressBar"));
39
+ var import_utils2 = require("../../../utils");
39
40
  var import_index = require("./index.less");
40
41
  var Header = () => {
41
42
  var _a, _b;
42
43
  const { currentStepData, closePage, prevStep, isFirstStep } = (0, import_Sales.useStep)();
43
- const { removeSessionStorage } = (0, import_Sales.useSales)();
44
+ const { removeSessionStorage, data } = (0, import_Sales.useSales)();
44
45
  const steps = {
45
46
  "select-category": {
46
47
  title: import_utils.locales.getText("pisell2.event.step")(1),
47
- description: import_utils.locales.getText("pisell2.event.select.category")
48
+ description: import_utils.locales.getText("pisell2.event.select.category")(
49
+ (0, import_utils2.resourceTitle)(data)
50
+ )
48
51
  },
49
52
  "select-event": {
50
53
  title: import_utils.locales.getText("pisell2.event.step")(2),
@@ -36,16 +36,15 @@ var import_react = __toESM(require("react"));
36
36
  var import_materials = require("@pisell/materials");
37
37
  var import_utils = require("@pisell/utils");
38
38
  var import_Sales = require("../../../../Sales");
39
- var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
40
39
  var import_resourceDisplay = __toESM(require("../../resourceDisplay"));
40
+ var import_utils2 = require("../../../utils");
41
41
  var import_index = require("./index.less");
42
42
  var Resource = () => {
43
- var _a, _b, _c;
43
+ var _a, _b;
44
44
  const { data } = (0, import_Sales.useSales)();
45
45
  const { getResourceList, selectResource } = (0, import_Sales.useResource)();
46
46
  const { createCartItem } = (0, import_Sales.useCart)();
47
47
  const { nextStep } = (0, import_Sales.useStep)();
48
- const context = (0, import_useEngineContext.default)();
49
48
  const handleClick = (item) => {
50
49
  createCartItem();
51
50
  selectResource(item);
@@ -66,20 +65,13 @@ var Resource = () => {
66
65
  }
67
66
  );
68
67
  };
69
- const resourceTitle = (0, import_react.useMemo)(() => {
70
- var _a2, _b2, _c2, _d, _e, _f, _g;
71
- const form = (_c2 = (_b2 = (_a2 = data == null ? void 0 : data.initData) == null ? void 0 : _a2.boardSetting) == null ? void 0 : _b2.event_v2_form) == null ? void 0 : _c2.form;
72
- const title = ((_d = form == null ? void 0 : form.setting) == null ? void 0 : _d.title) || (form == null ? void 0 : form.title);
73
- const translation = (_f = (_e = context == null ? void 0 : context.appHelper) == null ? void 0 : _e.utils) == null ? void 0 : _f.translation;
74
- return (_g = translation(title)) == null ? void 0 : _g.toLowerCase();
75
- }, [(_a = data == null ? void 0 : data.initData) == null ? void 0 : _a.boardSetting]);
76
68
  return /* @__PURE__ */ import_react.default.createElement(
77
69
  "div",
78
70
  {
79
71
  className: `event-interface-resource-wrap ${(0, import_utils.isMobile)() ? "event-interface-resource-mobile-wrap" : ""}`
80
72
  },
81
- /* @__PURE__ */ import_react.default.createElement("span", { className: "title" }, import_utils.locales.getText("pisell2.event.select.campus")(resourceTitle)),
82
- /* @__PURE__ */ import_react.default.createElement("div", { className: "content" }, (_c = (_b = data == null ? void 0 : data.resourceData) == null ? void 0 : _b.resourceList) == null ? void 0 : _c.map((item, index) => {
73
+ /* @__PURE__ */ import_react.default.createElement("span", { className: "title" }, import_utils.locales.getText("pisell2.event.select.campus")((0, import_utils2.resourceTitle)(data))),
74
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "content" }, (_b = (_a = data == null ? void 0 : data.resourceData) == null ? void 0 : _a.resourceList) == null ? void 0 : _b.map((item, index) => {
83
75
  return /* @__PURE__ */ import_react.default.createElement("div", { key: index, className: "content-item" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "content-title" }, item == null ? void 0 : item.title), /* @__PURE__ */ import_react.default.createElement(
84
76
  import_materials.PisellViewGrid,
85
77
  {
@@ -52,6 +52,7 @@ var BookingDetailModal = (props) => {
52
52
  const [activeTab, setActiveTab] = (0, import_react.useState)("introduction");
53
53
  const [isScrolling, setIsScrolling] = (0, import_react.useState)(false);
54
54
  const [openCheckout, setOpenCheckout] = (0, import_react.useState)(false);
55
+ const isUserClickRef = (0, import_react.useRef)(false);
55
56
  const anchorOptions = (0, import_react.useMemo)(
56
57
  () => [
57
58
  {
@@ -100,34 +101,81 @@ var BookingDetailModal = (props) => {
100
101
  if (!modalContentRef.current || !open)
101
102
  return;
102
103
  const handleScroll = () => {
103
- var _a2;
104
- if (isScrolling)
104
+ var _a2, _b, _c;
105
+ if (isScrolling || isUserClickRef.current)
105
106
  return;
106
107
  const container2 = modalContentRef.current;
107
108
  if (!container2)
108
109
  return;
109
110
  const scrollTop = container2.scrollTop;
110
111
  const headerHeight = 58;
111
- for (const option of anchorOptions) {
112
+ const containerHeight = container2.clientHeight;
113
+ const scrollHeight = container2.scrollHeight;
114
+ const lastOption = anchorOptions[anchorOptions.length - 1];
115
+ const isExactBottom = Math.abs(scrollTop + containerHeight - scrollHeight) <= 1;
116
+ if (isExactBottom && activeTab !== lastOption.id) {
117
+ setActiveTab(lastOption.id);
118
+ (_a2 = tabsRef == null ? void 0 : tabsRef.current) == null ? void 0 : _a2.scroll(lastOption.id);
119
+ return;
120
+ }
121
+ const isNearBottom = scrollTop + containerHeight + 100 >= scrollHeight;
122
+ const lastElement = document.getElementById(lastOption.id);
123
+ if (isNearBottom && lastElement) {
124
+ const rect = lastElement.getBoundingClientRect();
125
+ if (rect.top < containerHeight && activeTab !== lastOption.id) {
126
+ setActiveTab(lastOption.id);
127
+ (_b = tabsRef == null ? void 0 : tabsRef.current) == null ? void 0 : _b.scroll(lastOption.id);
128
+ return;
129
+ }
130
+ }
131
+ const visibleElements = anchorOptions.map((option) => {
112
132
  const element = document.getElementById(option.id);
113
- if (element) {
114
- const rect = element.getBoundingClientRect();
115
- const elementTop = rect.top;
116
- if (Math.abs(elementTop - headerHeight) < 50) {
117
- if (activeTab !== option.id) {
118
- setActiveTab(option.id);
119
- (_a2 = tabsRef == null ? void 0 : tabsRef.current) == null ? void 0 : _a2.scroll(option.id);
120
- }
121
- break;
122
- }
133
+ if (!element)
134
+ return null;
135
+ const rect = element.getBoundingClientRect();
136
+ const elementTop = rect.top;
137
+ const elementBottom = rect.bottom;
138
+ const topDistance = Math.abs(elementTop - headerHeight);
139
+ const isVisible = elementTop < containerHeight && elementBottom > headerHeight;
140
+ return {
141
+ id: option.id,
142
+ topDistance,
143
+ isVisible,
144
+ top: elementTop
145
+ };
146
+ }).filter(Boolean);
147
+ const currentElement = visibleElements.filter((el) => el.isVisible).sort((a, b) => {
148
+ if (a.top > headerHeight && b.top > headerHeight) {
149
+ return a.top - b.top;
123
150
  }
151
+ if (a.top < headerHeight && b.top < headerHeight) {
152
+ return b.top - a.top;
153
+ }
154
+ return a.top > headerHeight ? -1 : 1;
155
+ })[0];
156
+ if (currentElement && activeTab !== currentElement.id) {
157
+ setActiveTab(currentElement.id);
158
+ (_c = tabsRef == null ? void 0 : tabsRef.current) == null ? void 0 : _c.scroll(currentElement.id);
124
159
  }
125
160
  };
126
161
  const container = modalContentRef.current;
127
162
  container.addEventListener("scroll", handleScroll);
128
- setTimeout(handleScroll, 100);
129
163
  return () => container.removeEventListener("scroll", handleScroll);
130
164
  }, [anchorOptions, activeTab, open, isScrolling]);
165
+ const handleTabChange = (key) => {
166
+ if (isUserClickRef.current) {
167
+ setActiveTab(key);
168
+ setIsScrolling(true);
169
+ setTimeout(() => {
170
+ setIsScrolling(false);
171
+ isUserClickRef.current = false;
172
+ }, 1200);
173
+ } else {
174
+ if (!isScrolling && !isUserClickRef.current) {
175
+ setActiveTab(key);
176
+ }
177
+ }
178
+ };
131
179
  const content = () => {
132
180
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-detail-modal-content", ref: modalContentRef }, /* @__PURE__ */ import_react.default.createElement("div", { className: "anchor-wrapper" }, /* @__PURE__ */ import_react.default.createElement(
133
181
  import_materials.PisellAnchor,
@@ -135,9 +183,10 @@ var BookingDetailModal = (props) => {
135
183
  ref: tabsRef,
136
184
  options: anchorOptions,
137
185
  tab: activeTab,
138
- onChange: (key) => {
139
- scrollToElement(key);
140
- setActiveTab(key);
186
+ containerRef: modalContentRef,
187
+ onChange: handleTabChange,
188
+ onTabClick: () => {
189
+ isUserClickRef.current = true;
141
190
  }
142
191
  }
143
192
  )), /* @__PURE__ */ import_react.default.createElement("div", { className: "content-wrapper" }, /* @__PURE__ */ import_react.default.createElement("div", { id: "introduction", className: "content-section" }, (images == null ? void 0 : images.length) > 0 ? /* @__PURE__ */ import_react.default.createElement(
@@ -162,6 +211,13 @@ var BookingDetailModal = (props) => {
162
211
  }
163
212
  addToCart();
164
213
  };
214
+ (0, import_react.useEffect)(() => {
215
+ if (open) {
216
+ setActiveTab("introduction");
217
+ setIsScrolling(false);
218
+ isUserClickRef.current = false;
219
+ }
220
+ }, [open]);
165
221
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
166
222
  import_materials.PisellModal,
167
223
  {
@@ -12,7 +12,7 @@
12
12
  top: 0;
13
13
  z-index: 10;
14
14
  background: #fff;
15
- padding: 0 !important;
15
+ padding: 0 16px !important;
16
16
  // padding: 16px;
17
17
  }
18
18
 
@@ -78,4 +78,18 @@
78
78
  line-height: 10px;
79
79
  }
80
80
  }
81
+
82
+ &-empty-avatar {
83
+ .pisell-lowcode-avatar-string {
84
+ position: relative;
85
+ left: 0;
86
+ height: 32px;
87
+ line-height: 32px;
88
+ transform: scale(1) !important;
89
+ .pisell-lowcode-image {
90
+ width: 32px;
91
+ height: 32px;
92
+ }
93
+ }
94
+ }
81
95
  }
@@ -59,7 +59,8 @@ var Content = () => {
59
59
  return;
60
60
  getResourceList.run({
61
61
  form_id,
62
- shop_id
62
+ shop_id,
63
+ form_data_status: "active"
63
64
  });
64
65
  }, [form_id]);
65
66
  return getResourceList.data ? /* @__PURE__ */ import_react.default.createElement(
@@ -13,11 +13,12 @@ declare const _default: {
13
13
  'pisell2.event.close.continue': string;
14
14
  'pisell2.event.close.exit': string;
15
15
  'pisell2.event.step': (step: number) => string;
16
- 'pisell2.event.select.category': string;
16
+ 'pisell2.event.select.category': (val: string) => string;
17
17
  'pisell2.event.select.campus': (val: string) => string;
18
18
  'pisell2.event.select.event': string;
19
19
  'pisell2.event.cart': string;
20
20
  'pisell2.event.total': string;
21
+ 'pisell2.event.total.gst': (val: string, amount: any) => string;
21
22
  'pisell2.event.continue': string;
22
23
  'pisell2.event.details': string;
23
24
  'pisell2.event.introduction': string;
@@ -83,11 +84,12 @@ declare const _default: {
83
84
  'pisell2.event.close.continue': string;
84
85
  'pisell2.event.close.exit': string;
85
86
  'pisell2.event.step': (step: number) => string;
86
- 'pisell2.event.select.category': string;
87
+ 'pisell2.event.select.category': (val: string) => string;
87
88
  'pisell2.event.select.event': string;
88
89
  'pisell2.event.select.campus': (val: string) => string;
89
90
  'pisell2.event.cart': string;
90
91
  'pisell2.event.total': string;
92
+ 'pisell2.event.total.gst': (val: string, amount: any) => string;
91
93
  'pisell2.event.continue': string;
92
94
  'pisell2.event.details': string;
93
95
  'pisell2.event.introduction': string;
@@ -153,11 +155,12 @@ declare const _default: {
153
155
  'pisell2.event.close.continue': string;
154
156
  'pisell2.event.close.exit': string;
155
157
  'pisell2.event.step': (step: number) => string;
156
- 'pisell2.event.select.category': string;
158
+ 'pisell2.event.select.category': (val: string) => string;
157
159
  'pisell2.event.select.event': string;
158
160
  'pisell2.event.select.campus': (val: string) => string;
159
161
  'pisell2.event.cart': string;
160
162
  'pisell2.event.total': string;
163
+ 'pisell2.event.total.gst': (val: string, amount: any) => string;
161
164
  'pisell2.event.continue': string;
162
165
  'pisell2.event.details': string;
163
166
  'pisell2.event.introduction': string;
@@ -37,11 +37,12 @@ var locales_default = {
37
37
  "pisell2.event.close.continue": "Continue",
38
38
  "pisell2.event.close.exit": "Exit",
39
39
  "pisell2.event.step": (step) => `Step ${step}`,
40
- "pisell2.event.select.category": "Select category",
41
- "pisell2.event.select.campus": (val) => `Please choose ${val || "resource"}`,
42
- "pisell2.event.select.event": "Select event",
40
+ "pisell2.event.select.category": (val) => `Select ${val || "resource"}`,
41
+ "pisell2.event.select.campus": (val) => `Please select ${val || "resource"}`,
42
+ "pisell2.event.select.event": "Select service",
43
43
  "pisell2.event.cart": "Cart",
44
44
  "pisell2.event.total": "Total",
45
+ "pisell2.event.total.gst": (val, amount) => `Including ${val} ${amount}`,
45
46
  "pisell2.event.continue": "Continue",
46
47
  "pisell2.event.details": "Details",
47
48
  "pisell2.event.introduction": "Introduction",
@@ -107,11 +108,12 @@ var locales_default = {
107
108
  "pisell2.event.close.continue": "继续",
108
109
  "pisell2.event.close.exit": "退出",
109
110
  "pisell2.event.step": (step) => `步骤 ${step}`,
110
- "pisell2.event.select.category": "选择分类",
111
- "pisell2.event.select.event": "选择活动",
111
+ "pisell2.event.select.category": (val) => `选择${val || "资源"}`,
112
+ "pisell2.event.select.event": "选择服务",
112
113
  "pisell2.event.select.campus": (val) => `请选择${val || "资源"}`,
113
114
  "pisell2.event.cart": "购物车",
114
115
  "pisell2.event.total": "总计",
116
+ "pisell2.event.total.gst": (val, amount) => `包含${val} ${amount}`,
115
117
  "pisell2.event.continue": "继续",
116
118
  "pisell2.event.details": "详情",
117
119
  "pisell2.event.introduction": "介绍",
@@ -177,11 +179,12 @@ var locales_default = {
177
179
  "pisell2.event.close.continue": "繼續",
178
180
  "pisell2.event.close.exit": "退出",
179
181
  "pisell2.event.step": (step) => `步驟 ${step}`,
180
- "pisell2.event.select.category": "選擇分類",
181
- "pisell2.event.select.event": "選擇活動",
182
+ "pisell2.event.select.category": (val) => `選擇${val || "資源"}`,
183
+ "pisell2.event.select.event": "選擇服務",
182
184
  "pisell2.event.select.campus": (val) => `請選擇${val || "資源"}`,
183
185
  "pisell2.event.cart": "購物車",
184
186
  "pisell2.event.total": "總計",
187
+ "pisell2.event.total.gst": (val, amount) => `包含${val} ${amount}`,
185
188
  "pisell2.event.continue": "繼續",
186
189
  "pisell2.event.details": "詳情",
187
190
  "pisell2.event.introduction": "介紹",
@@ -34,3 +34,12 @@ export declare const getScheduleColors: (schedules: any[]) => string;
34
34
  * @Date: 2025-01-12 11:55
35
35
  */
36
36
  export declare const formatMonthDisplay: (dateString: string) => string;
37
+ /**
38
+ * @title: 资源名称
39
+ * @description:
40
+ * @param {any} data
41
+ * @return {*}
42
+ * @Author: WangHan
43
+ * @Date: 2025-02-11 13:39
44
+ */
45
+ export declare const resourceTitle: (data: any) => any;
@@ -32,7 +32,8 @@ __export(utils_exports, {
32
32
  formatBackgroundColors: () => formatBackgroundColors,
33
33
  formatMonthDisplay: () => formatMonthDisplay,
34
34
  getScheduleColors: () => getScheduleColors,
35
- getUsableSchedules: () => getUsableSchedules
35
+ getUsableSchedules: () => getUsableSchedules,
36
+ resourceTitle: () => resourceTitle
36
37
  });
37
38
  module.exports = __toCommonJS(utils_exports);
38
39
  var import_dayjs = __toESM(require("dayjs"));
@@ -71,10 +72,19 @@ var formatMonthDisplay = (dateString) => {
71
72
  const date = /* @__PURE__ */ new Date(dateString + "-01");
72
73
  return date.toLocaleString(locale, { month: "long", year: "numeric" });
73
74
  };
75
+ var resourceTitle = (data) => {
76
+ var _a, _b, _c, _d, _e, _f, _g;
77
+ const context = (0, import_useEngineContext.default)();
78
+ const form = (_c = (_b = (_a = data == null ? void 0 : data.initData) == null ? void 0 : _a.boardSetting) == null ? void 0 : _b.event_v2_form) == null ? void 0 : _c.form;
79
+ const title = ((_d = form == null ? void 0 : form.setting) == null ? void 0 : _d.title) || (form == null ? void 0 : form.title);
80
+ const translation = (_f = (_e = context == null ? void 0 : context.appHelper) == null ? void 0 : _e.utils) == null ? void 0 : _f.translation;
81
+ return (_g = translation(title)) == null ? void 0 : _g.toLowerCase();
82
+ };
74
83
  // Annotate the CommonJS export names for ESM import in node:
75
84
  0 && (module.exports = {
76
85
  formatBackgroundColors,
77
86
  formatMonthDisplay,
78
87
  getScheduleColors,
79
- getUsableSchedules
88
+ getUsableSchedules,
89
+ resourceTitle
80
90
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.211",
3
+ "version": "3.0.212",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,7 +60,7 @@
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.64",
63
+ "@pisell/materials": "3.0.65",
64
64
  "@pisell/icon": "0.0.11",
65
65
  "@pisell/date-picker": "3.0.2"
66
66
  },