@pisell/materials 6.0.18 → 6.0.20

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 (204) 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 +7 -7
  6. package/build/lowcode/preview.js +146 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +51 -20
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +51 -20
  11. package/es/components/badge/index.d.ts +7 -0
  12. package/es/components/badge/index.js +44 -0
  13. package/es/components/badge/index.less +2 -0
  14. package/es/components/buttonGroupEdit/index.d.ts +8 -0
  15. package/es/components/buttonGroupEdit/index.js +408 -0
  16. package/es/components/buttonGroupPreview/index.d.ts +19 -0
  17. package/es/components/buttonGroupPreview/index.js +74 -0
  18. package/es/components/cardMetricItem/index.d.ts +12 -0
  19. package/es/components/cardMetricItem/index.js +39 -0
  20. package/es/components/cardMetricItem/index.less +39 -0
  21. package/es/components/cardPro/index.d.ts +3 -0
  22. package/es/components/cardPro/index.js +66 -0
  23. package/es/components/cardPro/index.less +55 -0
  24. package/es/components/cropPhoto/index.d.ts +3 -0
  25. package/es/components/cropPhoto/index.js +72 -0
  26. package/es/components/cropPhoto/index.less +15 -0
  27. package/es/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
  28. package/es/components/dataSourceComponents/dataSourceMenu/Basic.js +13 -3
  29. package/es/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
  30. package/es/components/dataSourceComponents/fields/Input/WithMode.js +24 -1
  31. package/es/components/dataSourceComponents/fields/Input.Mobile/serve.js +31 -3
  32. package/es/components/dataSourceComponents/fields/Input.Phone/serve.js +31 -3
  33. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  34. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
  35. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +102 -141
  36. package/es/components/dataSourceComponents/fields/Upload/WithMode.js +6 -3
  37. package/es/components/dataSourceComponents/fields/Upload/serve.js +13 -3
  38. package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
  39. package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.js +396 -0
  40. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
  41. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
  42. package/es/components/dataSourceComponents/fields/Upload/utils.js +17 -2
  43. package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
  44. package/es/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
  45. package/es/components/dataSourceComponents/hooks/usePlatform.js +12 -0
  46. package/es/components/login-and-register/index.js +23 -21
  47. package/es/components/login-and-register/index.less +7 -7
  48. package/es/components/page/index.js +23 -57
  49. package/es/components/pisellAnchor/index.d.ts +23 -0
  50. package/es/components/pisellAnchor/index.js +303 -0
  51. package/es/components/pisellAnchor/index.less +197 -0
  52. package/es/components/pisellNavigationMenu/PisellNavigationMenu.js +18 -2
  53. package/es/components/pisellQrcode/index.d.ts +10 -0
  54. package/es/components/pisellQrcode/index.js +70 -0
  55. package/es/components/pisellQrcode/index.less +41 -0
  56. package/es/components/pisellStatisticList/index.d.ts +3 -0
  57. package/es/components/pisellStatisticList/index.js +17 -5
  58. package/es/components/pisellStatisticList/index.less +1 -1
  59. package/es/components/pisellText/components/Amount/index.d.ts +2 -0
  60. package/es/components/pisellText/components/Amount/index.js +3 -2
  61. package/es/components/pisellWalletPassCard/index.d.ts +4 -4
  62. package/es/components/pisellWalletPassCard/index.js +28 -12
  63. package/es/components/pisellWalletPassCard/index.less +26 -4
  64. package/es/components/record-view/index.d.ts +13 -5
  65. package/es/components/record-view/index.js +81 -30
  66. package/es/components/record-view/index.less +37 -2
  67. package/es/components/table/Table/utils.d.ts +1 -1
  68. package/es/components/tabs/index.d.ts +1 -0
  69. package/es/components/tabs/index.js +25 -7
  70. package/es/components/tabs/index.less +5 -5
  71. package/es/components/walletCard/Guest/index.d.ts +3 -0
  72. package/es/components/walletCard/Guest/index.js +83 -0
  73. package/es/components/walletCard/Guest/index.less +71 -0
  74. package/es/components/walletCard/index.d.ts +65 -0
  75. package/es/components/walletCard/index.js +402 -0
  76. package/es/components/walletCard/index.less +267 -0
  77. package/es/index.d.ts +10 -1
  78. package/es/index.js +10 -1
  79. package/es/locales/en-US.d.ts +38 -2
  80. package/es/locales/en-US.js +55 -10
  81. package/es/locales/index.js +4 -2
  82. package/es/locales/zh-CN.d.ts +36 -0
  83. package/es/locales/zh-CN.js +41 -1
  84. package/es/locales/zh-TW.d.ts +36 -0
  85. package/es/locales/zh-TW.js +41 -1
  86. package/es/utils/index.d.ts +1 -0
  87. package/es/utils/index.js +3 -0
  88. package/es/utils/platform.d.ts +1 -1
  89. package/lib/components/badge/index.d.ts +7 -0
  90. package/lib/components/badge/index.js +70 -0
  91. package/lib/components/badge/index.less +2 -0
  92. package/lib/components/buttonGroupEdit/index.d.ts +8 -0
  93. package/lib/components/buttonGroupEdit/index.js +317 -0
  94. package/lib/components/buttonGroupPreview/index.d.ts +19 -0
  95. package/lib/components/buttonGroupPreview/index.js +79 -0
  96. package/lib/components/cardMetricItem/index.d.ts +12 -0
  97. package/lib/components/cardMetricItem/index.js +75 -0
  98. package/lib/components/cardMetricItem/index.less +39 -0
  99. package/lib/components/cardPro/index.d.ts +3 -0
  100. package/lib/components/cardPro/index.js +98 -0
  101. package/lib/components/cardPro/index.less +55 -0
  102. package/lib/components/cropPhoto/index.d.ts +3 -0
  103. package/lib/components/cropPhoto/index.js +70 -0
  104. package/lib/components/cropPhoto/index.less +15 -0
  105. package/lib/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
  106. package/lib/components/dataSourceComponents/dataSourceMenu/Basic.js +12 -3
  107. package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
  108. package/lib/components/dataSourceComponents/fields/Input/WithMode.js +21 -0
  109. package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.js +37 -3
  110. package/lib/components/dataSourceComponents/fields/Input.Phone/serve.js +37 -3
  111. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  112. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
  113. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +47 -72
  114. package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +11 -9
  115. package/lib/components/dataSourceComponents/fields/Upload/serve.js +11 -2
  116. package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
  117. package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.js +247 -0
  118. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
  119. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
  120. package/lib/components/dataSourceComponents/fields/Upload/utils.js +17 -2
  121. package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
  122. package/lib/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
  123. package/lib/components/dataSourceComponents/hooks/usePlatform.js +51 -0
  124. package/lib/components/login-and-register/index.js +23 -21
  125. package/lib/components/login-and-register/index.less +7 -7
  126. package/lib/components/page/index.js +37 -65
  127. package/lib/components/pisellAnchor/index.d.ts +23 -0
  128. package/lib/components/pisellAnchor/index.js +251 -0
  129. package/lib/components/pisellAnchor/index.less +197 -0
  130. package/lib/components/pisellNavigationMenu/PisellNavigationMenu.js +24 -3
  131. package/lib/components/pisellQrcode/index.d.ts +10 -0
  132. package/lib/components/pisellQrcode/index.js +82 -0
  133. package/lib/components/pisellQrcode/index.less +41 -0
  134. package/lib/components/pisellStatisticList/index.d.ts +3 -0
  135. package/lib/components/pisellStatisticList/index.js +35 -15
  136. package/lib/components/pisellStatisticList/index.less +1 -1
  137. package/lib/components/pisellText/components/Amount/index.d.ts +2 -0
  138. package/lib/components/pisellText/components/Amount/index.js +2 -1
  139. package/lib/components/pisellWalletPassCard/index.d.ts +4 -4
  140. package/lib/components/pisellWalletPassCard/index.js +17 -9
  141. package/lib/components/pisellWalletPassCard/index.less +26 -4
  142. package/lib/components/record-view/index.d.ts +13 -5
  143. package/lib/components/record-view/index.js +63 -11
  144. package/lib/components/record-view/index.less +37 -2
  145. package/lib/components/table/Table/utils.d.ts +1 -1
  146. package/lib/components/tabs/index.d.ts +1 -0
  147. package/lib/components/tabs/index.js +12 -1
  148. package/lib/components/tabs/index.less +5 -5
  149. package/lib/components/walletCard/Guest/index.d.ts +3 -0
  150. package/lib/components/walletCard/Guest/index.js +138 -0
  151. package/lib/components/walletCard/Guest/index.less +71 -0
  152. package/lib/components/walletCard/index.d.ts +65 -0
  153. package/lib/components/walletCard/index.js +374 -0
  154. package/lib/components/walletCard/index.less +267 -0
  155. package/lib/index.d.ts +10 -1
  156. package/lib/index.js +26 -1
  157. package/lib/locales/en-US.d.ts +38 -2
  158. package/lib/locales/en-US.js +41 -3
  159. package/lib/locales/index.js +4 -2
  160. package/lib/locales/zh-CN.d.ts +36 -0
  161. package/lib/locales/zh-CN.js +41 -1
  162. package/lib/locales/zh-TW.d.ts +36 -0
  163. package/lib/locales/zh-TW.js +41 -1
  164. package/lib/utils/index.d.ts +1 -0
  165. package/lib/utils/index.js +6 -1
  166. package/lib/utils/platform.d.ts +1 -1
  167. package/lowcode/badge/meta.ts +20 -11
  168. package/lowcode/badge/snippets.ts +2 -0
  169. package/lowcode/button/meta.ts +2 -6
  170. package/lowcode/button-group/meta.ts +198 -0
  171. package/lowcode/button-group/snippets.ts +68 -0
  172. package/lowcode/button-group-edit/meta.ts +32 -0
  173. package/lowcode/button-group-edit/snippets.ts +98 -0
  174. package/lowcode/button-group-preview/meta.ts +55 -0
  175. package/lowcode/button-group-preview/snippets.ts +57 -0
  176. package/lowcode/card/snippets.ts +55 -55
  177. package/lowcode/card-metric-item/meta.ts +83 -0
  178. package/lowcode/card-metric-item/snippets.ts +13 -0
  179. package/lowcode/card-pro/meta.ts +338 -0
  180. package/lowcode/card-pro/snippe.ts +39 -0
  181. package/lowcode/crop-photo/meta.ts +77 -0
  182. package/lowcode/crop-photo/snippe.ts +12 -0
  183. package/lowcode/form-item-input/snippets.ts +1 -1
  184. package/lowcode/form-item-upload/meta.ts +11 -0
  185. package/lowcode/pisell-anchor/meta.ts +118 -0
  186. package/lowcode/pisell-anchor/snippets.ts +26 -0
  187. package/lowcode/pisell-card/meta.ts +63 -27
  188. package/lowcode/pisell-card/snippets.ts +6 -0
  189. package/lowcode/pisell-modal.information/meta.ts +8 -0
  190. package/lowcode/pisell-qrcode/__screenshots__/upload-1.png +0 -0
  191. package/lowcode/pisell-qrcode/meta.ts +46 -0
  192. package/lowcode/pisell-qrcode/snippets.ts +13 -0
  193. package/lowcode/pisell-tooltip/meta.ts +1 -1
  194. package/lowcode/record-view/meta.ts +20 -0
  195. package/lowcode/section-footers/meta.ts +66 -0
  196. package/lowcode/section-footers/snippe.ts +21 -0
  197. package/lowcode/spin/meta.ts +9 -0
  198. package/lowcode/tag/meta.ts +6 -0
  199. package/lowcode/timeline/meta.ts +32 -9
  200. package/lowcode/timeline/snippets.ts +12 -2
  201. package/lowcode/timeline.item/meta.ts +1 -1
  202. package/lowcode/wallet-card/meta.ts +283 -0
  203. package/lowcode/wallet-card/snippets.ts +44 -0
  204. package/package.json +5 -1
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import useEngineContext from "../../../hooks/useEngineContext";
3
+ import Button from "../../button";
4
+ import "./index.less";
5
+ var Guest = function Guest(props) {
6
+ var _utils$translation, _utils$translation2, _utils$translation3, _utils$translation4, _utils$translation5, _setting$titleConfig, _utils$translation6, _setting$subtitleConf, _utils$translation7, _setting$buttonConfig, _utils$translation8, _setting$buttonConfig2;
7
+ var setting = props.setting;
8
+ var context = useEngineContext();
9
+ var _ref = context.appHelper || {},
10
+ utils = _ref.utils;
11
+ /**
12
+ * @title: 拉起登录
13
+ * @description:
14
+ * @return {*}
15
+ * @Author: WangHan
16
+ * @Date: 2025-03-13 15:34
17
+ */
18
+ var goLogin = function goLogin() {
19
+ console.log(utils, 'wh978796');
20
+ utils === null || utils === void 0 || utils.action({
21
+ type: 'pisell1.login',
22
+ data: {},
23
+ callback: function callback(status) {
24
+ console.log(status, 'wh978796');
25
+ if (status === 'success') {}
26
+ }
27
+ });
28
+ };
29
+
30
+ /**
31
+ * @title: 样式处理
32
+ * @description:
33
+ * @param {any} config
34
+ * @return {*}
35
+ * @Author: WangHan
36
+ * @Date: 2025-03-13 15:39
37
+ */
38
+ var getTextStyle = function getTextStyle(config, otherConfig) {
39
+ return {
40
+ color: (config === null || config === void 0 ? void 0 : config.color) || (otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.color) || '#fff',
41
+ fontSize: (config === null || config === void 0 ? void 0 : config.size) || (otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.size) || 14,
42
+ fontWeight: (config === null || config === void 0 ? void 0 : config.weight) || (otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.weight) || 400,
43
+ fontStyle: (config === null || config === void 0 ? void 0 : config.style) || 'normal'
44
+ };
45
+ };
46
+ return /*#__PURE__*/React.createElement("div", {
47
+ className: "pisell-wallet-guest-wrap",
48
+ style: {
49
+ backgroundColor: setting === null || setting === void 0 ? void 0 : setting.backgroundColor
50
+ }
51
+ }, utils !== null && utils !== void 0 && (_utils$translation = utils.translation) !== null && _utils$translation !== void 0 && _utils$translation.call(utils, setting === null || setting === void 0 ? void 0 : setting.backgroundImage) ? /*#__PURE__*/React.createElement("img", {
52
+ className: "pisell-wallet-guest-bg",
53
+ src: (utils === null || utils === void 0 || (_utils$translation2 = utils.translation) === null || _utils$translation2 === void 0 ? void 0 : _utils$translation2.call(utils, setting.backgroundImage)) || '',
54
+ alt: (utils === null || utils === void 0 || (_utils$translation3 = utils.translation) === null || _utils$translation3 === void 0 ? void 0 : _utils$translation3.call(utils, setting === null || setting === void 0 ? void 0 : setting.backgroundImageAlt)) || '',
55
+ title: (utils === null || utils === void 0 || (_utils$translation4 = utils.translation) === null || _utils$translation4 === void 0 ? void 0 : _utils$translation4.call(utils, setting === null || setting === void 0 ? void 0 : setting.backgroundImageAlt)) || ''
56
+ }) : null, /*#__PURE__*/React.createElement("div", {
57
+ className: "pisell-wallet-guest-content ".concat(setting.align === 'center' ? 'pisell-wallet-guest-center' : '')
58
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
59
+ className: "pisell-wallet-guest-title",
60
+ style: getTextStyle(setting === null || setting === void 0 ? void 0 : setting.titleConfig, {
61
+ size: 18,
62
+ weight: 600
63
+ })
64
+ }, (utils === null || utils === void 0 || (_utils$translation5 = utils.translation) === null || _utils$translation5 === void 0 ? void 0 : _utils$translation5.call(utils, (setting === null || setting === void 0 ? void 0 : setting.title) || (setting === null || setting === void 0 || (_setting$titleConfig = setting.titleConfig) === null || _setting$titleConfig === void 0 ? void 0 : _setting$titleConfig.text))) || ''), /*#__PURE__*/React.createElement("div", {
65
+ className: "pisell-wallet-guest-subtitle",
66
+ style: getTextStyle(setting === null || setting === void 0 ? void 0 : setting.subtitleConfig, {
67
+ color: '#D0D5DD'
68
+ })
69
+ }, (utils === null || utils === void 0 || (_utils$translation6 = utils.translation) === null || _utils$translation6 === void 0 ? void 0 : _utils$translation6.call(utils, (setting === null || setting === void 0 ? void 0 : setting.subtitle) || (setting === null || setting === void 0 || (_setting$subtitleConf = setting.subtitleConfig) === null || _setting$subtitleConf === void 0 ? void 0 : _setting$subtitleConf.text))) || '')), utils !== null && utils !== void 0 && (_utils$translation7 = utils.translation) !== null && _utils$translation7 !== void 0 && _utils$translation7.call(utils, (setting === null || setting === void 0 ? void 0 : setting.buttonText) || (setting === null || setting === void 0 || (_setting$buttonConfig = setting.buttonConfig) === null || _setting$buttonConfig === void 0 ? void 0 : _setting$buttonConfig.text)) ? /*#__PURE__*/React.createElement("div", {
70
+ className: "pisell-wallet-guest-button-wrap"
71
+ }, /*#__PURE__*/React.createElement(Button, {
72
+ style: {
73
+ backgroundColor: (setting === null || setting === void 0 ? void 0 : setting.buttonColor) || '#7F56D9',
74
+ borderColor: (setting === null || setting === void 0 ? void 0 : setting.buttonBorderColor) || '#7F56D9'
75
+ },
76
+ onClick: goLogin
77
+ }, /*#__PURE__*/React.createElement("div", {
78
+ style: getTextStyle(setting === null || setting === void 0 ? void 0 : setting.buttonConfig, {
79
+ weight: 600
80
+ })
81
+ }, (utils === null || utils === void 0 || (_utils$translation8 = utils.translation) === null || _utils$translation8 === void 0 ? void 0 : _utils$translation8.call(utils, (setting === null || setting === void 0 ? void 0 : setting.buttonText) || (setting === null || setting === void 0 || (_setting$buttonConfig2 = setting.buttonConfig) === null || _setting$buttonConfig2 === void 0 ? void 0 : _setting$buttonConfig2.text))) || ''))) : null));
82
+ };
83
+ export default Guest;
@@ -0,0 +1,71 @@
1
+ .pisell-wallet-guest-wrap {
2
+ background-repeat: no-repeat;
3
+ background-position: center center;
4
+ background-size: contain;
5
+ overflow: hidden;
6
+ position: relative;
7
+ min-height: 136px;
8
+ display: flex;
9
+ padding: 16px 18px;
10
+
11
+ .pisell-wallet-guest-bg {
12
+ position: absolute;
13
+ top: 50%;
14
+ left: 50%;
15
+ transform: translate(-50%, -50%);
16
+ width: 100%;
17
+ height: 100%;
18
+ object-fit: contain;
19
+ }
20
+
21
+ .pisell-wallet-guest-content {
22
+ position: relative;
23
+ text-align: left;
24
+ display: flex;
25
+ justify-content: space-between;
26
+ flex-direction: column;
27
+ flex: 1;
28
+ width: 100%;
29
+
30
+ &.pisell-wallet-guest-center {
31
+ text-align: center;
32
+ align-items: center;
33
+ }
34
+
35
+ .pisell-wallet-guest-title {
36
+ line-height: 28px;
37
+ }
38
+
39
+ .pisell-wallet-guest-subtitle {
40
+ line-height: 20px;
41
+ }
42
+
43
+ .pisell-wallet-guest-button-wrap {
44
+ display: flex;
45
+ width: fit-content;
46
+ max-width: 100%;
47
+ }
48
+
49
+ .pisell-lowcode-btn-default {
50
+ margin-top: 8px;
51
+ display: flex;
52
+ padding: 10px 16px;
53
+ justify-content: center;
54
+ align-items: center;
55
+ background: transparent;
56
+ border-color: transparent;
57
+ border-radius: 8px;
58
+ border: 1px solid var(--Primary-600, #7f56d9);
59
+ background: var(--Primary-600, #7f56d9);
60
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
61
+ max-width: 100%;
62
+ width: auto;
63
+ > div {
64
+ max-width: 100%;
65
+ white-space: nowrap;
66
+ overflow: hidden;
67
+ text-overflow: ellipsis;
68
+ }
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare global {
4
+ namespace JSX {
5
+ interface IntrinsicElements {
6
+ [elemName: string]: any;
7
+ }
8
+ }
9
+ }
10
+ export interface WalletCardItem {
11
+ key: string;
12
+ label?: string;
13
+ hidden?: boolean;
14
+ value?: number;
15
+ }
16
+ export interface WalletCardProps {
17
+ /** 二维码弹窗适配平台 */
18
+ platform?: 'pc' | 'h5' | 'ipad';
19
+ /** 卡片主题 */
20
+ mode?: 'dark' | 'light';
21
+ /** 默认还是完整显示code */
22
+ cardStyle?: 'normal' | 'full';
23
+ /** 条形码还是二维码 */
24
+ codeType?: 'barCode' | 'orCode';
25
+ /** 二维码方向 */
26
+ codeDirection?: 'bottom' | 'top';
27
+ /** 自定义背景图 */
28
+ customBackgroundImage?: string;
29
+ /** 图标:可以是React组件或图片URL */
30
+ showIcon?: boolean;
31
+ showWalletName?: boolean;
32
+ iconImg?: string;
33
+ /** 钱包名称 */
34
+ walletName?: string;
35
+ /** 店铺名称 */
36
+ shopName?: string;
37
+ /** 是否显示店铺名称 */
38
+ showShopName?: boolean;
39
+ /** 卡号 */
40
+ cardNo?: string;
41
+ /** 是否显示卡号 */
42
+ showCardNo?: boolean;
43
+ /** 是否显示二维码 */
44
+ showCode?: boolean;
45
+ /** 点击二维码/条形码的回调 */
46
+ onCodeClick?: () => void;
47
+ /** 货币符号 */
48
+ symbol: string;
49
+ /** 点击卡片的回调 */
50
+ onClick?: () => void;
51
+ /** 自定义类名 */
52
+ className?: string;
53
+ items: WalletCardItem[];
54
+ /** 自定义样式 */
55
+ style?: React.CSSProperties;
56
+ title?: string;
57
+ subTitle?: string;
58
+ align?: 'left' | 'center';
59
+ buttonText?: string;
60
+ [key: string]: any;
61
+ /** 是否已登录 */
62
+ isLogin?: boolean;
63
+ }
64
+ declare const WalletCard: React.FC<WalletCardProps>;
65
+ export default WalletCard;
@@ -0,0 +1,402 @@
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 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; }
3
+ 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; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ import { Card, QRCode } from 'antd';
18
+ import classNames from 'classnames';
19
+ import React, { useMemo, useState } from 'react';
20
+ import Barcode from 'react-barcode';
21
+ import { getText } from "../../locales/index";
22
+ import Iconfont from "./../iconfont";
23
+ import PisellModal from "./../pisellModal";
24
+ import Amount from "./../pisellText/components/Amount";
25
+ import useEngineContext from "../../hooks/useEngineContext";
26
+ import Guest from "./Guest";
27
+ import "./index.less";
28
+
29
+ // 添加JSX类型声明
30
+
31
+ // 类型定义
32
+
33
+ // 默认值
34
+ var DEFAULT_PROPS = {
35
+ symbol: '$',
36
+ mode: 'light',
37
+ iconImg: '',
38
+ showIcon: true,
39
+ showWalletName: true,
40
+ shopName: 'Store name',
41
+ showShopName: true,
42
+ cardNo: 'Wallet number',
43
+ cardStyle: 'normal',
44
+ codeType: 'barCode',
45
+ platform: 'pc',
46
+ codeDirection: 'bottom',
47
+ showCardNo: true,
48
+ showCode: true,
49
+ walletName: 'Level',
50
+ isLogin: true,
51
+ items: [{
52
+ key: 'rechargeable',
53
+ label: 'rechargeable',
54
+ value: 0
55
+ }, {
56
+ key: 'piont',
57
+ label: 'piont',
58
+ value: 10
59
+ }, {
60
+ key: 'voucher',
61
+ label: 'Discount cardvoucher',
62
+ value: 0
63
+ }, {
64
+ key: 'discount',
65
+ label: 'discount',
66
+ value: 0
67
+ }]
68
+ };
69
+
70
+ // 工具函数:将可能的数字0/1转为布尔值
71
+ var toBooleanValue = function toBooleanValue(value) {
72
+ if (value === undefined) return false;
73
+ if (value === 0 || value === '0') return false;
74
+ if (value === 1 || value === '1') return true;
75
+ return !!value;
76
+ };
77
+
78
+ // 自定义钩子:处理二维码/条形码模态框
79
+ var useCodeModal = function useCodeModal(cardNo, onCodeClick) {
80
+ var _useState = useState(false),
81
+ _useState2 = _slicedToArray(_useState, 2),
82
+ isModalOpen = _useState2[0],
83
+ setIsModalOpen = _useState2[1];
84
+ var handleCodeClick = function handleCodeClick(e) {
85
+ e.stopPropagation();
86
+ if (onCodeClick) {
87
+ onCodeClick();
88
+ } else {
89
+ setIsModalOpen(true);
90
+ }
91
+ };
92
+ var closeModal = function closeModal(e) {
93
+ e === null || e === void 0 || e.stopPropagation();
94
+ setIsModalOpen(false);
95
+ };
96
+ return {
97
+ isModalOpen: isModalOpen,
98
+ handleCodeClick: handleCodeClick,
99
+ closeModal: closeModal
100
+ };
101
+ };
102
+
103
+ // 子组件:卡片头部
104
+ var CardHeader = function CardHeader(_ref) {
105
+ var _ref$showIcon = _ref.showIcon,
106
+ showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
107
+ _ref$showWalletName = _ref.showWalletName,
108
+ showWalletName = _ref$showWalletName === void 0 ? true : _ref$showWalletName,
109
+ _ref$showShopName = _ref.showShopName,
110
+ showShopName = _ref$showShopName === void 0 ? true : _ref$showShopName,
111
+ _ref$showCardNo = _ref.showCardNo,
112
+ showCardNo = _ref$showCardNo === void 0 ? true : _ref$showCardNo,
113
+ _ref$showCode = _ref.showCode,
114
+ showCode = _ref$showCode === void 0 ? true : _ref$showCode,
115
+ iconImg = _ref.iconImg,
116
+ mode = _ref.mode,
117
+ _ref$walletName = _ref.walletName,
118
+ walletName = _ref$walletName === void 0 ? 'Level' : _ref$walletName,
119
+ _ref$shopName = _ref.shopName,
120
+ shopName = _ref$shopName === void 0 ? 'Store name' : _ref$shopName,
121
+ _ref$cardNo = _ref.cardNo,
122
+ cardNo = _ref$cardNo === void 0 ? 'Wallet number' : _ref$cardNo,
123
+ _ref$cardStyle = _ref.cardStyle,
124
+ cardStyle = _ref$cardStyle === void 0 ? 'normal' : _ref$cardStyle,
125
+ _ref$codeType = _ref.codeType,
126
+ codeType = _ref$codeType === void 0 ? 'barCode' : _ref$codeType,
127
+ onCodeClick = _ref.onCodeClick,
128
+ _ref$isLogin = _ref.isLogin,
129
+ isLogin = _ref$isLogin === void 0 ? false : _ref$isLogin;
130
+ // 处理可能为0/1的布尔值
131
+ var processedShowIcon = toBooleanValue(showIcon);
132
+ var processedShowWalletName = toBooleanValue(showWalletName);
133
+ var processedShowShopName = toBooleanValue(showShopName);
134
+ var processedShowCardNo = toBooleanValue(showCardNo);
135
+ var processedShowCode = toBooleanValue(showCode);
136
+ return /*#__PURE__*/React.createElement("div", {
137
+ className: "pisell-wallet-card-header"
138
+ }, /*#__PURE__*/React.createElement("div", {
139
+ className: "pisell-wallet-card-header-left"
140
+ }, /*#__PURE__*/React.createElement("div", {
141
+ className: "pisell-wallet-card-header-level"
142
+ }, processedShowIcon && iconImg ? /*#__PURE__*/React.createElement("div", {
143
+ className: "pisell-wallet-card-header-icon"
144
+ }, /*#__PURE__*/React.createElement("img", {
145
+ src: iconImg,
146
+ alt: "wallet icon",
147
+ style: {
148
+ width: '20px',
149
+ height: '20px'
150
+ }
151
+ })) : null, processedShowWalletName && walletName && /*#__PURE__*/React.createElement("div", {
152
+ className: "pisell-wallet-card-header-level-text"
153
+ }, walletName)), processedShowShopName && shopName && /*#__PURE__*/React.createElement("div", null, shopName), processedShowCardNo && cardNo && /*#__PURE__*/React.createElement("div", null, cardNo)), /*#__PURE__*/React.createElement("div", {
154
+ className: "pisell-wallet-card-header-right"
155
+ }, processedShowCode && cardStyle === 'normal' && /*#__PURE__*/React.createElement("div", {
156
+ className: "pisell-wallet-card-icon-wrapper",
157
+ onClick: onCodeClick
158
+ }, /*#__PURE__*/React.createElement(Iconfont, {
159
+ style: {
160
+ color: mode === 'dark' ? '#fff' : '#101828'
161
+ },
162
+ type: codeType === 'barCode' ? 'pisell2-Barcode' : 'pisell2-a-qr-code-02',
163
+ className: "pisell-wallet-card-icon"
164
+ }))));
165
+ };
166
+
167
+ // 子组件:卡片内容项
168
+ var CardItem = function CardItem(_ref2) {
169
+ var item = _ref2.item,
170
+ symbol = _ref2.symbol;
171
+ var key = item.key,
172
+ label = item.label,
173
+ value = item.value;
174
+ return /*#__PURE__*/React.createElement("div", {
175
+ className: "pisell-wallet-card-item"
176
+ }, /*#__PURE__*/React.createElement("div", {
177
+ className: "pisell-wallet-card-item-label"
178
+ }, getText("walletCard-".concat(label)) || ''), /*#__PURE__*/React.createElement("div", {
179
+ className: "pisell-wallet-card-item-value"
180
+ }, key === 'rechargeable' ? /*#__PURE__*/React.createElement(Amount, {
181
+ className: "pisell-card-amount-item-value",
182
+ platform: "h5",
183
+ symbol: symbol,
184
+ useThousandsSeparator: true,
185
+ showCurrencySymbol: true,
186
+ value: value
187
+ }) : value));
188
+ };
189
+
190
+ // 子组件:卡片内容
191
+ var CardContent = function CardContent(_ref3) {
192
+ var items = _ref3.items,
193
+ symbol = _ref3.symbol;
194
+ // 定义期望的顺序
195
+ var expectedOrder = ['piont', 'balance', 'discount', 'voucher'];
196
+
197
+ // 对 items 进行排序
198
+ var sortedItems = useMemo(function () {
199
+ if (!(items !== null && items !== void 0 && items.length)) return [];
200
+ return _toConsumableArray(items).sort(function (a, b) {
201
+ var indexA = expectedOrder.indexOf(a.key);
202
+ var indexB = expectedOrder.indexOf(b.key);
203
+ return indexA - indexB;
204
+ });
205
+ }, [items]);
206
+ return /*#__PURE__*/React.createElement("div", {
207
+ className: "pisell-wallet-card-list",
208
+ style: {
209
+ justifyContent: (sortedItems || []).length > 1 ? 'space-between' : 'flex-start'
210
+ }
211
+ }, (sortedItems || []).map(function (item, index) {
212
+ return /*#__PURE__*/React.createElement(CardItem, {
213
+ key: index,
214
+ item: item,
215
+ symbol: symbol
216
+ });
217
+ }));
218
+ };
219
+
220
+ // 子组件:二维码/条形码显示
221
+ var CodeDisplay = function CodeDisplay(_ref4) {
222
+ var codeType = _ref4.codeType,
223
+ cardNo = _ref4.cardNo;
224
+ if (!cardNo) return null;
225
+ return /*#__PURE__*/React.createElement("div", {
226
+ className: "pisell-wallet-card-code"
227
+ }, /*#__PURE__*/React.createElement("div", {
228
+ className: "pisell-wallet-card-code-qrcode"
229
+ }, codeType === 'barCode' ? /*#__PURE__*/React.createElement(Barcode, {
230
+ value: cardNo,
231
+ displayValue: false,
232
+ height: 114,
233
+ width: 3
234
+ }) : /*#__PURE__*/React.createElement(QRCode, {
235
+ size: 250,
236
+ value: cardNo,
237
+ bordered: false
238
+ }), /*#__PURE__*/React.createElement("div", {
239
+ className: "pisell-wallet-card-code-qrcode-value"
240
+ }, cardNo)));
241
+ };
242
+ var blockEvent = function blockEvent(e) {
243
+ e.stopPropagation();
244
+ e.preventDefault();
245
+ if (e.nativeEvent) {
246
+ e.nativeEvent.stopImmediatePropagation();
247
+ e.nativeEvent.preventDefault();
248
+ }
249
+ return false;
250
+ };
251
+
252
+ // 子组件:二维码/条形码模态框
253
+ var CodeModal = function CodeModal(_ref5) {
254
+ var isOpen = _ref5.isOpen,
255
+ onClose = _ref5.onClose,
256
+ codeType = _ref5.codeType,
257
+ cardNo = _ref5.cardNo,
258
+ platform = _ref5.platform;
259
+ return /*#__PURE__*/React.createElement(PisellModal, {
260
+ title: getText(codeType === 'barCode' ? 'walletCard-barcode' : 'walletCard-qrcode'),
261
+ platform: platform,
262
+ onCancel: onClose,
263
+ open: isOpen,
264
+ footer: null,
265
+ mobileModalHeight: "auto",
266
+ className: "pisell-qrcode-modal",
267
+ bodyStyle: {
268
+ padding: 0
269
+ }
270
+ }, /*#__PURE__*/React.createElement("div", {
271
+ className: "pisell-qrcode-modal-content",
272
+ onClick: blockEvent,
273
+ onTouchStart: blockEvent,
274
+ onTouchMove: blockEvent,
275
+ onTouchEnd: blockEvent,
276
+ onTouchCancel: blockEvent,
277
+ onMouseDown: blockEvent,
278
+ onMouseMove: blockEvent,
279
+ onMouseUp: blockEvent,
280
+ onWheel: blockEvent,
281
+ onScroll: blockEvent,
282
+ onDragStart: blockEvent,
283
+ onDrag: blockEvent,
284
+ onDragEnd: blockEvent
285
+ }, /*#__PURE__*/React.createElement(CodeDisplay, {
286
+ codeType: codeType,
287
+ cardNo: cardNo
288
+ })));
289
+ };
290
+
291
+ // 主组件
292
+ var WalletCard = function WalletCard(props) {
293
+ var mergedProps = _objectSpread(_objectSpread({}, DEFAULT_PROPS), props);
294
+ var symbol = mergedProps.symbol,
295
+ mode = mergedProps.mode,
296
+ iconImg = mergedProps.iconImg,
297
+ shopName = mergedProps.shopName,
298
+ cardNo = mergedProps.cardNo,
299
+ cardStyle = mergedProps.cardStyle,
300
+ codeType = mergedProps.codeType,
301
+ platform = mergedProps.platform,
302
+ codeDirection = mergedProps.codeDirection,
303
+ walletName = mergedProps.walletName,
304
+ _mergedProps$items = mergedProps.items,
305
+ items = _mergedProps$items === void 0 ? [] : _mergedProps$items,
306
+ onCodeClick = mergedProps.onCodeClick,
307
+ onClick = mergedProps.onClick,
308
+ className = mergedProps.className,
309
+ style = mergedProps.style;
310
+
311
+ // 处理可能为0/1的布尔值props
312
+ var showIcon = toBooleanValue(mergedProps.showIcon);
313
+ var showWalletName = toBooleanValue(mergedProps.showWalletName);
314
+ var showShopName = toBooleanValue(mergedProps.showShopName);
315
+ var showCardNo = toBooleanValue(mergedProps.showCardNo);
316
+ var showCode = toBooleanValue(mergedProps.showCode);
317
+ var isLogin = toBooleanValue(mergedProps.isLogin);
318
+ var context = useEngineContext();
319
+ var _ref6 = context.appHelper || {},
320
+ utils = _ref6.utils;
321
+ // 使用自定义钩子处理模态框逻辑
322
+ var _useCodeModal = useCodeModal(cardNo, onCodeClick),
323
+ isModalOpen = _useCodeModal.isModalOpen,
324
+ handleCodeClick = _useCodeModal.handleCodeClick,
325
+ closeModal = _useCodeModal.closeModal;
326
+
327
+ // 计算背景样式
328
+ var backgroundStyle = useMemo(function () {
329
+ if (props.customBackgroundImage) {
330
+ return {
331
+ backgroundImage: "url(".concat(props.customBackgroundImage, ")")
332
+ };
333
+ } else {
334
+ return {
335
+ backgroundImage: "url(https://file.mypisell-dev.com/pisel/image/9/".concat(mode === 'dark' ? '3d039c83ff5b84fadafb8a23c33d6cc42025_02_26_00_42_53_288_08413160975__720_456__' : '61dcbe950c9451164a6bb1d17d5bc5f02025_02_26_00_43_42_741_04853453608__720_456__', ".png)")
336
+ };
337
+ }
338
+ }, [props.customBackgroundImage, mode]);
339
+ var goWallet = function goWallet() {
340
+ utils === null || utils === void 0 || utils.action({
341
+ type: 'pisell1.goWallet',
342
+ data: {},
343
+ callback: function callback() {}
344
+ });
345
+ };
346
+ return /*#__PURE__*/React.createElement("div", {
347
+ className: classNames('pisell-wallet-card-wrapper', className),
348
+ style: style,
349
+ onClick: onClick
350
+ }, /*#__PURE__*/React.createElement(Card, {
351
+ style: {
352
+ border: 'none'
353
+ },
354
+ bodyStyle: {
355
+ padding: 0
356
+ }
357
+ }, /*#__PURE__*/React.createElement("div", {
358
+ className: "pisell-wallet-card-container",
359
+ style: {
360
+ flexDirection: codeDirection === 'top' ? 'column-reverse' : 'column'
361
+ }
362
+ }, /*#__PURE__*/React.createElement("div", {
363
+ className: classNames('pisell-wallet-card-content', mode, !isLogin && 'pisell-wallet-card-guest-content'),
364
+ style: backgroundStyle
365
+ }, isLogin ? /*#__PURE__*/React.createElement("div", {
366
+ onClick: function onClick() {
367
+ goWallet();
368
+ }
369
+ }, /*#__PURE__*/React.createElement(CardHeader, {
370
+ mode: mode,
371
+ showWalletName: showWalletName,
372
+ showIcon: showIcon,
373
+ iconImg: iconImg,
374
+ walletName: walletName,
375
+ shopName: shopName,
376
+ showShopName: showShopName,
377
+ cardNo: cardNo,
378
+ showCardNo: showCardNo,
379
+ showCode: showCode,
380
+ cardStyle: cardStyle,
381
+ codeType: codeType,
382
+ onCodeClick: handleCodeClick,
383
+ isLogin: isLogin
384
+ }), /*#__PURE__*/React.createElement(CardContent, {
385
+ items: items,
386
+ symbol: symbol
387
+ })) : /*#__PURE__*/React.createElement(Guest, {
388
+ setting: props
389
+ })), cardStyle === 'full' && isLogin && /*#__PURE__*/React.createElement("div", {
390
+ className: classNames('pisell-wallet-card-showCode', codeDirection === 'top' ? 'code-top' : 'code-bottom')
391
+ }, /*#__PURE__*/React.createElement(CodeDisplay, {
392
+ codeType: codeType,
393
+ cardNo: cardNo
394
+ })))), /*#__PURE__*/React.createElement(CodeModal, {
395
+ isOpen: isModalOpen,
396
+ onClose: closeModal,
397
+ codeType: codeType,
398
+ cardNo: cardNo,
399
+ platform: platform
400
+ }));
401
+ };
402
+ export default WalletCard;