@pisell/private-materials 3.4.76 → 3.4.78

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 (208) 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 +2 -2
  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 +10 -10
  11. package/es/components/booking/addons/model.d.ts +1 -10
  12. package/es/components/booking/forms/model.d.ts +1 -10
  13. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  14. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  15. package/es/components/booking/info/model.d.ts +1 -10
  16. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  17. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  18. package/es/components/booking/model.d.ts +1 -9
  19. package/es/components/booking/notes/model.d.ts +1 -10
  20. package/es/components/booking/payments/model.d.ts +1 -10
  21. package/es/components/booking/utils.d.ts +2 -2
  22. package/es/components/eftpos/hooks.d.ts +0 -1
  23. package/es/components/eftposPay/amount.d.ts +1 -1
  24. package/es/components/eftposPay/device.d.ts +1 -1
  25. package/es/components/eftposPay/hooks.d.ts +1 -1
  26. package/es/components/eftposPay/store/index.d.ts +2 -2
  27. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  28. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  29. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  30. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  31. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  32. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  33. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  34. package/es/components/pay/toC/model.d.ts +1 -9
  35. package/es/components/schedules/model.d.ts +1 -9
  36. package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
  37. package/es/hooks/useTranslationOriginal.d.ts +1 -0
  38. package/es/hooks/useTranslationOriginal.js +10 -0
  39. package/es/index.d.ts +3 -0
  40. package/es/index.js +3 -0
  41. package/es/plus/clientCard/index.d.ts +7 -0
  42. package/es/plus/clientCard/index.js +462 -0
  43. package/es/plus/clientCard/index.less +515 -0
  44. package/es/plus/clientCard/line/index.d.ts +9 -0
  45. package/es/plus/clientCard/line/index.js +157 -0
  46. package/es/plus/clientCard/line/index.less +142 -0
  47. package/es/plus/clientCard/locales.d.ts +18 -0
  48. package/es/plus/clientCard/locales.js +17 -0
  49. package/es/plus/clientCard/types.d.ts +135 -0
  50. package/es/plus/clientCard/types.js +1 -0
  51. package/es/plus/clientCard/utils.d.ts +8 -0
  52. package/es/plus/clientCard/utils.js +59 -0
  53. package/es/plus/clinetSearch/Add/BirthdayField/index.d.ts +3 -0
  54. package/es/plus/clinetSearch/Add/BirthdayField/index.js +277 -0
  55. package/es/plus/clinetSearch/Add/GenderField/index.d.ts +3 -0
  56. package/es/plus/clinetSearch/Add/GenderField/index.js +18 -0
  57. package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +3 -0
  58. package/es/plus/clinetSearch/Add/PhoneField/index.js +52 -0
  59. package/es/plus/clinetSearch/Add/PhoneField/serve.d.ts +2 -0
  60. package/es/plus/clinetSearch/Add/PhoneField/serve.js +166 -0
  61. package/es/plus/clinetSearch/Add/index.d.ts +18 -0
  62. package/es/plus/clinetSearch/Add/index.js +213 -0
  63. package/es/plus/clinetSearch/Add/index.less +30 -0
  64. package/es/plus/clinetSearch/InfiniteScroll/InfiniteScroll.d.ts +5 -0
  65. package/es/plus/clinetSearch/InfiniteScroll/InfiniteScroll.js +265 -0
  66. package/es/plus/clinetSearch/InfiniteScroll/index.d.ts +2 -0
  67. package/es/plus/clinetSearch/InfiniteScroll/index.js +1 -0
  68. package/es/plus/clinetSearch/InfiniteScroll/types.d.ts +46 -0
  69. package/es/plus/clinetSearch/InfiniteScroll/types.js +1 -0
  70. package/es/plus/clinetSearch/index.d.ts +18 -0
  71. package/es/plus/clinetSearch/index.js +234 -0
  72. package/es/plus/clinetSearch/index.less +95 -0
  73. package/es/plus/clinetSearch/locales.d.ts +108 -0
  74. package/es/plus/clinetSearch/locales.js +107 -0
  75. package/es/plus/clinetSearch/serve.d.ts +1 -0
  76. package/es/plus/clinetSearch/serve.js +31 -0
  77. package/es/plus/clinetSearch/types.d.ts +70 -0
  78. package/es/plus/clinetSearch/types.js +1 -0
  79. package/es/plus/saasAttendance/locales.d.ts +63 -0
  80. package/es/plus/saasAttendance/locales.js +71 -2
  81. package/es/plus/saasAttendance/settings/PermissonTab.d.ts +5 -0
  82. package/es/plus/saasAttendance/settings/PermissonTab.js +79 -0
  83. package/es/plus/saasAttendance/settings/ShiftScheduleTab.js +9 -3
  84. package/es/plus/saasAttendance/settings/components/MapField.js +69 -33
  85. package/es/plus/saasAttendance/settings/components/shiftModal/ShiftPreview.d.ts +7 -0
  86. package/es/plus/saasAttendance/settings/components/shiftModal/ShiftPreview.js +149 -0
  87. package/es/plus/saasAttendance/settings/components/shiftModal/ShiftPreview.less +119 -0
  88. package/es/plus/saasAttendance/settings/index.js +7 -0
  89. package/es/plus/saasAttendance/settings/index.less +15 -0
  90. package/es/plus/saasAttendance/settings/types.d.ts +6 -0
  91. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  92. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +2 -0
  93. package/es/plus/walletPassGallery/components/passDetail/index.js +104 -39
  94. package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +2 -0
  95. package/es/plus/walletPassGallery/components/timelineSection/index.js +19 -2
  96. package/es/plus/walletPassGallery/index.d.ts +4 -0
  97. package/es/plus/walletPassGallery/index.js +121 -42
  98. package/es/plus/walletPassGallery/serve.d.ts +3 -1
  99. package/es/plus/walletPassGallery/serve.js +13 -13
  100. package/es/pro/pisellPhoneKeyboard/index.d.ts +13 -0
  101. package/es/pro/pisellPhoneKeyboard/index.js +210 -0
  102. package/es/pro/pisellPhoneKeyboard/index.less +157 -0
  103. package/es/pro/pisellPhoneKeyboard/locales.d.ts +12 -0
  104. package/es/pro/pisellPhoneKeyboard/locales.js +11 -0
  105. package/lib/components/booking/addons/model.d.ts +1 -10
  106. package/lib/components/booking/forms/model.d.ts +1 -10
  107. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  108. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  109. package/lib/components/booking/info/model.d.ts +1 -10
  110. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  111. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  112. package/lib/components/booking/model.d.ts +1 -9
  113. package/lib/components/booking/notes/model.d.ts +1 -10
  114. package/lib/components/booking/payments/model.d.ts +1 -10
  115. package/lib/components/booking/utils.d.ts +2 -2
  116. package/lib/components/eftpos/hooks.d.ts +0 -1
  117. package/lib/components/eftposPay/amount.d.ts +1 -1
  118. package/lib/components/eftposPay/device.d.ts +1 -1
  119. package/lib/components/eftposPay/hooks.d.ts +1 -1
  120. package/lib/components/eftposPay/store/index.d.ts +2 -2
  121. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  122. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  123. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  124. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  125. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  126. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  127. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  128. package/lib/components/pay/toC/model.d.ts +1 -9
  129. package/lib/components/schedules/model.d.ts +1 -9
  130. package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
  131. package/lib/hooks/useTranslationOriginal.d.ts +1 -0
  132. package/lib/hooks/useTranslationOriginal.js +42 -0
  133. package/lib/index.d.ts +3 -0
  134. package/lib/index.js +9 -0
  135. package/lib/plus/clientCard/index.d.ts +7 -0
  136. package/lib/plus/clientCard/index.js +457 -0
  137. package/lib/plus/clientCard/index.less +515 -0
  138. package/lib/plus/clientCard/line/index.d.ts +9 -0
  139. package/lib/plus/clientCard/line/index.js +153 -0
  140. package/lib/plus/clientCard/line/index.less +142 -0
  141. package/lib/plus/clientCard/locales.d.ts +18 -0
  142. package/lib/plus/clientCard/locales.js +41 -0
  143. package/lib/plus/clientCard/types.d.ts +135 -0
  144. package/lib/plus/clientCard/types.js +17 -0
  145. package/lib/plus/clientCard/utils.d.ts +8 -0
  146. package/lib/plus/clientCard/utils.js +75 -0
  147. package/lib/plus/clinetSearch/Add/BirthdayField/index.d.ts +3 -0
  148. package/lib/plus/clinetSearch/Add/BirthdayField/index.js +256 -0
  149. package/lib/plus/clinetSearch/Add/GenderField/index.d.ts +3 -0
  150. package/lib/plus/clinetSearch/Add/GenderField/index.js +52 -0
  151. package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +3 -0
  152. package/lib/plus/clinetSearch/Add/PhoneField/index.js +78 -0
  153. package/lib/plus/clinetSearch/Add/PhoneField/serve.d.ts +2 -0
  154. package/lib/plus/clinetSearch/Add/PhoneField/serve.js +193 -0
  155. package/lib/plus/clinetSearch/Add/index.d.ts +18 -0
  156. package/lib/plus/clinetSearch/Add/index.js +244 -0
  157. package/lib/plus/clinetSearch/Add/index.less +30 -0
  158. package/lib/plus/clinetSearch/InfiniteScroll/InfiniteScroll.d.ts +5 -0
  159. package/lib/plus/clinetSearch/InfiniteScroll/InfiniteScroll.js +235 -0
  160. package/lib/plus/clinetSearch/InfiniteScroll/index.d.ts +2 -0
  161. package/lib/plus/clinetSearch/InfiniteScroll/index.js +35 -0
  162. package/lib/plus/clinetSearch/InfiniteScroll/types.d.ts +46 -0
  163. package/lib/plus/clinetSearch/InfiniteScroll/types.js +17 -0
  164. package/lib/plus/clinetSearch/index.d.ts +18 -0
  165. package/lib/plus/clinetSearch/index.js +237 -0
  166. package/lib/plus/clinetSearch/index.less +95 -0
  167. package/lib/plus/clinetSearch/locales.d.ts +108 -0
  168. package/lib/plus/clinetSearch/locales.js +131 -0
  169. package/lib/plus/clinetSearch/serve.d.ts +1 -0
  170. package/lib/plus/clinetSearch/serve.js +33 -0
  171. package/lib/plus/clinetSearch/types.d.ts +70 -0
  172. package/lib/plus/clinetSearch/types.js +17 -0
  173. package/lib/plus/saasAttendance/locales.d.ts +63 -0
  174. package/lib/plus/saasAttendance/locales.js +65 -2
  175. package/lib/plus/saasAttendance/settings/PermissonTab.d.ts +5 -0
  176. package/lib/plus/saasAttendance/settings/PermissonTab.js +128 -0
  177. package/lib/plus/saasAttendance/settings/ShiftScheduleTab.js +2 -1
  178. package/lib/plus/saasAttendance/settings/components/MapField.js +50 -11
  179. package/lib/plus/saasAttendance/settings/components/shiftModal/ShiftPreview.d.ts +7 -0
  180. package/lib/plus/saasAttendance/settings/components/shiftModal/ShiftPreview.js +150 -0
  181. package/lib/plus/saasAttendance/settings/components/shiftModal/ShiftPreview.less +119 -0
  182. package/lib/plus/saasAttendance/settings/index.js +12 -0
  183. package/lib/plus/saasAttendance/settings/index.less +15 -0
  184. package/lib/plus/saasAttendance/settings/types.d.ts +6 -0
  185. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  186. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +2 -0
  187. package/lib/plus/walletPassGallery/components/passDetail/index.js +57 -5
  188. package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +2 -0
  189. package/lib/plus/walletPassGallery/components/timelineSection/index.js +17 -2
  190. package/lib/plus/walletPassGallery/index.d.ts +4 -0
  191. package/lib/plus/walletPassGallery/index.js +141 -42
  192. package/lib/plus/walletPassGallery/serve.d.ts +3 -1
  193. package/lib/plus/walletPassGallery/serve.js +2 -2
  194. package/lib/pro/pisellPhoneKeyboard/index.d.ts +13 -0
  195. package/lib/pro/pisellPhoneKeyboard/index.js +219 -0
  196. package/lib/pro/pisellPhoneKeyboard/index.less +157 -0
  197. package/lib/pro/pisellPhoneKeyboard/locales.d.ts +12 -0
  198. package/lib/pro/pisellPhoneKeyboard/locales.js +35 -0
  199. package/lowcode/client-card/fragments/cardStyle.ts +63 -0
  200. package/lowcode/client-card/fragments/nameStyle.ts +34 -0
  201. package/lowcode/client-card/fragments/pisellAvatar.ts +87 -0
  202. package/lowcode/client-card/fragments/tagConfig.ts +88 -0
  203. package/lowcode/client-card/meta.ts +343 -0
  204. package/lowcode/client-search/meta.ts +316 -0
  205. package/lowcode/eco-cup-list/meta.ts +1 -1
  206. package/lowcode/eco-customer-list/meta.ts +1 -1
  207. package/lowcode/wallet-pass-gallery/meta.ts +66 -1
  208. package/package.json +4 -4
