@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,462 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ import React, { useMemo } from 'react';
9
+ import { Tag, Dropdown, Button } from 'antd';
10
+ import { PisellAvatar, Icon } from '@pisell/materials';
11
+ import { PlusCircle, User01 } from '@pisell/icon';
12
+ import classNames from 'classnames';
13
+ import LineCard from "./line";
14
+ import localeTexts from "./locales";
15
+ import { locales } from '@pisell/utils';
16
+ import useEngineContext from "../../hooks/useEngineContext";
17
+ import ClientName from "../clientName";
18
+ import { getAvatarText, getFieldValue, isWalkIn as isWalkInData } from "./utils";
19
+ import "./index.less";
20
+ export var processClientData = function processClientData(dataSource) {
21
+ var fieldNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22
+ if (!dataSource) return null;
23
+ var fields = ['id', 'name', 'display_name', 'nickname', 'cover', 'phone', 'email', 'birthday', 'address', 'tags'];
24
+ var _data = {};
25
+ fields.forEach(function (key) {
26
+ _data[key] = getFieldValue(dataSource, key, fieldNames);
27
+ });
28
+ return _objectSpread(_objectSpread({}, dataSource), _data);
29
+ };
30
+
31
+ // 类名前缀
32
+ export var PREFIX = 'pisell-client-card';
33
+
34
+ // 渲染头像组件
35
+ var renderAvatar = function renderAvatar(processedData) {
36
+ var avatarConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
37
+ var isShowAvatar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
38
+ var isShowStatus = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
39
+ var statusConfig = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
40
+ if (!isShowAvatar || !processedData) return null;
41
+ var icon = avatarConfig.icon,
42
+ _avatarConfig$useText = avatarConfig.useTextAvatar,
43
+ useTextAvatar = _avatarConfig$useText === void 0 ? false : _avatarConfig$useText,
44
+ children = avatarConfig.children;
45
+
46
+ // 状态指示器
47
+ var statusIndicator = isShowStatus && /*#__PURE__*/React.createElement("div", {
48
+ className: "".concat(PREFIX, "__status-indicator"),
49
+ style: {
50
+ backgroundColor: statusConfig.color || '#17B26A'
51
+ }
52
+ });
53
+ if (useTextAvatar) {
54
+ var text = children || getAvatarText(processedData.name || processedData.display_name || processedData.nickname || '');
55
+ return /*#__PURE__*/React.createElement("div", {
56
+ className: "".concat(PREFIX, "__avatar-wrapper")
57
+ }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
58
+ className: "".concat(PREFIX, "__avatar")
59
+ }, avatarConfig), text), statusIndicator);
60
+ }
61
+ if (icon) {
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ className: "".concat(PREFIX, "__avatar-wrapper")
64
+ }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
65
+ className: "".concat(PREFIX, "__avatar")
66
+ }, avatarConfig, {
67
+ icon: /*#__PURE__*/React.createElement(Icon, {
68
+ type: icon
69
+ })
70
+ })), statusIndicator);
71
+ }
72
+ return /*#__PURE__*/React.createElement("div", {
73
+ className: "".concat(PREFIX, "__avatar-wrapper")
74
+ }, /*#__PURE__*/React.createElement(PisellAvatar, _extends({
75
+ className: "".concat(PREFIX, "__avatar")
76
+ }, avatarConfig, {
77
+ src: processedData.cover
78
+ })), statusIndicator);
79
+ };
80
+
81
+ // 渲染标签
82
+ var renderTags = function renderTags(processedData) {
83
+ var isShowTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
84
+ var tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
85
+ var tagConfig = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
86
+ if (!isShowTag) return null;
87
+ var tagsToShow = tags.length > 0 ? tags : (processedData === null || processedData === void 0 ? void 0 : processedData.tags) || [];
88
+ if (!tagsToShow.length) return null;
89
+ var _tagConfig$gap = tagConfig.gap,
90
+ gap = _tagConfig$gap === void 0 ? 4 : _tagConfig$gap,
91
+ _tagConfig$flexWrap = tagConfig.flexWrap,
92
+ flexWrap = _tagConfig$flexWrap === void 0 ? 'nowrap' : _tagConfig$flexWrap;
93
+ var isNoWrap = flexWrap === 'nowrap';
94
+ return /*#__PURE__*/React.createElement("div", {
95
+ className: classNames("".concat(PREFIX, "__tags"), isNoWrap && "".concat(PREFIX, "__tags--nowrap")),
96
+ style: {
97
+ gap: gap,
98
+ flexWrap: flexWrap
99
+ }
100
+ }, tagsToShow.map(function (tag, index) {
101
+ var content = typeof tag === 'string' ? tag : tag.children || tag.label;
102
+ var tagProps = {
103
+ key: index,
104
+ color: _typeof(tag) === 'object' ? tag.color : undefined,
105
+ className: classNames("".concat(PREFIX, "__tag"), isNoWrap && "".concat(PREFIX, "__tag--nowrap"), !isNoWrap && "".concat(PREFIX, "__tag--wrap"))
106
+ };
107
+ return /*#__PURE__*/React.createElement(Tag, tagProps, content);
108
+ }));
109
+ };
110
+
111
+ // 渲染联系信息
112
+ var renderContactInfo = function renderContactInfo(processedData) {
113
+ var isShowPhone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
114
+ var isShowEmail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
115
+ var isShowBirthday = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
116
+ var isShowAddress = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
117
+ var gap = arguments.length > 5 ? arguments[5] : undefined;
118
+ var cardType = arguments.length > 6 ? arguments[6] : undefined;
119
+ if (!processedData) return null;
120
+ var fields = [];
121
+
122
+ // B2 模式下,联系方式只显示一个,电话优先于邮箱
123
+ if (cardType === 'b2') {
124
+ if (isShowPhone && processedData.phone) {
125
+ fields.push({
126
+ value: processedData.phone,
127
+ type: 'phone'
128
+ });
129
+ } else if (isShowEmail && processedData.email) {
130
+ fields.push({
131
+ value: processedData.email,
132
+ type: 'email'
133
+ });
134
+ }
135
+ } else {
136
+ // 其他模式下,显示所有可用的联系方式
137
+ if (isShowPhone && processedData.phone) {
138
+ fields.push({
139
+ value: processedData.phone,
140
+ type: 'phone'
141
+ });
142
+ }
143
+ if (isShowEmail && processedData.email) {
144
+ fields.push({
145
+ value: processedData.email,
146
+ type: 'email'
147
+ });
148
+ }
149
+ }
150
+ if (isShowBirthday && processedData.birthday) {
151
+ fields.push({
152
+ value: processedData.birthday,
153
+ type: 'birthday'
154
+ });
155
+ }
156
+ if (isShowAddress && processedData.address) {
157
+ fields.push({
158
+ value: processedData.address,
159
+ type: 'address'
160
+ });
161
+ }
162
+ if (!fields.length) return null;
163
+ return /*#__PURE__*/React.createElement("div", {
164
+ className: "".concat(PREFIX, "__fields"),
165
+ style: {
166
+ gap: gap
167
+ }
168
+ }, fields.map(function (field, index) {
169
+ return /*#__PURE__*/React.createElement("div", {
170
+ key: index,
171
+ className: classNames("".concat(PREFIX, "__contact"), field.type === 'address' && "".concat(PREFIX, "__contact--address"))
172
+ }, field.value);
173
+ }));
174
+ };
175
+ // 渲染额外字段
176
+ var renderExtraFields = function renderExtraFields() {
177
+ var extraFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
178
+ var gap = arguments.length > 1 ? arguments[1] : undefined;
179
+ if (!extraFields.length) return null;
180
+ return /*#__PURE__*/React.createElement("div", {
181
+ className: "".concat(PREFIX, "__extra-fields"),
182
+ style: {
183
+ gap: gap
184
+ }
185
+ }, extraFields.map(function (field, index) {
186
+ return /*#__PURE__*/React.createElement("div", {
187
+ key: index,
188
+ className: "".concat(PREFIX, "__extra-field")
189
+ }, field.icon && /*#__PURE__*/React.createElement(Icon, {
190
+ type: field.icon,
191
+ className: "".concat(PREFIX, "__extra-field-icon"),
192
+ style: {
193
+ fontSize: field.iconSize,
194
+ color: field.iconColor
195
+ }
196
+ }), field.isShowLabel !== false && field.label && /*#__PURE__*/React.createElement("span", {
197
+ className: "".concat(PREFIX, "__extra-field-label")
198
+ }, field.label, ":"), field.isShowValue !== false && field.value && /*#__PURE__*/React.createElement("span", {
199
+ className: classNames("".concat(PREFIX, "__extra-field-value"))
200
+ }, field.value));
201
+ }));
202
+ };
203
+ var ClientCard = function ClientCard(_ref) {
204
+ var _context$appHelper;
205
+ var _ref$type = _ref.type,
206
+ type = _ref$type === void 0 ? 'b2' : _ref$type,
207
+ _ref$direction = _ref.direction,
208
+ direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
209
+ dataSource = _ref.dataSource,
210
+ _ref$fieldNames = _ref.fieldNames,
211
+ fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
212
+ _ref$style = _ref.style,
213
+ customStyle = _ref$style === void 0 ? {} : _ref$style,
214
+ horizontalGap = _ref.horizontalGap,
215
+ verticalGap = _ref.verticalGap,
216
+ _ref$isShowAvatar = _ref.isShowAvatar,
217
+ isShowAvatar = _ref$isShowAvatar === void 0 ? true : _ref$isShowAvatar,
218
+ _ref$isShowName = _ref.isShowName,
219
+ isShowName = _ref$isShowName === void 0 ? true : _ref$isShowName,
220
+ _ref$isShowPhone = _ref.isShowPhone,
221
+ isShowPhone = _ref$isShowPhone === void 0 ? true : _ref$isShowPhone,
222
+ _ref$isShowEmail = _ref.isShowEmail,
223
+ isShowEmail = _ref$isShowEmail === void 0 ? true : _ref$isShowEmail,
224
+ _ref$isShowBirthday = _ref.isShowBirthday,
225
+ isShowBirthday = _ref$isShowBirthday === void 0 ? true : _ref$isShowBirthday,
226
+ _ref$isShowAddress = _ref.isShowAddress,
227
+ isShowAddress = _ref$isShowAddress === void 0 ? true : _ref$isShowAddress,
228
+ _ref$isShowTag = _ref.isShowTag,
229
+ isShowTag = _ref$isShowTag === void 0 ? true : _ref$isShowTag,
230
+ _ref$isShowStatus = _ref.isShowStatus,
231
+ isShowStatus = _ref$isShowStatus === void 0 ? false : _ref$isShowStatus,
232
+ _ref$isShowEmptyDescr = _ref.isShowEmptyDescription,
233
+ isShowEmptyDescription = _ref$isShowEmptyDescr === void 0 ? true : _ref$isShowEmptyDescr,
234
+ _ref$avatar = _ref.avatar,
235
+ avatar = _ref$avatar === void 0 ? {} : _ref$avatar,
236
+ _ref$status = _ref.status,
237
+ status = _ref$status === void 0 ? {} : _ref$status,
238
+ dropdown = _ref.dropdown,
239
+ defaultName = _ref.defaultName,
240
+ _ref$nameStyle = _ref.nameStyle,
241
+ nameStyle = _ref$nameStyle === void 0 ? {} : _ref$nameStyle,
242
+ _ref$tags = _ref.tags,
243
+ tags = _ref$tags === void 0 ? [] : _ref$tags,
244
+ _ref$tag = _ref.tag,
245
+ tag = _ref$tag === void 0 ? {} : _ref$tag,
246
+ _ref$extraFields = _ref.extraFields,
247
+ extraFields = _ref$extraFields === void 0 ? [] : _ref$extraFields,
248
+ _ref$slots = _ref.slots,
249
+ slots = _ref$slots === void 0 ? {} : _ref$slots,
250
+ onViewClient = _ref.onViewClient,
251
+ onAddClient = _ref.onAddClient,
252
+ onChangeClient = _ref.onChangeClient,
253
+ onRemoveClient = _ref.onRemoveClient;
254
+ var context = useEngineContext();
255
+ locales.init(localeTexts, ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.storage) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.get('umi_locale')) || 'en');
256
+ var processed = useMemo(function () {
257
+ if (dataSource) {
258
+ return processClientData(dataSource, fieldNames);
259
+ }
260
+ return null;
261
+ }, [dataSource, fieldNames]);
262
+ var translatedExtraFields = useMemo(function () {
263
+ var _fields = extraFields.filter(function (item) {
264
+ return !!item;
265
+ });
266
+ return _fields;
267
+ }, [extraFields]);
268
+ var _dropdownProps = useMemo(function () {
269
+ var _props = {
270
+ menu: {
271
+ items: [{
272
+ key: 'change',
273
+ label: locales.getText('pisell2.text.change-client'),
274
+ onClick: function onClick() {
275
+ onChangeClient === null || onChangeClient === void 0 || onChangeClient(dataSource);
276
+ }
277
+ }, {
278
+ key: 'remove',
279
+ label: locales.getText('pisell2.text.remove-client'),
280
+ onClick: function onClick() {
281
+ onRemoveClient === null || onRemoveClient === void 0 || onRemoveClient(dataSource);
282
+ }
283
+ }]
284
+ }
285
+ };
286
+ if (dropdown && 'open' in dropdown) {
287
+ _props.open = dropdown.open;
288
+ }
289
+ return _props;
290
+ }, [dropdown]);
291
+ var isWalkIn = isWalkInData(processed === null || processed === void 0 ? void 0 : processed.id);
292
+ if (isWalkIn) {
293
+ var _cardStyle = _objectSpread(_objectSpread({}, customStyle), {}, {
294
+ gap: horizontalGap
295
+ });
296
+ return /*#__PURE__*/React.createElement("div", {
297
+ className: classNames(PREFIX, "".concat(PREFIX, "--empty")),
298
+ onClick: function onClick() {
299
+ return onAddClient === null || onAddClient === void 0 ? void 0 : onAddClient();
300
+ },
301
+ style: _objectSpread(_objectSpread({}, _cardStyle), {}, {
302
+ cursor: 'pointer'
303
+ })
304
+ }, /*#__PURE__*/React.createElement("div", {
305
+ className: "".concat(PREFIX, "__content")
306
+ }, /*#__PURE__*/React.createElement("div", {
307
+ className: "".concat(PREFIX, "__info")
308
+ }, isShowAvatar && /*#__PURE__*/React.createElement(PisellAvatar, {
309
+ icon: avatar.icon ? /*#__PURE__*/React.createElement(Icon, {
310
+ type: avatar.icon
311
+ }) : /*#__PURE__*/React.createElement(User01, {
312
+ style: {
313
+ color: '#475467'
314
+ }
315
+ }),
316
+ size: avatar.size
317
+ }), /*#__PURE__*/React.createElement("div", {
318
+ className: "".concat(PREFIX, "__details"),
319
+ style: {
320
+ gap: verticalGap
321
+ }
322
+ }, isShowName && /*#__PURE__*/React.createElement(ClientName, {
323
+ dataSource: defaultName || locales.getText('pisell2.text.add-client'),
324
+ style: nameStyle
325
+ }), isShowEmptyDescription && /*#__PURE__*/React.createElement("div", {
326
+ className: "".concat(PREFIX, "__empty-description")
327
+ }, locales.getText('pisell2.text.leave-empty-for-walk-in')))), /*#__PURE__*/React.createElement("div", {
328
+ className: "".concat(PREFIX, "__actions")
329
+ }, /*#__PURE__*/React.createElement("span", {
330
+ className: "".concat(PREFIX, "__plugin-icon")
331
+ }, /*#__PURE__*/React.createElement(PlusCircle, {
332
+ style: {
333
+ fontSize: 28,
334
+ color: '#475467'
335
+ }
336
+ })))));
337
+ }
338
+
339
+ // 根据类型渲染不同的卡片
340
+ if (type === 'b1') {
341
+ return /*#__PURE__*/React.createElement(LineCard, {
342
+ dataSource: processed,
343
+ isShowAvatar: isShowAvatar,
344
+ isShowPhone: isShowPhone,
345
+ isShowEmail: isShowEmail,
346
+ isShowStatus: isShowStatus
347
+ // 样式配置
348
+ ,
349
+ style: customStyle,
350
+ horizontalGap: horizontalGap
351
+ // 头像配置
352
+ ,
353
+ avatar: avatar,
354
+ status: status
355
+ // 姓名样式
356
+ ,
357
+ nameStyle: nameStyle
358
+ // 标签配置
359
+ ,
360
+ tags: tags,
361
+ tag: tag
362
+ // 插槽
363
+ ,
364
+ slots: slots
365
+ // 事件回调
366
+ ,
367
+ onViewClient: onViewClient
368
+ });
369
+ }
370
+
371
+ // 通用卡片渲染逻辑 (b2, b5, b9)
372
+ var cardStyle = _objectSpread(_objectSpread({}, customStyle), {}, {
373
+ gap: horizontalGap
374
+ });
375
+ var isVertical = direction === 'vertical';
376
+ var isInlineTag = tag.placement === 'inline';
377
+
378
+ // 根据卡片类型确定显示的字段
379
+ var getFieldVisibility = function getFieldVisibility() {
380
+ switch (type) {
381
+ case 'b2':
382
+ return {
383
+ showBirthday: false,
384
+ showAddress: false,
385
+ showExtraFields: false
386
+ };
387
+ case 'b5':
388
+ return {
389
+ showBirthday: isShowBirthday,
390
+ showAddress: isShowAddress,
391
+ showExtraFields: false
392
+ };
393
+ case 'b9':
394
+ return {
395
+ showBirthday: isShowBirthday,
396
+ showAddress: isShowAddress,
397
+ showExtraFields: true
398
+ };
399
+ default:
400
+ return {
401
+ showBirthday: isShowBirthday,
402
+ showAddress: isShowAddress,
403
+ showExtraFields: true
404
+ };
405
+ }
406
+ };
407
+ var _getFieldVisibility = getFieldVisibility(),
408
+ showBirthday = _getFieldVisibility.showBirthday,
409
+ showAddress = _getFieldVisibility.showAddress,
410
+ showExtraFields = _getFieldVisibility.showExtraFields;
411
+ return /*#__PURE__*/React.createElement("div", {
412
+ className: classNames(PREFIX, "".concat(PREFIX, "--").concat(type), _defineProperty(_defineProperty({}, "".concat(PREFIX, "--vertical"), isVertical), "".concat(PREFIX, "--horizontal"), !isVertical)),
413
+ style: _objectSpread(_objectSpread({}, cardStyle), {}, {
414
+ cursor: 'pointer'
415
+ }),
416
+ onClick: function onClick() {
417
+ return dataSource && (onViewClient === null || onViewClient === void 0 ? void 0 : onViewClient(dataSource));
418
+ }
419
+ }, slots.top, /*#__PURE__*/React.createElement("div", {
420
+ className: "".concat(PREFIX, "__content")
421
+ }, slots.left && /*#__PURE__*/React.createElement("div", {
422
+ className: "".concat(PREFIX, "__slot-left")
423
+ }, slots.left), /*#__PURE__*/React.createElement("div", {
424
+ className: "".concat(PREFIX, "__info")
425
+ }, renderAvatar(processed, avatar, isShowAvatar, isShowStatus, status), /*#__PURE__*/React.createElement("div", {
426
+ className: "".concat(PREFIX, "__details"),
427
+ style: {
428
+ gap: verticalGap
429
+ }
430
+ }, /*#__PURE__*/React.createElement("div", {
431
+ className: classNames("".concat(PREFIX, "__name-tags"), isInlineTag && "".concat(PREFIX, "__name-tags--inline"))
432
+ }, isShowName && /*#__PURE__*/React.createElement(ClientName, {
433
+ dataSource: processed,
434
+ style: nameStyle,
435
+ className: "pisell-client-card__name "
436
+ }), isInlineTag && renderTags(processed, isShowTag, tags, tag)), !isInlineTag && renderTags(processed, isShowTag, tags, tag), renderContactInfo(processed, isShowPhone, isShowEmail, showBirthday, showAddress, typeof verticalGap === 'number' ? verticalGap : undefined, type), showExtraFields && renderExtraFields(translatedExtraFields, typeof verticalGap === 'number' ? verticalGap : undefined))), /*#__PURE__*/React.createElement("div", {
437
+ className: "".concat(PREFIX, "__actions"),
438
+ onClick: function onClick(e) {
439
+ return e.stopPropagation();
440
+ }
441
+ }, /*#__PURE__*/React.createElement(Dropdown, _extends({
442
+ trigger: ['click'],
443
+ placement: "bottomRight"
444
+ }, _dropdownProps), /*#__PURE__*/React.createElement(Button, _extends({
445
+ type: "text",
446
+ className: "".concat(PREFIX, "__menu-button"),
447
+ size: "large",
448
+ icon: /*#__PURE__*/React.createElement(Icon, {
449
+ type: 'pisell2-dots-vertical',
450
+ className: "".concat(PREFIX, "__menu-button-icon")
451
+ })
452
+ }, (dropdown === null || dropdown === void 0 ? void 0 : dropdown.buttonProps) || {}, {
453
+ onClick: function onClick(e) {
454
+ var _dropdown$buttonProps, _dropdown$buttonProps2;
455
+ e.stopPropagation(); // 阻止事件冒泡,避免触发卡片点击
456
+ dropdown === null || dropdown === void 0 || (_dropdown$buttonProps = dropdown.buttonProps) === null || _dropdown$buttonProps === void 0 || (_dropdown$buttonProps2 = _dropdown$buttonProps.onClick) === null || _dropdown$buttonProps2 === void 0 || _dropdown$buttonProps2.call(_dropdown$buttonProps, e);
457
+ }
458
+ })))), slots.right && /*#__PURE__*/React.createElement("div", {
459
+ className: "".concat(PREFIX, "__slot-right")
460
+ }, slots.right)), slots.bottom);
461
+ };
462
+ export default ClientCard;