@pisell/materials 6.2.38 → 6.2.40

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 (137) 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 +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +36 -21
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +35 -20
  11. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +11 -4
  12. package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
  13. package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -2
  14. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
  15. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +33 -15
  16. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +2 -1
  17. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +92 -6
  18. package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +5 -0
  19. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  20. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +199 -19
  21. package/es/components/dataSourceComponents/fields/Upload/CameraPopover.js +66 -0
  22. package/es/components/dataSourceComponents/fields/Upload/index.less +35 -3
  23. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  24. package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
  25. package/es/components/filter/types.d.ts +2 -0
  26. package/es/components/pisellCamera/index.js +228 -0
  27. package/es/components/pisellCamera/index.less +131 -0
  28. package/es/components/pisellCardList/index.js +3 -1
  29. package/es/components/pisellCheckboxGroup/index.js +15 -1
  30. package/es/components/pisellWalletPassCard/index.d.ts +1 -0
  31. package/es/components/pisellWalletPassCard/index.js +6 -1
  32. package/es/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +2 -1
  33. package/es/components/productCard/cartSkuCard/components/swipeAction/index.js +74 -6
  34. package/es/components/productCard/cartSkuCard/components/swipeAction/index.less +39 -0
  35. package/es/components/productCard/cartSkuCard/index.js +2 -11
  36. package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
  37. package/es/components/table/Table/fields/index.d.ts +2 -2
  38. package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
  39. package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
  40. package/es/components/table/Table/utils.d.ts +1 -1
  41. package/es/components/table/Table/utils.js +22 -1
  42. package/es/components/table/hooks/useTableSetting.d.ts +3 -4
  43. package/es/components/table/hooks/useTableSetting.js +113 -5
  44. package/es/components/table/index.js +14 -3
  45. package/es/components/table/types.d.ts +17 -0
  46. package/es/components/walletCard/Guide/index.js +12 -1
  47. package/es/components/walletCard/index.js +29 -3
  48. package/es/components/walletCard/index.less +27 -0
  49. package/es/locales/en-US.js +83 -69
  50. package/es/locales/zh-CN.js +84 -70
  51. package/es/locales/zh-TW.js +84 -70
  52. package/es/utils/index.d.ts +1 -1
  53. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +8 -2
  54. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
  55. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -2
  56. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
  57. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +20 -7
  58. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +2 -1
  59. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +78 -7
  60. package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +5 -0
  61. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  62. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +168 -5
  63. package/lib/components/dataSourceComponents/fields/Upload/CameraPopover.js +95 -0
  64. package/lib/components/dataSourceComponents/fields/Upload/index.less +35 -3
  65. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  66. package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
  67. package/lib/components/filter/types.d.ts +2 -0
  68. package/lib/components/pisellCamera/index.js +222 -0
  69. package/lib/components/pisellCamera/index.less +131 -0
  70. package/lib/components/pisellCardList/index.js +3 -1
  71. package/lib/components/pisellCheckboxGroup/index.js +16 -0
  72. package/lib/components/pisellWalletPassCard/index.d.ts +1 -0
  73. package/lib/components/pisellWalletPassCard/index.js +9 -1
  74. package/lib/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +2 -1
  75. package/lib/components/productCard/cartSkuCard/components/swipeAction/index.js +45 -11
  76. package/lib/components/productCard/cartSkuCard/components/swipeAction/index.less +39 -0
  77. package/lib/components/productCard/cartSkuCard/index.js +2 -13
  78. package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
  79. package/lib/components/table/Table/fields/index.d.ts +2 -2
  80. package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
  81. package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
  82. package/lib/components/table/Table/utils.d.ts +1 -1
  83. package/lib/components/table/Table/utils.js +18 -1
  84. package/lib/components/table/hooks/useTableSetting.d.ts +3 -4
  85. package/lib/components/table/hooks/useTableSetting.js +114 -4
  86. package/lib/components/table/index.js +12 -1
  87. package/lib/components/table/types.d.ts +17 -0
  88. package/lib/components/walletCard/Guide/index.js +11 -1
  89. package/lib/components/walletCard/index.js +27 -3
  90. package/lib/components/walletCard/index.less +27 -0
  91. package/lib/locales/en-US.js +15 -1
  92. package/lib/locales/zh-CN.js +15 -1
  93. package/lib/locales/zh-TW.js +15 -1
  94. package/lib/utils/index.d.ts +1 -1
  95. package/lowcode/data-source-table/meta.ts +358 -66
  96. package/lowcode/form-item-upload/meta.ts +20 -5
  97. package/lowcode/pisell-upload/meta.ts +8 -0
  98. package/lowcode/pisell-wallet-pass-card/meta.ts +19 -0
  99. package/lowcode/table/meta.ts +104 -0
  100. package/lowcode/wallet-card/meta.ts +81 -63
  101. package/package.json +2 -1
  102. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +0 -98
  103. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +0 -37
  104. package/es/components/pisell-config-provider/context.d.ts +0 -20
  105. package/es/components/pisell-config-provider/index.d.ts +0 -12
  106. package/es/components/pisellAdjustPrice/index.d.ts +0 -4
  107. package/es/components/pisellAdjustPrice/type.d.ts +0 -20
  108. package/es/components/pisellCheckboxGroup/index.d.ts +0 -36
  109. package/es/components/pisellQRScanner/index.d.ts +0 -37
  110. package/es/components/pisellText/components/Amount/index.d.ts +0 -20
  111. package/es/components/table/Table/AddFieldModal/index.d.ts +0 -3
  112. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +0 -11
  113. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +0 -21
  114. package/es/components/virtual-keyboard/Number/index.d.ts +0 -5
  115. package/es/components/virtual-keyboard/Number/types.d.ts +0 -25
  116. package/es/components/walletCard/index.d.ts +0 -67
  117. package/es/locales/en-US.d.ts +0 -278
  118. package/es/locales/zh-CN.d.ts +0 -273
  119. package/es/locales/zh-TW.d.ts +0 -273
  120. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +0 -98
  121. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +0 -37
  122. package/lib/components/pisell-config-provider/context.d.ts +0 -20
  123. package/lib/components/pisell-config-provider/index.d.ts +0 -12
  124. package/lib/components/pisellAdjustPrice/index.d.ts +0 -4
  125. package/lib/components/pisellAdjustPrice/type.d.ts +0 -20
  126. package/lib/components/pisellCheckboxGroup/index.d.ts +0 -36
  127. package/lib/components/pisellQRScanner/index.d.ts +0 -37
  128. package/lib/components/pisellText/components/Amount/index.d.ts +0 -20
  129. package/lib/components/table/Table/AddFieldModal/index.d.ts +0 -3
  130. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +0 -11
  131. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +0 -21
  132. package/lib/components/virtual-keyboard/Number/index.d.ts +0 -5
  133. package/lib/components/virtual-keyboard/Number/types.d.ts +0 -25
  134. package/lib/components/walletCard/index.d.ts +0 -67
  135. package/lib/locales/en-US.d.ts +0 -278
  136. package/lib/locales/zh-CN.d.ts +0 -273
  137. package/lib/locales/zh-TW.d.ts +0 -273
