@pisell/private-materials 3.0.212 → 3.0.213

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 (57) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +7 -7
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +8 -8
  9. package/es/components/Sales/Checkout/index.js +6 -0
  10. package/es/components/eftposPay/hooks.d.ts +2 -2
  11. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +6 -2
  12. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -1
  13. package/es/components/eventBooking/components/Provider/Cart/Item/Total.js +12 -6
  14. package/es/components/eventBooking/components/Provider/Cart/index.js +1 -5
  15. package/es/components/eventBooking/components/Provider/Cart/index.less +0 -2
  16. package/es/components/eventBooking/components/Provider/Content/index.js +24 -0
  17. package/es/components/eventBooking/components/Provider/Content/index.less +3 -2
  18. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.js +1 -2
  19. package/es/components/eventBooking/components/Provider/Event/index.less +1 -1
  20. package/es/components/eventBooking/components/Provider/Footer/index.js +17 -10
  21. package/es/components/eventBooking/components/Provider/Footer/index.less +29 -5
  22. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.js +1 -1
  23. package/es/components/eventBooking/components/Provider/OrderProductModal/index.js +0 -1
  24. package/es/components/eventBooking/components/Provider/SelectProduct/index.d.ts +4 -0
  25. package/es/components/eventBooking/components/Provider/SelectProduct/index.js +77 -0
  26. package/es/components/eventBooking/components/Provider/SelectProduct/index.less +131 -0
  27. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.js +1 -0
  28. package/es/components/eventBooking/components/bookingDetailModal/index.js +103 -68
  29. package/es/components/eventBooking/components/bookingDetailModal/index.less +1 -1
  30. package/es/components/eventBooking/components/selectHolder/index.js +2 -6
  31. package/es/components/eventBooking/index.less +2 -0
  32. package/es/components/tabProduct/tabs/index.less +13 -3
  33. package/lib/components/Sales/Checkout/index.js +3 -0
  34. package/lib/components/eftposPay/hooks.d.ts +2 -2
  35. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +5 -0
  36. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -1
  37. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.js +13 -6
  38. package/lib/components/eventBooking/components/Provider/Cart/index.js +1 -5
  39. package/lib/components/eventBooking/components/Provider/Cart/index.less +0 -2
  40. package/lib/components/eventBooking/components/Provider/Content/index.js +16 -0
  41. package/lib/components/eventBooking/components/Provider/Content/index.less +3 -2
  42. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.js +1 -2
  43. package/lib/components/eventBooking/components/Provider/Event/index.less +1 -1
  44. package/lib/components/eventBooking/components/Provider/Footer/index.js +13 -11
  45. package/lib/components/eventBooking/components/Provider/Footer/index.less +29 -5
  46. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.js +1 -1
  47. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.js +0 -1
  48. package/lib/components/eventBooking/components/Provider/SelectProduct/index.d.ts +4 -0
  49. package/lib/components/eventBooking/components/Provider/SelectProduct/index.js +69 -0
  50. package/lib/components/eventBooking/components/Provider/SelectProduct/index.less +131 -0
  51. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/index.js +1 -0
  52. package/lib/components/eventBooking/components/bookingDetailModal/index.js +74 -51
  53. package/lib/components/eventBooking/components/bookingDetailModal/index.less +1 -1
  54. package/lib/components/eventBooking/components/selectHolder/index.js +1 -1
  55. package/lib/components/eventBooking/index.less +2 -0
  56. package/lib/components/tabProduct/tabs/index.less +13 -3
  57. package/package.json +2 -2