@@ -0,0 +1,235 @@
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/plus/clinetSearch/InfiniteScroll/InfiniteScroll.tsx
30
+ var InfiniteScroll_exports = {};
31
+ __export(InfiniteScroll_exports, {
32
+ default: () => InfiniteScroll_default
33
+ });
34
+ module.exports = __toCommonJS(InfiniteScroll_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var InfiniteScroll = ({
37
+ dataLength,
38
+ next,
39
+ hasMore,
40
+ loader = /* @__PURE__ */ import_react.default.createElement("div", null, "Loading..."),
41
+ endMessage,
42
+ height,
43
+ scrollThreshold = 0.8,
44
+ onScroll,
45
+ style,
46
+ className,
47
+ scrollableTarget,
48
+ children,
49
+ inverse = false
50
+ }) => {
51
+ const [isLoading, setIsLoading] = (0, import_react.useState)(false);
52
+ const containerRef = (0, import_react.useRef)(null);
53
+ const lastDataLength = (0, import_react.useRef)(dataLength);
54
+ const scrollTimeoutRef = (0, import_react.useRef)(null);
55
+ const isMountedRef = (0, import_react.useRef)(true);
56
+ const lastCallTimeRef = (0, import_react.useRef)(0);
57
+ const throttle = (0, import_react.useCallback)((func, delay) => {
58
+ return (...args) => {
59
+ if (scrollTimeoutRef.current) {
60
+ clearTimeout(scrollTimeoutRef.current);
61
+ }
62
+ scrollTimeoutRef.current = setTimeout(() => func(...args), delay);
63
+ };
64
+ }, []);
65
+ const getScrollThreshold = (0, import_react.useCallback)(() => {
66
+ if (typeof scrollThreshold === "string" && scrollThreshold.endsWith("px")) {
67
+ return parseInt(scrollThreshold.replace("px", ""), 10);
68
+ }
69
+ return typeof scrollThreshold === "number" ? scrollThreshold : 0.8;
70
+ }, [scrollThreshold]);
71
+ const checkScrollPosition = (0, import_react.useCallback)(
72
+ (element) => {
73
+ if (!element || !hasMore || isLoading) return;
74
+ const threshold = getScrollThreshold();
75
+ const { scrollTop, scrollHeight, clientHeight } = element;
76
+ if (scrollHeight <= 0 || clientHeight <= 0) {
77
+ console.warn("InfiniteScroll: 检测到无效的滚动容器尺寸");
78
+ return;
79
+ }
80
+ const normalizedScrollTop = Math.max(0, scrollTop);
81
+ let shouldLoadMore = false;
82
+ if (inverse) {
83
+ if (typeof threshold === "number" && threshold < 1) {
84
+ const scrollPercentage = normalizedScrollTop / scrollHeight;
85
+ shouldLoadMore = scrollPercentage <= 1 - threshold;
86
+ } else {
87
+ shouldLoadMore = normalizedScrollTop <= threshold;
88
+ }
89
+ } else {
90
+ if (typeof threshold === "number" && threshold < 1) {
91
+ const scrollPercentage = (normalizedScrollTop + clientHeight) / scrollHeight;
92
+ shouldLoadMore = scrollPercentage >= threshold;
93
+ } else {
94
+ const remainingHeight = scrollHeight - normalizedScrollTop - clientHeight;
95
+ shouldLoadMore = remainingHeight <= threshold;
96
+ }
97
+ }
98
+ if (shouldLoadMore) {
99
+ const now = Date.now();
100
+ if (now - lastCallTimeRef.current < 500) {
101
+ return;
102
+ }
103
+ lastCallTimeRef.current = now;
104
+ setIsLoading(true);
105
+ try {
106
+ next();
107
+ } catch (error) {
108
+ console.error("InfiniteScroll: 加载更多数据时发生错误:", error);
109
+ if (isMountedRef.current) {
110
+ setIsLoading(false);
111
+ }
112
+ }
113
+ }
114
+ },
115
+ [hasMore, isLoading, next, getScrollThreshold, inverse]
116
+ );
117
+ const checkInitialLoad = (0, import_react.useCallback)(() => {
118
+ const element = scrollableTarget ? document.getElementById(scrollableTarget) : containerRef.current;
119
+ if (!element || !hasMore || isLoading) return;
120
+ const { scrollHeight, clientHeight } = element;
121
+ if (clientHeight <= 0) {
122
+ console.warn("InfiniteScroll: 容器高度无效,可能容器尚未渲染完成");
123
+ return;
124
+ }
125
+ const needsMoreContent = scrollHeight <= clientHeight || dataLength === 0;
126
+ if (needsMoreContent) {
127
+ const now = Date.now();
128
+ if (now - lastCallTimeRef.current < 500) {
129
+ return;
130
+ }
131
+ lastCallTimeRef.current = now;
132
+ setIsLoading(true);
133
+ try {
134
+ next();
135
+ } catch (error) {
136
+ console.error("InfiniteScroll: 初始加载时发生错误:", error);
137
+ if (isMountedRef.current) {
138
+ setIsLoading(false);
139
+ }
140
+ }
141
+ }
142
+ }, [hasMore, isLoading, next, scrollableTarget, dataLength]);
143
+ const handleScrollInternal = (0, import_react.useCallback)(
144
+ (event) => {
145
+ try {
146
+ const element = event.target;
147
+ if (!element || typeof element.scrollTop === "undefined") {
148
+ console.warn("InfiniteScroll: 无效的滚动目标元素");
149
+ return;
150
+ }
151
+ checkScrollPosition(element);
152
+ if (onScroll) {
153
+ onScroll(event);
154
+ }
155
+ } catch (error) {
156
+ console.error("InfiniteScroll: 滚动事件处理时发生错误:", error);
157
+ }
158
+ },
159
+ [checkScrollPosition, onScroll]
160
+ );
161
+ const handleScroll = (0, import_react.useMemo)(
162
+ () => throttle(handleScrollInternal, 16),
163
+ // 约60fps
164
+ [throttle, handleScrollInternal]
165
+ );
166
+ (0, import_react.useEffect)(() => {
167
+ if (dataLength !== lastDataLength.current) {
168
+ if (isMountedRef.current) {
169
+ setIsLoading(false);
170
+ }
171
+ lastDataLength.current = dataLength;
172
+ }
173
+ }, [dataLength]);
174
+ (0, import_react.useEffect)(() => {
175
+ return () => {
176
+ isMountedRef.current = false;
177
+ };
178
+ }, []);
179
+ (0, import_react.useEffect)(() => {
180
+ return () => {
181
+ if (scrollTimeoutRef.current) {
182
+ clearTimeout(scrollTimeoutRef.current);
183
+ }
184
+ };
185
+ }, []);
186
+ (0, import_react.useEffect)(() => {
187
+ const timeoutId = setTimeout(() => {
188
+ checkInitialLoad();
189
+ }, 100);
190
+ return () => clearTimeout(timeoutId);
191
+ }, [checkInitialLoad, dataLength]);
192
+ (0, import_react.useEffect)(() => {
193
+ if (!isLoading && hasMore) {
194
+ const timeoutId = setTimeout(() => {
195
+ checkInitialLoad();
196
+ }, 100);
197
+ return () => clearTimeout(timeoutId);
198
+ }
199
+ }, [isLoading, hasMore, checkInitialLoad]);
200
+ (0, import_react.useEffect)(() => {
201
+ const element = scrollableTarget ? document.getElementById(scrollableTarget) : containerRef.current;
202
+ if (!element) {
203
+ console.warn("InfiniteScroll: 无法找到滚动容器元素");
204
+ return;
205
+ }
206
+ const scrollHandler = handleScroll;
207
+ element.addEventListener("scroll", scrollHandler, { passive: true });
208
+ return () => {
209
+ if (element) {
210
+ element.removeEventListener("scroll", scrollHandler);
211
+ }
212
+ };
213
+ }, [handleScroll, scrollableTarget]);
214
+ const containerStyle = (0, import_react.useMemo)(() => ({
215
+ ...style,
216
+ ...height && {
217
+ height: typeof height === "number" ? `${height}px` : height,
218
+ overflowY: "auto"
219
+ },
220
+ ...inverse && {
221
+ display: "flex",
222
+ flexDirection: "column-reverse"
223
+ }
224
+ }), [style, height, inverse]);
225
+ return /* @__PURE__ */ import_react.default.createElement(
226
+ "div",
227
+ {
228
+ ref: !scrollableTarget ? containerRef : void 0,
229
+ className,
230
+ style: containerStyle
231
+ },
232
+ inverse ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, isLoading && hasMore && loader, !hasMore && endMessage, children) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children, isLoading && hasMore && loader, !hasMore && endMessage)
233
+ );
234
+ };
235
+ var InfiniteScroll_default = InfiniteScroll;
@@ -0,0 +1,2 @@
1
+ export { default } from './InfiniteScroll';
2
+ export type { InfiniteScrollProps, ScrollPosition, TouchInfo, InfiniteScrollState } from './types';
@@ -0,0 +1,35 @@
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/plus/clinetSearch/InfiniteScroll/index.ts
30
+ var InfiniteScroll_exports = {};
31
+ __export(InfiniteScroll_exports, {
32
+ default: () => import_InfiniteScroll.default
33
+ });
34
+ module.exports = __toCommonJS(InfiniteScroll_exports);
35
+ var import_InfiniteScroll = __toESM(require("./InfiniteScroll"));
@@ -0,0 +1,46 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+ /**
3
+ * 无限滚动组件的属性接口
4
+ */
5
+ export interface InfiniteScrollProps {
6
+ /** 数据长度,用于判断是否需要加载更多 */
7
+ dataLength: number;
8
+ /** 加载更多数据的函数 */
9
+ next: () => void;
10
+ /** 是否还有更多数据 */
11
+ hasMore: boolean;
12
+ /** 加载中显示的组件 */
13
+ loader?: ReactNode;
14
+ /** 没有更多数据时显示的组件 */
15
+ endMessage?: ReactNode;
16
+ /** 滚动容器的高度 */
17
+ height?: number | string;
18
+ /** 滚动阈值,0-1之间的数值或像素值 */
19
+ scrollThreshold?: number | string;
20
+ /** 滚动事件回调 */
21
+ onScroll?: (event: Event) => void;
22
+ /** 自定义样式 */
23
+ style?: CSSProperties;
24
+ /** 自定义类名 */
25
+ className?: string;
26
+ /** 指定滚动容器的目标元素ID */
27
+ scrollableTarget?: string;
28
+ /** 子元素 */
29
+ children: ReactNode;
30
+ /** 是否反向滚动 */
31
+ inverse?: boolean;
32
+ }
33
+ /**
34
+ * 滚动位置信息
35
+ */
36
+ export interface ScrollPosition {
37
+ scrollTop: number;
38
+ scrollHeight: number;
39
+ clientHeight: number;
40
+ }
41
+ /**
42
+ * 组件内部状态
43
+ */
44
+ export interface InfiniteScrollState {
45
+ isLoading: boolean;
46
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/plus/clinetSearch/InfiniteScroll/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { TableProps } from 'antd';
3
+ import type { ComprehensiveSearchProps } from '../../pro/comprehensiveSearch/types';
4
+ import type { ClientData } from './types';
5
+ import './index.less';
6
+ interface ClientSearchProps extends Omit<ComprehensiveSearchProps, 'resultDisplay' | 'onRowClick'> {
7
+ onRowClick?: (record: ClientData, index: number) => void;
8
+ onAddClient?: (record: ClientData, isChecked: boolean) => void;
9
+ resultProps?: TableProps<ClientData>;
10
+ hasMore?: boolean;
11
+ onLoadMore?: () => void;
12
+ state?: any;
13
+ }
14
+ export declare type ClientSearchRef = {
15
+ resetScrollPosition: () => void;
16
+ };
17
+ declare const ClientSearch: React.ForwardRefExoticComponent<ClientSearchProps & React.RefAttributes<ClientSearchRef>>;
18
+ export default ClientSearch;
@@ -0,0 +1,237 @@
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/plus/clinetSearch/index.tsx
30
+ var clinetSearch_exports = {};
31
+ __export(clinetSearch_exports, {
32
+ default: () => clinetSearch_default
33
+ });
34
+ module.exports = __toCommonJS(clinetSearch_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_dayjs = __toESM(require("dayjs"));
39
+ var import_InfiniteScroll = __toESM(require("./InfiniteScroll"));
40
+ var import_comprehensiveSearch = __toESM(require("../../pro/comprehensiveSearch"));
41
+ var import_clientName = __toESM(require("../clientName"));
42
+ var import_Add = __toESM(require("./Add"));
43
+ var import_locales = __toESM(require("./locales"));
44
+ var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
45
+ var import_useTranslationOriginal = __toESM(require("../../hooks/useTranslationOriginal"));
46
+ var import_index = require("./index.less");
47
+ var ClientSearch = (0, import_react.forwardRef)(
48
+ ({
49
+ onRowClick,
50
+ resultProps,
51
+ onAddClient,
52
+ hasMore,
53
+ onLoadMore,
54
+ state,
55
+ ...props
56
+ }, ref) => {
57
+ var _a, _b, _c, _d, _e, _f, _g, _h;
58
+ const [modalVisible, setModalVisible] = (0, import_react.useState)(false);
59
+ const comprehensiveSearchRef = (0, import_react.useRef)(null);
60
+ const addClientRef = (0, import_react.useRef)(null);
61
+ const scrollContainerRef = (0, import_react.useRef)(null);
62
+ const translationOriginal = (0, import_useTranslationOriginal.default)();
63
+ const context = (0, import_useEngineContext.default)();
64
+ import_utils.locales.init(
65
+ import_locales.default,
66
+ ((_c = (_b = (_a = context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.storage) == null ? void 0 : _c.get("umi_locale")) || "en"
67
+ );
68
+ const appointmentSubject = ((_f = (_e = (_d = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _d.config) == null ? void 0 : _e.basic) == null ? void 0 : _f.appointment_subject) || {};
69
+ const translation = (_h = (_g = context == null ? void 0 : context.appHelper) == null ? void 0 : _g.utils) == null ? void 0 : _h.translationShop;
70
+ const handleAdd = () => {
71
+ setModalVisible(true);
72
+ };
73
+ const handleModalCancel = () => {
74
+ var _a2;
75
+ setModalVisible(false);
76
+ (_a2 = addClientRef.current) == null ? void 0 : _a2.reset();
77
+ };
78
+ const renderListHeader = () => {
79
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "client-search-list-header" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "header-item", style: { width: 180 } }, import_utils.locales.getText("pisell2.text.client-search.name")), /* @__PURE__ */ import_react.default.createElement("div", { className: "header-item", style: { width: 110 } }, import_utils.locales.getText("pisell2.text.client-search.register-time")), /* @__PURE__ */ import_react.default.createElement("div", { className: "header-item", style: { width: 125 } }, import_utils.locales.getText("pisell2.text.client-search.membership")), /* @__PURE__ */ import_react.default.createElement("div", { className: "header-item", style: { width: 180 } }, import_utils.locales.getText("pisell2.text.client-search.contact-info")), /* @__PURE__ */ import_react.default.createElement("div", { className: "header-item", style: { width: 200 } }, translation(appointmentSubject == null ? void 0 : appointmentSubject.form_name) || import_utils.locales.getText("pisell2.text.client-search.holder")));
80
+ };
81
+ const renderResults = (searchResults) => {
82
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, (searchResults == null ? void 0 : searchResults.length) ? renderListHeader() : null, /* @__PURE__ */ import_react.default.createElement(
83
+ "div",
84
+ {
85
+ ref: scrollContainerRef,
86
+ id: "client-search_infinite-scroll",
87
+ style: {
88
+ height: "calc(100% - 40px)",
89
+ overflowY: "auto",
90
+ overflowX: "hidden",
91
+ display: "flex"
92
+ }
93
+ },
94
+ /* @__PURE__ */ import_react.default.createElement(
95
+ import_InfiniteScroll.default,
96
+ {
97
+ dataLength: searchResults.length,
98
+ next: () => {
99
+ console.log("loading more");
100
+ onLoadMore == null ? void 0 : onLoadMore();
101
+ },
102
+ hasMore: hasMore || false,
103
+ style: { width: "100%" },
104
+ loader: /* @__PURE__ */ import_react.default.createElement(
105
+ "div",
106
+ {
107
+ style: {
108
+ textAlign: "center",
109
+ padding: "20px",
110
+ color: "#999"
111
+ }
112
+ },
113
+ import_utils.locales.getText("pisell2.text.loading")
114
+ ),
115
+ endMessage: /* @__PURE__ */ import_react.default.createElement("div", { style: { textAlign: "center", color: "#999" } }, (searchResults == null ? void 0 : searchResults.length) ? import_utils.locales.getText("pisell2.text.no-more-data") : null),
116
+ scrollableTarget: "client-search_infinite-scroll",
117
+ scrollThreshold: "180px"
118
+ },
119
+ /* @__PURE__ */ import_react.default.createElement(
120
+ import_antd.List,
121
+ {
122
+ dataSource: searchResults,
123
+ renderItem: (item, index) => {
124
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j;
125
+ const membershipText = (_b2 = (_a2 = item.latest_wallet_detail) == null ? void 0 : _a2.wallet) == null ? void 0 : _b2.name;
126
+ return /* @__PURE__ */ import_react.default.createElement(
127
+ import_antd.List.Item,
128
+ {
129
+ key: item.id,
130
+ className: "client-search-list-item"
131
+ },
132
+ /* @__PURE__ */ import_react.default.createElement(
133
+ "div",
134
+ {
135
+ className: "list-item-content",
136
+ onClick: () => onRowClick == null ? void 0 : onRowClick(item, index || 0),
137
+ style: { cursor: "pointer" }
138
+ },
139
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "item-cell", style: { width: 180 } }, /* @__PURE__ */ import_react.default.createElement(import_clientName.default, { dataSource: item }), /* @__PURE__ */ import_react.default.createElement("div", null, item.phone || "-"), /* @__PURE__ */ import_react.default.createElement(
140
+ "div",
141
+ {
142
+ style: {
143
+ overflow: "hidden",
144
+ textOverflow: "ellipsis",
145
+ whiteSpace: "nowrap"
146
+ }
147
+ },
148
+ item.email || "-"
149
+ )),
150
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "item-cell", style: { width: 110 } }, (0, import_dayjs.default)(item.created_at).format("YYYY-MM-DD") || "-"),
151
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "item-cell", style: { width: 125 } }, membershipText && (translationOriginal == null ? void 0 : translationOriginal(membershipText)) ? /* @__PURE__ */ import_react.default.createElement(
152
+ import_antd.Tag,
153
+ {
154
+ color: "gold",
155
+ style: {
156
+ overflow: "hidden",
157
+ whiteSpace: "nowrap",
158
+ textOverflow: "ellipsis",
159
+ width: "auto",
160
+ maxWidth: "100%",
161
+ display: "inline-block",
162
+ borderRadius: 16,
163
+ marginRight: 0
164
+ }
165
+ },
166
+ translationOriginal == null ? void 0 : translationOriginal(membershipText)
167
+ ) : "-"),
168
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "item-cell", style: { width: 180 } }, /* @__PURE__ */ import_react.default.createElement(import_clientName.default, { dataSource: (_c2 = item == null ? void 0 : item.contacts_info) == null ? void 0 : _c2.value }), ((_f2 = (_e2 = (_d2 = item == null ? void 0 : item.contacts_info) == null ? void 0 : _d2.value) == null ? void 0 : _e2.phone) == null ? void 0 : _f2.phone) || "-", /* @__PURE__ */ import_react.default.createElement(
169
+ "div",
170
+ {
171
+ style: {
172
+ overflow: "hidden",
173
+ textOverflow: "ellipsis",
174
+ whiteSpace: "nowrap"
175
+ }
176
+ },
177
+ ((_h2 = (_g2 = item == null ? void 0 : item.contacts_info) == null ? void 0 : _g2.value) == null ? void 0 : _h2.email) || "-"
178
+ )),
179
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "item-cell", style: { width: 200 } }, ((_i = item == null ? void 0 : item.form_record) == null ? void 0 : _i.length) > 0 ? (_j = item == null ? void 0 : item.form_record) == null ? void 0 : _j.map((itemForm) => {
180
+ return /* @__PURE__ */ import_react.default.createElement(
181
+ "div",
182
+ {
183
+ key: itemForm == null ? void 0 : itemForm.id,
184
+ style: {
185
+ overflow: "hidden",
186
+ textOverflow: "ellipsis",
187
+ whiteSpace: "nowrap"
188
+ }
189
+ },
190
+ (itemForm == null ? void 0 : itemForm.main_field) || "-"
191
+ );
192
+ }) : "-")
193
+ )
194
+ );
195
+ }
196
+ }
197
+ )
198
+ )
199
+ ));
200
+ };
201
+ const handleAddClient = (record, isChecked) => {
202
+ onAddClient == null ? void 0 : onAddClient(record, isChecked);
203
+ handleModalCancel();
204
+ };
205
+ (0, import_react.useImperativeHandle)(ref, () => ({
206
+ resetScrollPosition: () => {
207
+ if (scrollContainerRef.current) {
208
+ scrollContainerRef.current.scrollTop = 0;
209
+ }
210
+ }
211
+ }));
212
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
213
+ import_comprehensiveSearch.default,
214
+ {
215
+ ...props,
216
+ ref: comprehensiveSearchRef,
217
+ renderType: "modal",
218
+ onAdd: handleAdd,
219
+ resultDisplay: renderResults
220
+ }
221
+ ), /* @__PURE__ */ import_react.default.createElement(
222
+ import_Add.default,
223
+ {
224
+ containerProps: {
225
+ className: "pisell-client-search__new-client-modal",
226
+ title: import_utils.locales.getText("pisell2.text.create-new-client"),
227
+ open: modalVisible,
228
+ onCancel: handleModalCancel,
229
+ width: 680
230
+ },
231
+ onChange: handleAddClient,
232
+ ref: addClientRef
233
+ }
234
+ ));
235
+ }
236
+ );
237
+ var clinetSearch_default = ClientSearch;