@@ -0,0 +1,228 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
8
+ import { Camera } from 'react-camera-pro';
9
+ import Iconfont from "../iconfont";
10
+ import { getText } from "../../locales";
11
+ import PisellModal from "../../components/pisellModal";
12
+ import "./index.less";
13
+ var PisellCamera = /*#__PURE__*/forwardRef(function (props, ref) {
14
+ var cameraRef = useRef(null);
15
+ var _useState = useState(false),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ open = _useState2[0],
18
+ setOpen = _useState2[1];
19
+ var _useState3 = useState(''),
20
+ _useState4 = _slicedToArray(_useState3, 2),
21
+ photo = _useState4[0],
22
+ setPhoto = _useState4[1];
23
+ var _useState5 = useState(null),
24
+ _useState6 = _slicedToArray(_useState5, 2),
25
+ cameraAvailable = _useState6[0],
26
+ setCameraAvailable = _useState6[1]; // null: 检测中, true: 可用, false: 不可用
27
+ var uploadFileRef = useRef(null);
28
+
29
+ // Base64转File对象
30
+ var base64ToFile = function base64ToFile(base64String, filename) {
31
+ var _arr$0$match;
32
+ var arr = base64String.split(',');
33
+ var mime = ((_arr$0$match = arr[0].match(/:(.*?);/)) === null || _arr$0$match === void 0 ? void 0 : _arr$0$match[1]) || '';
34
+ var bstr = atob(arr[1]);
35
+ var n = bstr.length;
36
+ var u8arr = new Uint8Array(n);
37
+ while (n--) {
38
+ u8arr[n] = bstr.charCodeAt(n);
39
+ }
40
+ return new File([u8arr], filename, {
41
+ type: mime
42
+ });
43
+ };
44
+
45
+ // 拍照并添加到fileList
46
+ var takePhoto = function takePhoto() {
47
+ if (!cameraRef.current || !cameraRef.current.takePhoto) {
48
+ return;
49
+ }
50
+ try {
51
+ var _cameraRef$current, _cameraRef$current$ta;
52
+ var _photo = (_cameraRef$current = cameraRef.current) === null || _cameraRef$current === void 0 || (_cameraRef$current$ta = _cameraRef$current.takePhoto) === null || _cameraRef$current$ta === void 0 ? void 0 : _cameraRef$current$ta.call(_cameraRef$current);
53
+ var timestamp = Date.now();
54
+ var filename = "photo-".concat(timestamp, ".jpg");
55
+ setPhoto(_photo);
56
+
57
+ // 转换为File对象
58
+ var file = base64ToFile(_photo, filename);
59
+
60
+ // 创建符合Antd Upload格式的文件对象
61
+ var uploadFile = {
62
+ uid: timestamp.toString(),
63
+ name: filename,
64
+ status: 'uploading',
65
+ url: _photo,
66
+ // 用于预览
67
+ originFileObj: file,
68
+ // 原始文件对象,用于上传
69
+ thumbUrl: _photo,
70
+ lastModified: Date.now(),
71
+ lastModifiedDate: new Date(),
72
+ type: 'image/jpeg',
73
+ size: file.size
74
+ };
75
+ console.log('takePhoto_uploadFile', uploadFile);
76
+ uploadFileRef.current = uploadFile;
77
+ return uploadFile;
78
+ } catch (error) {
79
+ console.error('takePhoto_error', error);
80
+ uploadFileRef.current = null;
81
+ setPhoto('');
82
+ return null;
83
+ }
84
+ };
85
+ var onOpen = function onOpen() {
86
+ setCameraAvailable(null);
87
+ setPhoto('');
88
+ uploadFileRef.current = null;
89
+ setOpen(true);
90
+ };
91
+
92
+ // 关闭相机弹窗,重置状态
93
+ var onClose = function onClose() {
94
+ cameraRef.current = null;
95
+ uploadFileRef.current = null;
96
+ setOpen(false);
97
+ setPhoto('');
98
+ setCameraAvailable(null);
99
+ };
100
+
101
+ // 重拍照片
102
+ var onRetakePhoto = function onRetakePhoto() {
103
+ setPhoto('');
104
+ };
105
+
106
+ // 使用照片
107
+ var onUsePhoto = function onUsePhoto() {
108
+ var _props$onChange;
109
+ props === null || props === void 0 || (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, uploadFileRef.current);
110
+ onClose();
111
+ };
112
+ useImperativeHandle(ref, function () {
113
+ return {
114
+ open: onOpen,
115
+ takePhoto: takePhoto,
116
+ isCameraAvailable: function isCameraAvailable() {
117
+ return cameraAvailable;
118
+ }
119
+ };
120
+ });
121
+ console.log('cameraAvailable', cameraAvailable);
122
+ return /*#__PURE__*/React.createElement(PisellModal, {
123
+ open: open,
124
+ onCancel: function onCancel(e) {
125
+ e.stopPropagation();
126
+ e.preventDefault();
127
+ onClose();
128
+ },
129
+ header: false,
130
+ footer: null,
131
+ destroyOnClose: true,
132
+ bodyStyle: {
133
+ padding: 0
134
+ },
135
+ width: '90vw',
136
+ className: "pisell-camera-modal"
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: "pisell-camera-container",
139
+ onClick: function onClick(e) {
140
+ e.stopPropagation();
141
+ e.preventDefault();
142
+ }
143
+ }, cameraAvailable === null ?
144
+ /*#__PURE__*/
145
+ // 检测中
146
+ React.createElement("div", {
147
+ className: "pisell-camera-loading"
148
+ }, /*#__PURE__*/React.createElement("div", {
149
+ className: "pisell-camera-loading-text"
150
+ }, getText('pisell-camera-checking'))) : cameraAvailable === false ?
151
+ /*#__PURE__*/
152
+ // 无摄像头
153
+ React.createElement("div", {
154
+ className: "pisell-camera-no-camera"
155
+ }, /*#__PURE__*/React.createElement("div", {
156
+ className: "pisell-camera-no-camera-icon"
157
+ }, "\uD83D\uDCF7"), /*#__PURE__*/React.createElement("div", {
158
+ className: "pisell-camera-no-camera-text"
159
+ }, getText('pisell-camera-no-camera-accessible')), /*#__PURE__*/React.createElement("div", {
160
+ className: "pisell-camera-no-camera-desc"
161
+ }, getText('pisell-camera-no-camera-desc'))) : null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Camera, {
162
+ ref: cameraRef,
163
+ facingMode: "environment",
164
+ errorMessages: {
165
+ // noCameraAccessible: getText('pisell-camera-no-camera-accessible'),
166
+ // permissionDenied: getText('pisell-camera-permission-denied'),
167
+ // switchCamera: getText('pisell-camera-switch-camera'),
168
+ // canvas: getText('pisell-camera-canvas'),
169
+ },
170
+ numberOfCamerasCallback: function numberOfCamerasCallback(numberOfCameras) {
171
+ console.log('numberOfCameras', numberOfCameras);
172
+ if (!cameraRef.current) {
173
+ return;
174
+ }
175
+ if (numberOfCameras <= 0) {
176
+ setTimeout(function () {
177
+ setCameraAvailable(function (pre) {
178
+ if (pre === true) {
179
+ return true;
180
+ }
181
+ return false;
182
+ });
183
+ }, 5000);
184
+ } else {
185
+ setCameraAvailable(true);
186
+ }
187
+ }
188
+ }), cameraAvailable === true && /*#__PURE__*/React.createElement("div", {
189
+ className: "pisell-camera-action"
190
+ }, /*#__PURE__*/React.createElement("div", {
191
+ className: "pisell-camera-action-item-wrap",
192
+ onClick: function onClick(e) {
193
+ e.stopPropagation();
194
+ e.preventDefault();
195
+ takePhoto();
196
+ }
197
+ }, /*#__PURE__*/React.createElement("div", {
198
+ className: "pisell-camera-action-item"
199
+ }, /*#__PURE__*/React.createElement(Iconfont, {
200
+ type: "pisell2-camera-01",
201
+ style: {
202
+ fontSize: 32
203
+ }
204
+ })))), photo && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
205
+ className: "pisell-camera-photo-container"
206
+ }, /*#__PURE__*/React.createElement("img", {
207
+ src: photo,
208
+ alt: "photo",
209
+ className: "pisell-camera-photo"
210
+ })), /*#__PURE__*/React.createElement("div", {
211
+ className: "pisell-camera-photo-img-action"
212
+ }, /*#__PURE__*/React.createElement("div", {
213
+ className: "pisell-camera-photo-img-action-item",
214
+ onClick: function onClick(e) {
215
+ e.stopPropagation();
216
+ e.preventDefault();
217
+ onRetakePhoto();
218
+ }
219
+ }, getText('pisell-upload-camera-retake')), /*#__PURE__*/React.createElement("div", {
220
+ className: "pisell-camera-photo-img-action-item",
221
+ onClick: function onClick(e) {
222
+ e.stopPropagation();
223
+ e.preventDefault();
224
+ onUsePhoto();
225
+ }
226
+ }, getText('pisell-upload-camera-use')))))));
227
+ });
228
+ export default PisellCamera;
@@ -0,0 +1,131 @@
1
+ .pisell-camera-modal {
2
+ .pisell-camera-container {
3
+ width: 100%;
4
+ height: 90vh;
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ justify-content: center;
9
+
10
+ .pisell-camera-action {
11
+ position: absolute;
12
+ bottom: 0;
13
+ left: 0;
14
+ right: 0;
15
+ height: 100px;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+
20
+ .pisell-camera-action-item-wrap {
21
+ box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
22
+ cursor: pointer;
23
+ padding: 6px;
24
+ border-radius: 50%;
25
+ border: 2px solid #fff;
26
+
27
+ .pisell-camera-action-item {
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ width: 60px;
32
+ height: 60px;
33
+ background-color: #fff;
34
+ border-radius: 50%;
35
+ }
36
+ }
37
+
38
+ }
39
+
40
+ .pisell-camera-photo-container {
41
+ position: absolute;
42
+ top: 0;
43
+ left: 0;
44
+ right: 0;
45
+ bottom: 0;
46
+ width: 100%;
47
+ height: 100%;
48
+
49
+ .pisell-camera-photo {
50
+ width: 100%;
51
+ height: 100%;
52
+ object-fit: cover;
53
+ }
54
+ }
55
+
56
+ .pisell-camera-photo-img-action {
57
+ position: absolute;
58
+ bottom: 0;
59
+ left: 0;
60
+ right: 0;
61
+ height: 100px;
62
+ display: flex;
63
+ flex-direction: row;
64
+ align-items: center;
65
+ justify-content: space-between;
66
+ background-color: rgba(0, 0, 0, 0.5);
67
+
68
+ .pisell-camera-photo-img-action-item {
69
+ padding: 20px 60px;
70
+ font-size: 20px;
71
+ color: #fff;
72
+ cursor: pointer;
73
+ }
74
+ }
75
+
76
+ .pisell-camera-loading {
77
+ position: absolute;
78
+ top: 0;
79
+ left: 0;
80
+ right: 0;
81
+ bottom: 0;
82
+ background-color: transparent;
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+
87
+ .pisell-camera-loading-text {
88
+ font-size: 18px;
89
+ color: #666;
90
+ }
91
+ }
92
+
93
+ .pisell-camera-no-camera {
94
+ position: absolute;
95
+ top: 0;
96
+ left: 0;
97
+ right: 0;
98
+ bottom: 0;
99
+ background-color: #ffffff;
100
+ display: flex;
101
+ flex-direction: column;
102
+ align-items: center;
103
+ justify-content: center;
104
+ width: 100%;
105
+ height: 100%;
106
+ background-color: #f5f5f5;
107
+ padding: 40px;
108
+ text-align: center;
109
+
110
+ .pisell-camera-no-camera-icon {
111
+ font-size: 64px;
112
+ margin-bottom: 20px;
113
+ opacity: 0.6;
114
+ }
115
+
116
+ .pisell-camera-no-camera-text {
117
+ font-size: 20px;
118
+ color: #333;
119
+ margin-bottom: 12px;
120
+ font-weight: 500;
121
+ }
122
+
123
+ .pisell-camera-no-camera-desc {
124
+ font-size: 14px;
125
+ color: #666;
126
+ line-height: 1.5;
127
+ max-width: 300px;
128
+ }
129
+ }
130
+ }
131
+ }
@@ -37,7 +37,8 @@ var PisellCardList = function PisellCardList(props) {
37
37
  showValidDate = props.showValidDate,
38
38
  empty = props.empty,
39
39
  showEmpty = props.showEmpty,
40
- showBalanceSymbol = props.showBalanceSymbol;
40
+ showBalanceSymbol = props.showBalanceSymbol,
41
+ onChangeDebounce = props.onChangeDebounce;
41
42
  return data.length ? /*#__PURE__*/React.createElement(PisellCheckboxGroup, {
42
43
  options: data,
43
44
  value: value,
@@ -48,6 +49,7 @@ var PisellCardList = function PisellCardList(props) {
48
49
  onChange: onChange,
49
50
  iconPosition: "hide",
50
51
  fullWidth: fullWidth,
52
+ onChangeDebounce: onChangeDebounce,
51
53
  renderOption: function renderOption(item, active, index) {
52
54
  return /*#__PURE__*/React.createElement(PisellWalletPassCard, _extends({}, item, {
53
55
  active: active,
@@ -1,5 +1,5 @@
1
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
- var _excluded = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "direction", "fullWidth", "iconPosition", "optionClassName", "optionActiveClassName"];
2
+ var _excluded = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "direction", "fullWidth", "iconPosition", "optionClassName", "optionActiveClassName", "onChangeDebounce"];
3
3
  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); }
4
4
  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; }
5
5
  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; }
@@ -18,6 +18,7 @@ import React, { useEffect, useMemo } from 'react';
18
18
  import usePisellConfig from "../pisell-config-provider/hooks/usePisellConfig";
19
19
  import classNames from 'classnames';
20
20
  import { Checkbox, Radio } from 'antd';
21
+ import { useDebounceFn } from "ahooks";
21
22
  import { isNumber } from '@pisell/utils';
22
23
  import { changeArray } from '@pisell/utils';
23
24
  import "./index.less";
@@ -63,6 +64,7 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
63
64
  iconPosition = _props$iconPosition === void 0 ? 'left' : _props$iconPosition,
64
65
  optionClassName = props.optionClassName,
65
66
  optionActiveClassName = props.optionActiveClassName,
67
+ onChangeDebounce = props.onChangeDebounce,
66
68
  rest = _objectWithoutProperties(props, _excluded);
67
69
  var _useState = useState([]),
68
70
  _useState2 = _slicedToArray(_useState, 2),
@@ -141,6 +143,14 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
141
143
  // 单选模式, 只返回第一个值
142
144
  onChange === null || onChange === void 0 || onChange(mode === 'single' ? val[0] : val, item);
143
145
  };
146
+ var _useDebounceFn = useDebounceFn(function (key, item) {
147
+ handleSelectItem(key, item);
148
+ }, {
149
+ wait: 400,
150
+ leading: true,
151
+ trailing: false
152
+ }),
153
+ run = _useDebounceFn.run;
144
154
 
145
155
  /**
146
156
  * @title: 选择
@@ -181,6 +191,10 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
181
191
  style: rowStyle,
182
192
  onClick: function onClick(e) {
183
193
  if (option.disabled) return;
194
+ if (onChangeDebounce) {
195
+ run(option[rowKey], option);
196
+ return;
197
+ }
184
198
  handleSelectItem(option[rowKey], option);
185
199
  },
186
200
  leftContent: iconPosition === 'left' && /*#__PURE__*/React.createElement(CheckBoxItem, {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  export interface PisellWalletPassCardProps {
3
4
  id: number;
@@ -335,6 +335,7 @@ var PisellWalletPassCard = function PisellWalletPassCard(props) {
335
335
  }, showStoreName && storeName));
336
336
  };
337
337
  var renderBalanceInfo = function renderBalanceInfo() {
338
+ var _props$metadata;
338
339
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
339
340
  className: "pisell-card-amount-wrap"
340
341
  }, showRedeem && !disabled && /*#__PURE__*/React.createElement("div", {
@@ -360,7 +361,11 @@ var PisellWalletPassCard = function PisellWalletPassCard(props) {
360
361
  className: "pisell-card-amount-item-label"
361
362
  }, getText('pisell-discount-card-title')), /*#__PURE__*/React.createElement("div", {
362
363
  className: "pisell-card-amount-item-value"
363
- }, discount, "% ", getText('pisell-discount-card-unit')))), /*#__PURE__*/React.createElement("div", {
364
+ }, ((_props$metadata = props.metadata) === null || _props$metadata === void 0 ? void 0 : _props$metadata.discount_card_type) === 'fixed_amount' ? /*#__PURE__*/React.createElement(React.Fragment, null, getText('pisell-discount-card-fixed-amount-prefix'), ' ', /*#__PURE__*/React.createElement(Amount, {
365
+ className: "pisell-card-amount-item-value",
366
+ useThousandsSeparator: true,
367
+ value: discount
368
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, discount, "% ", getText('pisell-discount-card-unit'))))), /*#__PURE__*/React.createElement("div", {
364
369
  className: "pisell-card-code-wrap"
365
370
  }, /*#__PURE__*/React.createElement("div", {
366
371
  className: "pisell-card-code"
@@ -1,11 +1,11 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import React from 'react';
3
+ import './index.less';
3
4
  declare type NativeProps<S extends string = never> = {
4
5
  className?: string;
5
6
  style?: React.CSSProperties & Partial<Record<S, string>>;
6
7
  };
7
8
  declare type PropagationEvent = 'click';
8
- import './index.less';
9
9
  declare type SideType = 'left' | 'right';
10
10
  export declare type SwipeActionRef = {
11
11
  close: () => void;
@@ -17,6 +17,7 @@ export declare type Action = {
17
17
  text: ReactNode;
18
18
  color?: ActionColor | string;
19
19
  onClick?: (e: React.MouseEvent) => void;
20
+ style?: React.CSSProperties;
20
21
  };
21
22
  export declare type SwipeActionProps = {
22
23
  rightActions?: Action[];
@@ -13,7 +13,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
13
13
  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); }
14
14
  import { animated, useSpring } from '@react-spring/web';
15
15
  import { useDrag } from '@use-gesture/react/dist/use-gesture-react.cjs';
16
- import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
16
+ import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
17
+ import "./index.less";
18
+
17
19
  // 本地实现的工具函数和类型
18
20
 
19
21
  // withNativeProps 工具函数
@@ -71,7 +73,6 @@ var Button = function Button(_ref) {
71
73
  onClick: onClick
72
74
  }, children);
73
75
  };
74
- import "./index.less";
75
76
  var classPrefix = "pisell-custom-swipe-action";
76
77
  var defaultProps = {
77
78
  rightActions: [],
@@ -85,17 +86,35 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
85
86
  var rootRef = useRef(null);
86
87
  var leftRef = useRef(null);
87
88
  var rightRef = useRef(null);
89
+
90
+ // 添加容器高度状态
91
+ var _useState = useState(0),
92
+ _useState2 = _slicedToArray(_useState, 2),
93
+ containerHeight = _useState2[0],
94
+ setContainerHeight = _useState2[1];
88
95
  function getWidth(ref) {
89
96
  var element = ref.current;
90
97
  if (!element) return 0;
91
98
  return element.offsetWidth;
92
99
  }
100
+
101
+ // 添加获取高度的函数
102
+ function getHeight(ref) {
103
+ var element = ref.current;
104
+ if (!element) return 0;
105
+ return element.offsetHeight;
106
+ }
93
107
  function getLeftWidth() {
94
108
  return getWidth(leftRef);
95
109
  }
96
110
  function getRightWidth() {
97
111
  return getWidth(rightRef);
98
112
  }
113
+
114
+ // 添加获取根容器高度的函数
115
+ function getRootHeight() {
116
+ return getHeight(rootRef);
117
+ }
99
118
  var _useSpring = useSpring(function () {
100
119
  return {
101
120
  x: 0,
@@ -198,6 +217,26 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
198
217
  close: close
199
218
  };
200
219
  });
220
+
221
+ // 添加高度检测的 useEffect
222
+ useEffect(function () {
223
+ var updateHeight = function updateHeight() {
224
+ var height = getRootHeight();
225
+ setContainerHeight(height);
226
+ };
227
+
228
+ // 组件挂载后检测高度
229
+ updateHeight();
230
+
231
+ // 监听窗口大小变化
232
+ var resizeObserver = new ResizeObserver(updateHeight);
233
+ if (rootRef.current) {
234
+ resizeObserver.observe(rootRef.current);
235
+ }
236
+ return function () {
237
+ resizeObserver.disconnect();
238
+ };
239
+ }, []);
201
240
  useEffect(function () {
202
241
  if (!props.closeOnTouchOutside) return;
203
242
  function handle(e) {
@@ -224,13 +263,38 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
224
263
  document.removeEventListener('mousedown', handle);
225
264
  };
226
265
  }, [props.closeOnTouchOutside, props.escapeDom]);
266
+
267
+ // 根据容器高度获取右侧容器的 class 名称
268
+ var getRightContainerClass = function getRightContainerClass() {
269
+ var baseClass = "".concat(classPrefix, "-actions ").concat(classPrefix, "-actions-right");
270
+ if (containerHeight > 180) {
271
+ return "".concat(baseClass, " ").concat(classPrefix, "-height-large");
272
+ } else if (containerHeight > 120) {
273
+ return "".concat(baseClass, " ").concat(classPrefix, "-height-medium");
274
+ }
275
+ return "".concat(baseClass, " ").concat(classPrefix, "-height-small");
276
+ };
277
+
278
+ // 根据容器高度获取右侧按钮的 class 名称
279
+ var getRightActionButtonClass = function getRightActionButtonClass() {
280
+ if (containerHeight > 180) {
281
+ return "".concat(classPrefix, "-action-height-large");
282
+ } else if (containerHeight > 120) {
283
+ return "".concat(classPrefix, "-action-height-medium");
284
+ }
285
+ return "".concat(classPrefix, "-action-height-small");
286
+ };
227
287
  function renderAction(action) {
228
288
  var _action$color, _colorRecord$color;
289
+ var isRightAction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
229
290
  var color = (_action$color = action.color) !== null && _action$color !== void 0 ? _action$color : 'light';
230
291
  var _style = action.style || {};
292
+
293
+ // 为右侧按钮添加基于高度的 class
294
+ var buttonClass = isRightAction ? "".concat(classPrefix, "-action-button ").concat(getRightActionButtonClass()) : "".concat(classPrefix, "-action-button");
231
295
  return /*#__PURE__*/React.createElement(Button, {
232
296
  key: action.key,
233
- className: "".concat(classPrefix, "-action-button"),
297
+ className: buttonClass,
234
298
  style: _objectSpread({
235
299
  '--background-color': (_colorRecord$color = colorRecord[color]) !== null && _colorRecord$color !== void 0 ? _colorRecord$color : color
236
300
  }, _style),
@@ -262,7 +326,9 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
262
326
  }, withStopPropagation(props.stopPropagation, /*#__PURE__*/React.createElement("div", {
263
327
  className: "".concat(classPrefix, "-actions ").concat(classPrefix, "-actions-left"),
264
328
  ref: leftRef
265
- }, props.leftActions.map(renderAction))), /*#__PURE__*/React.createElement("div", {
329
+ }, props.leftActions.map(function (action) {
330
+ return renderAction(action, false);
331
+ }))), /*#__PURE__*/React.createElement("div", {
266
332
  className: "".concat(classPrefix, "-content"),
267
333
  onClickCapture: function onClickCapture(e) {
268
334
  if (x.goal !== 0) {
@@ -278,9 +344,11 @@ export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
278
344
  })
279
345
  }
280
346
  }, props.children)), withStopPropagation(props.stopPropagation, /*#__PURE__*/React.createElement("div", {
281
- className: "".concat(classPrefix, "-actions ").concat(classPrefix, "-actions-right"),
347
+ className: getRightContainerClass(),
282
348
  ref: rightRef
283
- }, props.rightActions.map(renderAction))))));
349
+ }, props.rightActions.map(function (action) {
350
+ return renderAction(action, true);
351
+ }))))));
284
352
  });