@@ -0,0 +1,69 @@
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/SelectProduct/index.tsx
30
+ var SelectProduct_exports = {};
31
+ __export(SelectProduct_exports, {
32
+ default: () => SelectProduct_default
33
+ });
34
+ module.exports = __toCommonJS(SelectProduct_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_Sales = require("../../../Sales");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_materials = require("@pisell/materials");
39
+ var import_index = require("./index.less");
40
+ var SelectProduct = () => {
41
+ var _a;
42
+ const { data } = (0, import_Sales.useSales)();
43
+ const { addToCart, cartData } = (0, import_Sales.useCart)();
44
+ const handleAddToCart = (product) => {
45
+ addToCart(product);
46
+ };
47
+ const renderProductCard = (product) => {
48
+ var _a2;
49
+ const isSelected = (_a2 = cartData == null ? void 0 : cartData.cartItems) == null ? void 0 : _a2.some(
50
+ (item) => item.id === product.id
51
+ );
52
+ return /* @__PURE__ */ import_react.default.createElement(
53
+ "div",
54
+ {
55
+ key: product.id,
56
+ className: `product-card ${isSelected ? "product-card-selected" : ""}`,
57
+ onClick: () => handleAddToCart(product)
58
+ },
59
+ /* @__PURE__ */ import_react.default.createElement(import_materials.PisellCard, { bodyStyle: { padding: "16px" } }, /* @__PURE__ */ import_react.default.createElement("div", { className: "product-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "product-title" }, product.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "product-price" }, product.price, " ", product.currency)))
60
+ );
61
+ };
62
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "select-product-container" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "step-header" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "step-number" }, "Step 1"), /* @__PURE__ */ import_react.default.createElement("div", { className: "step-title" }, "Select Product")), /* @__PURE__ */ import_react.default.createElement("div", { className: "category-section" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "category-title" }, "Other"), /* @__PURE__ */ import_react.default.createElement("div", { className: "product-list" }, renderProductCard({
63
+ id: "1",
64
+ title: "appointment",
65
+ price: "1.00",
66
+ currency: "AUD"
67
+ }))), /* @__PURE__ */ import_react.default.createElement("div", { className: "cart-section" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "cart-title" }, "Your cart"), ((_a = cartData == null ? void 0 : cartData.cartItems) == null ? void 0 : _a.length) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "cart-items" }, cartData.cartItems.map((item) => /* @__PURE__ */ import_react.default.createElement("div", { key: item.id, className: "cart-item" }, item.title))) : /* @__PURE__ */ import_react.default.createElement("div", { className: "cart-empty" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "cart-empty-icon" }, "🛒"), /* @__PURE__ */ import_react.default.createElement("div", { className: "cart-empty-text" }, import_utils.locales.getText("pisell2.event.cart.empty")))));
68
+ };
69
+ var SelectProduct_default = SelectProduct;
@@ -0,0 +1,131 @@
1
+ .select-product-container {
2
+ padding: 24px;
3
+ background: #fff;
4
+
5
+ .step-header {
6
+ margin-bottom: 24px;
7
+
8
+ .step-number {
9
+ font-size: 14px;
10
+ color: #666;
11
+ margin-bottom: 8px;
12
+ }
13
+
14
+ .step-title {
15
+ font-size: 24px;
16
+ font-weight: 500;
17
+ color: #333;
18
+ }
19
+ }
20
+
21
+ .category-section {
22
+ margin-bottom: 24px;
23
+
24
+ .category-title {
25
+ font-size: 16px;
26
+ font-weight: 500;
27
+ color: #333;
28
+ margin-bottom: 16px;
29
+ }
30
+
31
+ .product-list {
32
+ display: grid;
33
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
34
+ gap: 16px;
35
+ }
36
+ }
37
+
38
+ .product-card {
39
+ cursor: pointer;
40
+ transition: all 0.3s;
41
+
42
+ &:hover {
43
+ transform: translateY(-2px);
44
+ }
45
+
46
+ &.product-card-selected {
47
+ .pisell-card {
48
+ border-color: #1890ff;
49
+ background: rgba(24, 144, 255, 0.05);
50
+ }
51
+ }
52
+
53
+ .product-content {
54
+ text-align: center;
55
+
56
+ .product-title {
57
+ font-size: 16px;
58
+ color: #333;
59
+ margin-bottom: 8px;
60
+ }
61
+
62
+ .product-price {
63
+ font-size: 14px;
64
+ color: #666;
65
+ }
66
+ }
67
+ }
68
+
69
+ .cart-section {
70
+ background: #f5f5f5;
71
+ border-radius: 4px;
72
+ padding: 24px;
73
+
74
+ .cart-title {
75
+ font-size: 18px;
76
+ font-weight: 500;
77
+ color: #333;
78
+ margin-bottom: 16px;
79
+ }
80
+
81
+ .cart-empty {
82
+ text-align: center;
83
+ padding: 32px 0;
84
+
85
+ .cart-empty-icon {
86
+ font-size: 24px;
87
+ margin-bottom: 8px;
88
+ }
89
+
90
+ .cart-empty-text {
91
+ color: #999;
92
+ }
93
+ }
94
+
95
+ .cart-items {
96
+ .cart-item {
97
+ padding: 12px;
98
+ background: #fff;
99
+ border-radius: 4px;
100
+ margin-bottom: 8px;
101
+
102
+ &:last-child {
103
+ margin-bottom: 0;
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ // 移动端适配
111
+ @media screen and (max-width: 768px) {
112
+ .select-product-container {
113
+ padding: 16px;
114
+
115
+ .step-header {
116
+ margin-bottom: 16px;
117
+
118
+ .step-title {
119
+ font-size: 20px;
120
+ }
121
+ }
122
+
123
+ .product-list {
124
+ grid-template-columns: 1fr !important;
125
+ }
126
+
127
+ .cart-section {
128
+ padding: 16px;
129
+ }
130
+ }
131
+ }
@@ -184,6 +184,7 @@ var CalendarDate = (props, ref) => {
184
184
  {
185
185
  open,
186
186
  title: "device",
187
+ mobileModalHeight: "auto",
187
188
  platform: (0, import_utils.isMobile)() ? "h5" : "pc",
188
189
  bodyStyle: { padding: (0, import_utils.isMobile)() ? "16px 24px" : 32 },
189
190
  destroyOnClose: true,
@@ -53,6 +53,7 @@ var BookingDetailModal = (props) => {
53
53
  const [isScrolling, setIsScrolling] = (0, import_react.useState)(false);
54
54
  const [openCheckout, setOpenCheckout] = (0, import_react.useState)(false);
55
55
  const isUserClickRef = (0, import_react.useRef)(false);
56
+ const scrollTimeoutRef = (0, import_react.useRef)(null);
56
57
  const anchorOptions = (0, import_react.useMemo)(
57
58
  () => [
58
59
  {
@@ -101,66 +102,89 @@ var BookingDetailModal = (props) => {
101
102
  if (!modalContentRef.current || !open)
102
103
  return;
103
104
  const handleScroll = () => {
104
- var _a2, _b, _c;
105
105
  if (isScrolling || isUserClickRef.current)
106
106
  return;
107
107
  const container2 = modalContentRef.current;
108
108
  if (!container2)
109
109
  return;
110
- const scrollTop = container2.scrollTop;
111
- const headerHeight = 58;
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;
110
+ if (scrollTimeoutRef.current) {
111
+ clearTimeout(scrollTimeoutRef.current);
120
112
  }
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);
113
+ scrollTimeoutRef.current = setTimeout(() => {
114
+ const scrollTop = container2.scrollTop;
115
+ const headerHeight = 58;
116
+ const containerHeight = container2.clientHeight;
117
+ const scrollHeight = container2.scrollHeight;
118
+ const viewportMiddle = headerHeight + (containerHeight - headerHeight) / 2;
119
+ const sectionPositions = anchorOptions.map((option) => {
120
+ const element = document.getElementById(option.id);
121
+ if (!element)
122
+ return null;
123
+ const rect = element.getBoundingClientRect();
124
+ return {
125
+ id: option.id,
126
+ top: rect.top,
127
+ bottom: rect.bottom,
128
+ height: rect.height,
129
+ // 添加可见度计算
130
+ visibleTop: Math.max(rect.top, headerHeight),
131
+ visibleBottom: Math.min(rect.bottom, containerHeight),
132
+ // 计算元素中点到视口中点的距离
133
+ distanceToCenter: Math.abs((rect.top + rect.bottom) / 2 - viewportMiddle)
134
+ };
135
+ }).filter((section) => section !== null);
136
+ const isAtBottom = Math.abs(scrollTop + containerHeight - scrollHeight) <= 2;
137
+ if (isAtBottom) {
138
+ const lastOption = anchorOptions[anchorOptions.length - 1];
139
+ if (activeTab !== lastOption.id) {
140
+ setActiveTab(lastOption.id);
141
+ }
128
142
  return;
129
143
  }
130
- }
131
- const visibleElements = anchorOptions.map((option) => {
132
- const element = document.getElementById(option.id);
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;
150
- }
151
- if (a.top < headerHeight && b.top < headerHeight) {
152
- return b.top - a.top;
144
+ let bestSection = null;
145
+ const sectionsWithPriority = sectionPositions.map((section) => {
146
+ const visibleHeight = section.visibleBottom - section.visibleTop;
147
+ const visibilityRatio = visibleHeight / section.height;
148
+ const topDistance = Math.abs(section.top - headerHeight);
149
+ const priority = (
150
+ // 基础可见度权重
151
+ visibilityRatio * 0.6 + // 小内容区域补偿
152
+ (section.height < 200 ? 0.3 : 0) + // 距离权重(反比,越近权重越大)
153
+ 0.4 * (1 - Math.min(topDistance / containerHeight, 1))
154
+ );
155
+ return {
156
+ ...section,
157
+ visibilityRatio,
158
+ topDistance,
159
+ priority
160
+ };
161
+ });
162
+ sectionsWithPriority.sort((a, b) => {
163
+ if (a.visibilityRatio > 0.1 && b.visibilityRatio > 0.1) {
164
+ if (Math.abs(a.topDistance - b.topDistance) < 50) {
165
+ return b.priority - a.priority;
166
+ }
167
+ return a.topDistance - b.topDistance;
168
+ }
169
+ return b.priority - a.priority;
170
+ });
171
+ bestSection = sectionsWithPriority[0];
172
+ if (bestSection && activeTab !== bestSection.id) {
173
+ const currentSection = sectionPositions.find((s) => s.id === activeTab);
174
+ if (!currentSection || bestSection.priority > (currentSection.priority || 0) + 0.2 || bestSection.visibilityRatio > 0.3 && bestSection.topDistance < currentSection.topDistance) {
175
+ setActiveTab(bestSection.id);
176
+ }
153
177
  }
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);
159
- }
178
+ }, 200);
160
179
  };
161
180
  const container = modalContentRef.current;
162
181
  container.addEventListener("scroll", handleScroll);
163
- return () => container.removeEventListener("scroll", handleScroll);
182
+ return () => {
183
+ container.removeEventListener("scroll", handleScroll);
184
+ if (scrollTimeoutRef.current) {
185
+ clearTimeout(scrollTimeoutRef.current);
186
+ }
187
+ };
164
188
  }, [anchorOptions, activeTab, open, isScrolling]);
165
189
  const handleTabChange = (key) => {
166
190
  if (isUserClickRef.current) {
@@ -224,11 +248,10 @@ var BookingDetailModal = (props) => {
224
248
  open,
225
249
  title: import_utils.locales.getText("pisell2.event.details"),
226
250
  platform: (0, import_utils.isMobile)() ? "h5" : "pc",
227
- bodyStyle: { padding: 0, overflow: "hidden" },
251
+ bodyStyle: { padding: 0 },
228
252
  destroyOnClose: true,
229
- mobileModalHeight: "80vh",
230
253
  className: "booking-detail-modal",
231
- onCancel: () => onCloseEventDetail(),
254
+ onCancel: onCloseEventDetail,
232
255
  okText: import_utils.locales.getText("pisell2.event.add.to.cart"),
233
256
  cancelVisible: false,
234
257
  onOk: handleOk,
@@ -2,7 +2,7 @@
2
2
  .booking-detail-modal-content {
3
3
  display: flex;
4
4
  flex-direction: column;
5
- height: calc(80vh - 140px);
5
+ height: 100%;
6
6
  overflow-y: auto;
7
7
  overflow-x: hidden;
8
8
  scroll-behavior: smooth;
@@ -81,7 +81,7 @@ var PisellSelectHolder = ({
81
81
  onOk && onOk(e);
82
82
  },
83
83
  bodyStyle: { padding: (0, import_utils.isMobile)() ? "0 16px 16px" : 20 },
84
- mobileModalHeight: "90%",
84
+ mobileModalHeight: "auto",
85
85
  destroyOnClose: true,
86
86
  className: `select-holder-modal ${(0, import_utils.isMobile)() ? "select-holder-modal-mobile" : ""}`,
87
87
  headerDivider: false
@@ -14,6 +14,8 @@
14
14
  }
15
15
 
16
16
  .event-booking-mobile-wrap {
17
+ background: #ffffff;
18
+ min-height: 100vh;
17
19
  .pisell-section-headers-content {
18
20
  width: 100%;
19
21
  }
@@ -108,9 +108,19 @@
108
108
  white-space: nowrap;
109
109
  }
110
110
 
111
- &:hover {
112
- .pisell-tabs-tab-content {
113
- background-color: #f1f1f1;
111
+ @media (min-width: 769px) {
112
+ &:hover {
113
+ .pisell-tabs-tab-content {
114
+ background-color: #f1f1f1;
115
+ }
116
+ }
117
+ }
118
+
119
+ @media (max-width: 768px) {
120
+ &:hover {
121
+ .pisell-tabs-tab-content {
122
+ background-color: transparent;
123
+ }
114
124
  }
115
125
  }
116
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.212",
3
+ "version": "3.0.213",
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.65",
63
+ "@pisell/materials": "3.0.66",
64
64
  "@pisell/icon": "0.0.11",
65
65
  "@pisell/date-picker": "3.0.2"
66
66
  },