@pisell/private-materials 6.3.33 → 6.3.34

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 (141) 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 +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +23 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +23 -8
  11. package/es/components/index.d.ts +1 -2
  12. package/es/components/index.js +1 -2
  13. package/es/components/walletList/index.d.ts +0 -25
  14. package/es/components/walletList/index.js +98 -66
  15. package/es/components/walletList/serve.d.ts +4 -0
  16. package/es/components/walletList/serve.js +46 -13
  17. package/es/components/walletList/types/index.d.ts +12 -12
  18. package/es/components/walletList/types/index.js +2 -2
  19. package/es/index.d.ts +2 -1
  20. package/es/index.js +2 -1
  21. package/es/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  22. package/es/plus/productSelect/CategoryTabs/index.js +6 -3
  23. package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  24. package/es/plus/productSelect/utils.js +0 -1
  25. package/es/plus/walletEditor/WalletEditor.d.ts +5 -0
  26. package/es/plus/walletEditor/WalletEditor.js +316 -0
  27. package/es/plus/walletEditor/WalletEditor.less +129 -0
  28. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  29. package/es/plus/walletEditor/components/ImageUpload/index.js +223 -0
  30. package/es/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  31. package/es/plus/walletEditor/components/JsonEditor/index.js +68 -0
  32. package/es/plus/walletEditor/components/JsonEditor/index.less +4 -0
  33. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  34. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.js +222 -0
  35. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  36. package/es/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  37. package/es/plus/walletEditor/components/relationProduct/index.js +49 -0
  38. package/es/plus/walletEditor/components/relationProduct/index.less +15 -0
  39. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  40. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.js +193 -0
  41. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  42. package/es/plus/walletEditor/index.d.ts +3 -0
  43. package/es/plus/walletEditor/index.js +3 -0
  44. package/es/plus/walletEditor/locales.d.ts +126 -0
  45. package/es/plus/walletEditor/locales.js +143 -0
  46. package/es/plus/walletEditor/types.d.ts +52 -0
  47. package/es/plus/walletEditor/types.js +1 -0
  48. package/es/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  49. package/es/plus/walletPassGallery/components/footerButton/index.js +247 -0
  50. package/es/plus/walletPassGallery/components/footerButton/index.less +93 -0
  51. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  52. package/es/plus/walletPassGallery/components/passDetail/index.js +274 -0
  53. package/es/plus/walletPassGallery/components/passDetail/index.less +57 -0
  54. package/es/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  55. package/es/plus/walletPassGallery/components/passList/index.js +115 -0
  56. package/es/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  57. package/es/plus/walletPassGallery/components/recharge/index.js +134 -0
  58. package/es/plus/walletPassGallery/components/recharge/index.less +16 -0
  59. package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  60. package/es/plus/walletPassGallery/components/timelineSection/index.js +176 -0
  61. package/es/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  62. package/es/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  63. package/es/plus/walletPassGallery/components/usageRule/index.js +248 -0
  64. package/es/plus/walletPassGallery/components/usageRule/index.less +157 -0
  65. package/es/plus/walletPassGallery/index.d.ts +6 -0
  66. package/es/plus/walletPassGallery/index.js +602 -0
  67. package/es/plus/walletPassGallery/index.less +115 -0
  68. package/es/plus/walletPassGallery/locales.d.ts +270 -0
  69. package/es/plus/walletPassGallery/locales.js +279 -0
  70. package/es/plus/walletPassGallery/serve.d.ts +218 -0
  71. package/es/plus/walletPassGallery/serve.js +289 -0
  72. package/es/pro/Login2.0/Login2.js +4 -0
  73. package/es/pro/Login2.0/locales.js +93 -93
  74. package/lib/components/index.d.ts +1 -2
  75. package/lib/components/index.js +0 -3
  76. package/lib/components/walletList/index.d.ts +0 -25
  77. package/lib/components/walletList/index.js +90 -51
  78. package/lib/components/walletList/serve.d.ts +4 -0
  79. package/lib/components/walletList/serve.js +12 -0
  80. package/lib/components/walletList/types/index.d.ts +12 -12
  81. package/lib/index.d.ts +2 -1
  82. package/lib/index.js +6 -3
  83. package/lib/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  84. package/lib/plus/productSelect/CategoryTabs/index.js +84 -69
  85. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  86. package/lib/plus/productSelect/utils.js +0 -1
  87. package/lib/plus/walletEditor/WalletEditor.d.ts +5 -0
  88. package/lib/plus/walletEditor/WalletEditor.js +354 -0
  89. package/lib/plus/walletEditor/WalletEditor.less +129 -0
  90. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  91. package/lib/plus/walletEditor/components/ImageUpload/index.js +201 -0
  92. package/lib/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  93. package/lib/plus/walletEditor/components/JsonEditor/index.js +89 -0
  94. package/lib/plus/walletEditor/components/JsonEditor/index.less +4 -0
  95. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  96. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.js +176 -0
  97. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  98. package/lib/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  99. package/lib/plus/walletEditor/components/relationProduct/index.js +73 -0
  100. package/lib/plus/walletEditor/components/relationProduct/index.less +15 -0
  101. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  102. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.js +211 -0
  103. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  104. package/lib/plus/walletEditor/index.d.ts +3 -0
  105. package/lib/plus/walletEditor/index.js +42 -0
  106. package/lib/plus/walletEditor/locales.d.ts +126 -0
  107. package/lib/plus/walletEditor/locales.js +167 -0
  108. package/lib/plus/walletEditor/types.d.ts +52 -0
  109. package/lib/plus/walletEditor/types.js +17 -0
  110. package/lib/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  111. package/lib/plus/walletPassGallery/components/footerButton/index.js +187 -0
  112. package/lib/plus/walletPassGallery/components/footerButton/index.less +93 -0
  113. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  114. package/lib/plus/walletPassGallery/components/passDetail/index.js +287 -0
  115. package/lib/plus/walletPassGallery/components/passDetail/index.less +57 -0
  116. package/lib/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  117. package/lib/plus/walletPassGallery/components/passList/index.js +136 -0
  118. package/lib/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  119. package/lib/plus/walletPassGallery/components/recharge/index.js +146 -0
  120. package/lib/plus/walletPassGallery/components/recharge/index.less +16 -0
  121. package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  122. package/lib/plus/walletPassGallery/components/timelineSection/index.js +212 -0
  123. package/lib/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  124. package/lib/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  125. package/lib/plus/walletPassGallery/components/usageRule/index.js +209 -0
  126. package/lib/plus/walletPassGallery/components/usageRule/index.less +157 -0
  127. package/lib/plus/walletPassGallery/index.d.ts +6 -0
  128. package/lib/plus/walletPassGallery/index.js +498 -0
  129. package/lib/plus/walletPassGallery/index.less +115 -0
  130. package/lib/plus/walletPassGallery/locales.d.ts +270 -0
  131. package/lib/plus/walletPassGallery/locales.js +299 -0
  132. package/lib/plus/walletPassGallery/serve.d.ts +218 -0
  133. package/lib/plus/walletPassGallery/serve.js +98 -0
  134. package/lib/pro/Login2.0/Login2.js +3 -0
  135. package/lib/pro/Login2.0/locales.js +93 -93
  136. package/lowcode/sortable-wallet-pass-types/meta.ts +267 -0
  137. package/lowcode/wallet-editor/meta.ts +57 -0
  138. package/lowcode/wallet-editor/snippets.ts +13 -0
  139. package/lowcode/wallet-pass-gallery/meta.ts +35 -0
  140. package/package.json +4 -4
  141. package/lowcode/wallet/meta.ts +0 -79