285
353
  var colorRecord = {
286
354
  light: '#ccc',
@@ -33,3 +33,42 @@
33
33
  padding-right: 4px;
34
34
  }
35
35
  }
36
+
37
+ .pisell-custom-swipe-action-action-button {
38
+ min-width: 80px;
39
+ }
40
+
41
+ /* 容器样式 */
42
+ .pisell-custom-swipe-action-height-large {
43
+ display: flex;
44
+ flex-direction: column;
45
+ background-color: rgba(67, 93, 147, 0.3);
46
+ justify-content: flex-start;
47
+
48
+ .pisell-number-selector-btn {
49
+ width: 40px !important;
50
+ height: 40px !important;
51
+ }
52
+ }
53
+
54
+ .pisell-custom-swipe-action-height-medium {
55
+ display: flex;
56
+ flex-direction: column;
57
+ background-color: rgba(67, 93, 147, 0.3);
58
+
59
+ .pisell-number-selector-btn {
60
+ width: 40px !important;
61
+ height: 40px !important;
62
+ }
63
+ }
64
+
65
+ /* 按钮样式 */
66
+ .pisell-custom-swipe-action-action-height-large {
67
+ height: 60px;
68
+ width: 200px;
69
+ }
70
+
71
+ .pisell-custom-swipe-action-action-height-medium {
72
+ flex: 1;
73
+ width: 200px;
74
+ }