@@ -0,0 +1,129 @@
1
+ .wallet-editor {
2
+ .ant-form {
3
+ .ant-form-item {
4
+ margin-bottom: 24px;
5
+ }
6
+
7
+ .ant-form-item-label {
8
+ > label {
9
+ font-weight: 500;
10
+ color: #262626;
11
+ }
12
+ }
13
+ }
14
+
15
+ .display-settings {
16
+ border: 1px solid #d9d9d9;
17
+ border-radius: 6px;
18
+ padding: 16px;
19
+ margin-bottom: 24px;
20
+
21
+ &-header {
22
+ display: flex;
23
+ justify-content: space-between;
24
+ align-items: center;
25
+ margin-bottom: 16px;
26
+ font-weight: 500;
27
+ color: #262626;
28
+ }
29
+
30
+ &-items {
31
+ .display-item {
32
+ display: flex;
33
+ justify-content: space-between;
34
+ align-items: center;
35
+ padding: 8px 0;
36
+ border-bottom: 1px solid #f0f0f0;
37
+
38
+ &:last-child {
39
+ border-bottom: none;
40
+ }
41
+
42
+ .display-toggle {
43
+ cursor: pointer;
44
+ color: #1890ff;
45
+ font-size: 16px;
46
+
47
+ &:hover {
48
+ color: #40a9ff;
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ .upload-area {
56
+ border: 2px dashed #d9d9d9;
57
+ border-radius: 6px;
58
+ padding: 32px;
59
+ text-align: center;
60
+ background-color: #fafafa;
61
+ cursor: pointer;
62
+ transition: border-color 0.3s;
63
+
64
+ &:hover {
65
+ border-color: #1890ff;
66
+ }
67
+
68
+ .upload-placeholder {
69
+ color: #999;
70
+ font-size: 14px;
71
+ line-height: 1.4;
72
+ }
73
+ }
74
+
75
+ .ant-select {
76
+ width: 100%;
77
+ }
78
+
79
+ .ant-radio-group {
80
+ display: flex;
81
+ gap: 16px;
82
+ }
83
+
84
+ .ant-input,
85
+ .ant-select-selector,
86
+ .ant-picker {
87
+ border-radius: 6px;
88
+ }
89
+
90
+ .ant-form-item-required {
91
+ &::before {
92
+ color: #ff4d4f !important;
93
+ }
94
+ }
95
+ }
96
+
97
+ // 响应式设计
98
+ @media (max-width: 768px) {
99
+ .wallet-editor {
100
+ .display-settings {
101
+ padding: 12px;
102
+ }
103
+
104
+ .upload-area {
105
+ padding: 24px;
106
+ }
107
+
108
+ .ant-radio-group {
109
+ flex-direction: column;
110
+ gap: 8px;
111
+ }
112
+ }
113
+ }
114
+
115
+ .pisell-wallet-editor_preview-modal {
116
+
117
+ .pisell-lowcode-modal-content {
118
+ background-color: transparent !important;
119
+ box-shadow: none !important;
120
+ }
121
+
122
+ .pisell-lowcode-modal-body {
123
+ padding: 0 !important;
124
+ }
125
+
126
+ .pisell-lowcode-modal-close {
127
+ display: none;
128
+ }
129
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface ImageUploadProps {
3
+ value?: string;
4
+ onChange?: (val: string) => void;
5
+ }
6
+ export declare const getBaseTime: (size: number) => 1000 | 2000 | 4000 | 8000;
7
+ declare const ImageUpload: React.FC<ImageUploadProps>;
8
+ export default ImageUpload;
@@ -0,0 +1,201 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/walletEditor/components/ImageUpload/index.tsx
30
+ var ImageUpload_exports = {};
31
+ __export(ImageUpload_exports, {
32
+ default: () => ImageUpload_default,
33
+ getBaseTime: () => getBaseTime
34
+ });
35
+ module.exports = __toCommonJS(ImageUpload_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_antd = require("antd");
38
+ var import_icons = require("@ant-design/icons");
39
+ var import_materials = require("@pisell/materials");
40
+ var import_utils = require("@pisell/utils");
41
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
42
+ var import_shopUploadServe = require("@pisell/materials/src/components/dataSourceComponents/fields/Upload/shopUploadServe");
43
+ var import_utils2 = require("@pisell/materials/src/components/table/utils");
44
+ var getBaseTime = (size) => {
45
+ const KB = 1024;
46
+ const MB = KB * 1024;
47
+ if (size < MB) return 1e3;
48
+ if (size < 5 * MB) return 2e3;
49
+ if (size < 20 * MB) return 4e3;
50
+ return 8e3;
51
+ };
52
+ var ImageUpload = ({ value, onChange }) => {
53
+ var _a, _b;
54
+ const context = (0, import_useEngineContext.default)();
55
+ import_utils2.request.setRequest((_b = (_a = context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.request);
56
+ const [uploading, setUploading] = (0, import_react.useState)(false);
57
+ const [fileList, setFileList] = (0, import_react.useState)([]);
58
+ const [previewImage, setPreviewImage] = (0, import_react.useState)("");
59
+ const [previewOpen, setPreviewOpen] = (0, import_react.useState)(false);
60
+ (0, import_react.useEffect)(() => {
61
+ if (value) {
62
+ setFileList([
63
+ {
64
+ uid: "image-0",
65
+ name: "image",
66
+ status: "done",
67
+ url: value
68
+ }
69
+ ]);
70
+ } else {
71
+ setFileList([]);
72
+ }
73
+ }, [value]);
74
+ const beforeUpload = async (file) => {
75
+ if (!file.type.startsWith("image/")) {
76
+ return import_antd.Upload.LIST_IGNORE;
77
+ }
78
+ return file;
79
+ };
80
+ const handleUpload = (options) => {
81
+ const { onSuccess, onError, onProgress, file } = options;
82
+ const fileSize = file.size;
83
+ const baseTime = getBaseTime(fileSize);
84
+ let progress = 0;
85
+ setTimeout(() => {
86
+ onProgress == null ? void 0 : onProgress({ percent: 1 });
87
+ }, 200);
88
+ const timer = setInterval(() => {
89
+ if (progress < 30) {
90
+ progress += 5;
91
+ } else if (progress < 60) {
92
+ progress += 3;
93
+ } else if (progress < 80) {
94
+ progress += 2;
95
+ } else if (progress < 90) {
96
+ progress += 0.5;
97
+ }
98
+ if (progress >= 90) {
99
+ clearInterval(timer);
100
+ }
101
+ onProgress == null ? void 0 : onProgress({ percent: Math.min(90, progress) });
102
+ }, baseTime / 30);
103
+ (0, import_shopUploadServe.uploadFile)(file).then((res) => {
104
+ clearInterval(timer);
105
+ onProgress == null ? void 0 : onProgress({ percent: 95 });
106
+ setTimeout(() => {
107
+ onProgress == null ? void 0 : onProgress({ percent: 100 });
108
+ onSuccess == null ? void 0 : onSuccess(res);
109
+ }, 200);
110
+ }).catch((err) => {
111
+ clearInterval(timer);
112
+ onError == null ? void 0 : onError(err);
113
+ });
114
+ };
115
+ const onRemove = () => {
116
+ setFileList([]);
117
+ onChange == null ? void 0 : onChange("");
118
+ setPreviewImage("");
119
+ setPreviewOpen(false);
120
+ };
121
+ const handlePreview = (file) => {
122
+ const url = file.url || file.thumbUrl || "";
123
+ if (!url) return;
124
+ setPreviewImage(url);
125
+ setPreviewOpen(true);
126
+ };
127
+ const handleChange = (info) => {
128
+ var _a2, _b2, _c, _d;
129
+ const { file, fileList: newFileList } = info;
130
+ const updated = newFileList.map((item) => {
131
+ var _a3;
132
+ return {
133
+ ...item,
134
+ status: item.status === "done" && item.response && !((_a3 = item.response) == null ? void 0 : _a3.status) ? "error" : item.status
135
+ };
136
+ });
137
+ setFileList(updated);
138
+ if (file.status === "uploading") {
139
+ setUploading(true);
140
+ }
141
+ if (file.status === "done" && (((_a2 = file.response) == null ? void 0 : _a2.status) ?? true)) {
142
+ setUploading(false);
143
+ const url = ((_c = (_b2 = file.response) == null ? void 0 : _b2.data) == null ? void 0 : _c.url) || file.url || "";
144
+ onChange == null ? void 0 : onChange(url);
145
+ }
146
+ if (file.status === "error" || file.response && ((_d = file.response) == null ? void 0 : _d.status) === false) {
147
+ setUploading(false);
148
+ }
149
+ };
150
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
151
+ import_materials.PisellUpload,
152
+ {
153
+ uploadType: "custom",
154
+ listType: "picture-card",
155
+ multiple: false,
156
+ maxCount: 1,
157
+ accept: "image/*",
158
+ beforeUpload,
159
+ onChange: handleChange,
160
+ showUploadList: {
161
+ showRemoveIcon: true,
162
+ showPreviewIcon: true,
163
+ showDownloadIcon: false
164
+ },
165
+ fileList,
166
+ onRemove,
167
+ onPreview: handlePreview,
168
+ customRequest: handleUpload
169
+ },
170
+ fileList.length >= 1 || uploading ? null : /* @__PURE__ */ import_react.default.createElement(
171
+ "button",
172
+ {
173
+ style: {
174
+ color: "inherit",
175
+ cursor: "inherit",
176
+ border: 0,
177
+ background: "none"
178
+ },
179
+ type: "button"
180
+ },
181
+ /* @__PURE__ */ import_react.default.createElement(import_icons.PlusOutlined, null),
182
+ /* @__PURE__ */ import_react.default.createElement("div", { style: { marginTop: 8 } }, import_utils.locales.getText("upload"))
183
+ )
184
+ ), previewImage && /* @__PURE__ */ import_react.default.createElement(
185
+ import_antd.Image,
186
+ {
187
+ wrapperStyle: { display: "none" },
188
+ preview: {
189
+ visible: previewOpen,
190
+ onVisibleChange: (visible) => setPreviewOpen(visible),
191
+ afterOpenChange: (visible) => !visible && setPreviewImage("")
192
+ },
193
+ src: previewImage
194
+ }
195
+ ));
196
+ };
197
+ var ImageUpload_default = ImageUpload;
198
+ // Annotate the CommonJS export names for ESM import in node:
199
+ 0 && (module.exports = {
200
+ getBaseTime
201
+ });
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface JsonEditorProps {
3
+ value?: any;
4
+ onChange?: (value: any) => void;
5
+ disabled?: boolean;
6
+ placeholder?: string;
7
+ rows?: number;
8
+ style?: React.CSSProperties;
9
+ }
10
+ declare const JsonEditor: React.FC<JsonEditorProps>;
11
+ export default JsonEditor;
@@ -0,0 +1,89 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/walletEditor/components/JsonEditor/index.tsx
30
+ var JsonEditor_exports = {};
31
+ __export(JsonEditor_exports, {
32
+ default: () => JsonEditor_default
33
+ });
34
+ module.exports = __toCommonJS(JsonEditor_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var JsonEditor = ({
38
+ value,
39
+ onChange,
40
+ disabled = false,
41
+ rows = 4,
42
+ style
43
+ }) => {
44
+ const [textValue, setTextValue] = (0, import_react.useState)("");
45
+ const [hasError, setHasError] = (0, import_react.useState)(false);
46
+ (0, import_react.useEffect)(() => {
47
+ if (value !== void 0) {
48
+ try {
49
+ setTextValue(JSON.stringify(value, null, 2));
50
+ setHasError(false);
51
+ } catch {
52
+ setTextValue("");
53
+ setHasError(false);
54
+ }
55
+ } else {
56
+ setTextValue("");
57
+ setHasError(false);
58
+ }
59
+ }, [value]);
60
+ const handleTextChange = (e) => {
61
+ const newText = e.target.value;
62
+ setTextValue(newText);
63
+ if (!newText.trim()) {
64
+ setHasError(false);
65
+ onChange == null ? void 0 : onChange(void 0);
66
+ return;
67
+ }
68
+ try {
69
+ const parsedValue = JSON.parse(newText);
70
+ setHasError(false);
71
+ onChange == null ? void 0 : onChange(parsedValue);
72
+ } catch {
73
+ setHasError(true);
74
+ }
75
+ };
76
+ return /* @__PURE__ */ import_react.default.createElement(
77
+ import_antd.Input.TextArea,
78
+ {
79
+ style,
80
+ value: textValue,
81
+ onChange: handleTextChange,
82
+ rows,
83
+ disabled,
84
+ status: hasError ? "error" : void 0,
85
+ allowClear: true
86
+ }
87
+ );
88
+ };
89
+ var JsonEditor_default = JsonEditor;
@@ -0,0 +1,4 @@
1
+ // JsonEditor组件样式
2
+ .json-editor {
3
+ // 可以在这里添加特定的样式
4
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export declare type ValidityPeriodValue = {
3
+ type: 'normal';
4
+ unit: string;
5
+ unit_type: 'day' | 'month' | 'year';
6
+ } | {
7
+ type: 'custom';
8
+ custom_date?: string;
9
+ } | {
10
+ type: 'forever';
11
+ };
12
+ export interface ValidityPeriodSelectorProps {
13
+ value?: ValidityPeriodValue;
14
+ onChange?: (value: ValidityPeriodValue) => void;
15
+ disabled?: boolean;
16
+ placeholder?: string;
17
+ options?: readonly ValidityPeriodValue[];
18
+ }
19
+ declare const ValidityPeriodSelector: React.FC<ValidityPeriodSelectorProps>;
20
+ export default ValidityPeriodSelector;
@@ -0,0 +1,176 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/walletEditor/components/ValidityPeriodSelector/index.tsx
30
+ var ValidityPeriodSelector_exports = {};
31
+ __export(ValidityPeriodSelector_exports, {
32
+ default: () => ValidityPeriodSelector_default
33
+ });
34
+ module.exports = __toCommonJS(ValidityPeriodSelector_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_dayjs = __toESM(require("dayjs"));
38
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
39
+ var import_locales = __toESM(require("../../locales"));
40
+ var import_utils = require("@pisell/utils");
41
+ var { Option } = import_antd.Select;
42
+ var DEFAULT_VALIDITY_OPTIONS = [
43
+ { unit: "1", unit_type: "day", type: "normal" },
44
+ { unit: "14", unit_type: "day", type: "normal" },
45
+ { unit: "1", unit_type: "month", type: "normal" },
46
+ { unit: "2", unit_type: "month", type: "normal" },
47
+ { unit: "3", unit_type: "month", type: "normal" },
48
+ { unit: "4", unit_type: "month", type: "normal" },
49
+ { unit: "5", unit_type: "month", type: "normal" },
50
+ { unit: "6", unit_type: "month", type: "normal" },
51
+ { unit: "1", unit_type: "year", type: "normal" },
52
+ { unit: "3", unit_type: "year", type: "normal" },
53
+ { type: "forever" },
54
+ { custom_date: "", type: "custom" }
55
+ ];
56
+ var getOptionLabel = (option) => {
57
+ if (option.type === "forever") {
58
+ return import_utils.locales.getText("forever");
59
+ }
60
+ if (option.type === "custom") {
61
+ return import_utils.locales.getText("custom");
62
+ }
63
+ const unitMap = {
64
+ day: import_utils.locales.getText("day"),
65
+ month: import_utils.locales.getText("month"),
66
+ year: import_utils.locales.getText("year"),
67
+ days: import_utils.locales.getText("days"),
68
+ months: import_utils.locales.getText("months"),
69
+ years: import_utils.locales.getText("years")
70
+ };
71
+ const { unit, unit_type } = option;
72
+ if (Number(unit) > 1) {
73
+ return `${unit} ${unitMap[unit_type + "s"]}`;
74
+ }
75
+ return `${unit} ${unitMap[unit_type]}`;
76
+ };
77
+ var transformValueToString = (option) => {
78
+ if (option.type === "forever") {
79
+ return "forever";
80
+ }
81
+ if (option.type === "custom") {
82
+ return "custom";
83
+ }
84
+ return `${option.unit}${option.unit_type}`;
85
+ };
86
+ var transformStringToValue = (stringValue) => {
87
+ if (stringValue === "forever") {
88
+ return { type: "forever" };
89
+ }
90
+ if (stringValue === "custom") {
91
+ return { type: "custom", custom_date: "" };
92
+ }
93
+ const match = stringValue.match(/^(\d+)(day|month|year)$/);
94
+ if (match) {
95
+ const [, unit, unit_type] = match;
96
+ return {
97
+ type: "normal",
98
+ unit,
99
+ unit_type
100
+ };
101
+ }
102
+ return { type: "normal", unit: "1", unit_type: "day" };
103
+ };
104
+ var ValidityPeriodSelector = ({
105
+ value,
106
+ onChange,
107
+ disabled = false,
108
+ placeholder,
109
+ options = DEFAULT_VALIDITY_OPTIONS
110
+ }) => {
111
+ var _a, _b;
112
+ const context = (0, import_useEngineContext.default)();
113
+ import_utils.locales.init(
114
+ import_locales.default,
115
+ ((_b = (_a = context.appHelper.utils) == null ? void 0 : _a.storage) == null ? void 0 : _b.get("umi_locale")) || "en"
116
+ );
117
+ const defaultPlaceholder = placeholder || import_utils.locales.getText("selectValidityPeriod");
118
+ const [showCustomDate, setShowCustomDate] = (0, import_react.useState)(false);
119
+ const [currentValue, setCurrentValue] = (0, import_react.useState)(value);
120
+ const validityOptions = (0, import_react.useMemo)(() => {
121
+ return options.map((option) => ({
122
+ label: getOptionLabel(option),
123
+ value: transformValueToString(option)
124
+ }));
125
+ }, [options]);
126
+ (0, import_react.useEffect)(() => {
127
+ setCurrentValue(value);
128
+ setShowCustomDate((value == null ? void 0 : value.type) === "custom");
129
+ }, [value]);
130
+ const handleSelectChange = (selectedValue) => {
131
+ const parsedValue = transformStringToValue(selectedValue);
132
+ setCurrentValue(parsedValue);
133
+ setShowCustomDate(parsedValue.type === "custom");
134
+ if (parsedValue.type !== "custom") {
135
+ onChange == null ? void 0 : onChange(parsedValue);
136
+ }
137
+ };
138
+ const handleDateChange = (date, dateString) => {
139
+ if (date && (currentValue == null ? void 0 : currentValue.type) === "custom") {
140
+ const newValue = {
141
+ type: "custom",
142
+ custom_date: date.format("YYYY-MM-DD")
143
+ };
144
+ setCurrentValue(newValue);
145
+ onChange == null ? void 0 : onChange(newValue);
146
+ }
147
+ };
148
+ const getSelectValue = () => {
149
+ if (!currentValue) return void 0;
150
+ return transformValueToString(currentValue);
151
+ };
152
+ const renderOptions = () => {
153
+ return validityOptions.map((option) => /* @__PURE__ */ import_react.default.createElement(Option, { key: option.label, value: option.value }, option.label));
154
+ };
155
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
156
+ import_antd.Select,
157
+ {
158
+ placeholder: defaultPlaceholder,
159
+ onChange: handleSelectChange,
160
+ value: getSelectValue(),
161
+ disabled,
162
+ style: { width: "100%" }
163
+ },
164
+ renderOptions()
165
+ ), showCustomDate && /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: import_utils.locales.getText("custom"), style: { marginBottom: 0 } }, /* @__PURE__ */ import_react.default.createElement(
166
+ import_antd.DatePicker,
167
+ {
168
+ placeholder: import_utils.locales.getText("selectCustomDate"),
169
+ onChange: handleDateChange,
170
+ value: (currentValue == null ? void 0 : currentValue.type) === "custom" && currentValue.custom_date ? (0, import_dayjs.default)(currentValue.custom_date) : void 0,
171
+ disabled,
172
+ style: { width: "100%" }
173
+ }
174
+ )));
175
+ };
176
+ var ValidityPeriodSelector_default = ValidityPeriodSelector;
@@ -0,0 +1,4 @@
1
+ // ValidityPeriodSelector组件样式
2
+ .validity-period-selector {
3
+ // 可以在这里添加特定的样式
4
+ }
@@ -0,0 +1,6 @@
1
+ import './index.less';
2
+ declare const RelationProduct: ({ value, onChange, }: {
3
+ value?: string[] | undefined;
4
+ onChange?: ((val: string[]) => void) | undefined;
5
+ }) => JSX.Element | null;
6
+ export default RelationProduct;