@pisell/materials 1.0.498 → 1.0.499

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 (123) 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 +22 -22
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +21 -21
  11. package/es/components/dataSourceComponents/dataSourceForm/style.less +9 -0
  12. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
  13. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +13 -10
  14. package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
  15. package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
  16. package/es/components/dataSourceComponents/dataSourceForm/utils.js +14 -5
  17. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +7 -3
  18. package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +1 -1
  19. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
  20. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +11 -2
  21. package/es/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +3 -2
  22. package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +6 -2
  23. package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
  24. package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +6 -2
  25. package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
  26. package/es/components/dataSourceComponents/fields/Input/ReadPretty.js +7 -2
  27. package/es/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
  28. package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +7 -2
  29. package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
  30. package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +11 -5
  31. package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
  32. package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
  33. package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
  34. package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
  35. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
  36. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +1 -1
  37. package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +7 -2
  38. package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
  39. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +8 -3
  40. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
  41. package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
  42. package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
  43. package/es/components/dataSourceComponents/fields/Radio/ReadPretty.js +3 -2
  44. package/es/components/dataSourceComponents/fields/Select/ReadPretty.js +3 -2
  45. package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +6 -2
  46. package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
  47. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
  48. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +291 -252
  49. package/es/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
  50. package/es/components/dataSourceComponents/fields/Upload/constants.js +9 -0
  51. package/es/components/dataSourceComponents/fields/Upload/index.less +49 -0
  52. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
  53. package/es/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
  54. package/es/components/dataSourceComponents/fields/Upload/types.js +1 -0
  55. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
  56. package/es/components/dataSourceComponents/fields/Upload/utils.js +237 -215
  57. package/es/components/dataSourceComponents/fields/index.d.ts +2 -1
  58. package/es/components/dataSourceComponents/fields/index.js +1 -0
  59. package/es/locales/en-US.d.ts +5 -0
  60. package/es/locales/en-US.js +5 -0
  61. package/es/locales/zh-CN.d.ts +5 -0
  62. package/es/locales/zh-CN.js +5 -0
  63. package/es/locales/zh-TW.d.ts +5 -0
  64. package/es/locales/zh-TW.js +5 -0
  65. package/lib/components/dataSourceComponents/dataSourceForm/style.less +9 -0
  66. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
  67. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +6 -3
  68. package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
  69. package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
  70. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +9 -5
  71. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +4 -1
  72. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +1 -1
  73. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
  74. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +10 -1
  75. package/lib/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +2 -2
  76. package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +11 -2
  77. package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
  78. package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +11 -2
  79. package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
  80. package/lib/components/dataSourceComponents/fields/Input/ReadPretty.js +11 -1
  81. package/lib/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
  82. package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +11 -1
  83. package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
  84. package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +9 -4
  85. package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
  86. package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
  87. package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
  88. package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
  89. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
  90. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +4 -4
  91. package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +11 -1
  92. package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
  93. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +12 -1
  94. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
  95. package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
  96. package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
  97. package/lib/components/dataSourceComponents/fields/Radio/ReadPretty.js +2 -2
  98. package/lib/components/dataSourceComponents/fields/Select/ReadPretty.js +2 -2
  99. package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +11 -2
  100. package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
  101. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
  102. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +319 -247
  103. package/lib/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
  104. package/lib/components/dataSourceComponents/fields/Upload/constants.js +47 -0
  105. package/lib/components/dataSourceComponents/fields/Upload/index.less +49 -0
  106. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
  107. package/lib/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
  108. package/lib/components/dataSourceComponents/fields/Upload/types.js +17 -0
  109. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
  110. package/lib/components/dataSourceComponents/fields/Upload/utils.js +205 -254
  111. package/lib/components/dataSourceComponents/fields/index.d.ts +2 -1
  112. package/lib/components/dataSourceComponents/fields/index.js +1 -0
  113. package/lib/locales/en-US.d.ts +5 -0
  114. package/lib/locales/en-US.js +5 -0
  115. package/lib/locales/zh-CN.d.ts +5 -0
  116. package/lib/locales/zh-CN.js +5 -0
  117. package/lib/locales/zh-TW.d.ts +5 -0
  118. package/lib/locales/zh-TW.js +5 -0
  119. package/lowcode/data-source-form/utils.ts +5 -4
  120. package/lowcode/data-source-table/utils.tsx +2 -2
  121. package/lowcode/form-item-upload/meta.ts +11 -0
  122. package/lowcode/submit-button/meta.ts +10 -0
  123. package/package.json +1 -1
@@ -16,256 +16,35 @@ var __copyProps = (to, from, except, desc) => {
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
- // src/components/dataSourceComponents/fields/Upload/utils.ts
19
+ // src/components/dataSourceComponents/fields/Upload/utils.tsx
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
22
  checkFileCount: () => checkFileCount,
23
+ createMultilingualData: () => createMultilingualData,
24
+ createMultilingualFileList: () => createMultilingualFileList,
25
+ genFileListByString: () => genFileListByString,
26
+ generateUid: () => generateUid,
27
+ getDefaultFileList: () => getDefaultFileList,
28
+ getFileMetadataParams: () => getFileMetadataParams,
29
+ getFileName: () => getFileName,
23
30
  getFileType: () => getFileType,
31
+ getMediaMetadata: () => getMediaMetadata,
24
32
  getPointSuffix: () => getPointSuffix,
25
- getPresetTypes: () => getPresetTypes,
26
33
  getSuffix: () => getSuffix
27
34
  });
28
35
  module.exports = __toCommonJS(utils_exports);
36
+ var import_utils = require("@pisell/utils");
29
37
  var import_locales = require("../../../../locales");
30
- var getSuffix = (name) => {
31
- return name.split(".").pop() || "";
38
+ var import_constants = require("./constants");
39
+ var generateUid = () => {
40
+ return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
32
41
  };
33
- var getPointSuffix = (name) => {
34
- return `.${getSuffix(name)}`;
35
- };
36
- var getFileType = (name) => {
37
- return getPointSuffix(getSuffix(name));
38
- };
39
- var presetTypeData = [
40
- {
41
- title: "文档",
42
- key: "documents",
43
- children: [
44
- {
45
- key: "pdf",
46
- title: "PDF",
47
- types: [".pdf"],
48
- color: "red"
49
- },
50
- {
51
- key: "word",
52
- title: "Word文档",
53
- types: [".doc", ".docx"],
54
- color: "blueDark"
55
- },
56
- {
57
- key: "excel",
58
- title: "Excel工作簿",
59
- types: [".xls", ".xlsx"],
60
- color: "green600"
61
- },
62
- {
63
- key: "powerPoint",
64
- title: "PowerPoint演示文稿",
65
- types: [".ppt", ".pptx"],
66
- color: "orangeDark"
67
- },
68
- {
69
- key: "textFile",
70
- title: "文本文件",
71
- types: [".txt"],
72
- color: "gray700"
73
- },
74
- {
75
- key: "richFile",
76
- title: "富文本格式",
77
- types: [".rtf"],
78
- color: "gray500"
79
- },
80
- {
81
- key: "csv",
82
- title: "CSV",
83
- types: [".csv"],
84
- color: "green600"
85
- }
86
- ]
87
- },
88
- {
89
- title: "图片",
90
- key: "images",
91
- children: [
92
- {
93
- key: "jpg",
94
- title: "JPG",
95
- types: [".jpg", ".jpeg"],
96
- color: "img"
97
- },
98
- {
99
- key: "png",
100
- title: "PNG",
101
- types: [".png"],
102
- color: "img"
103
- },
104
- {
105
- key: "gif",
106
- title: "GIF",
107
- types: [".gif"],
108
- color: "img"
109
- },
110
- {
111
- key: "bmp",
112
- title: "BMP",
113
- types: [".bmp"],
114
- color: "img"
115
- },
116
- {
117
- key: "tiff",
118
- title: "TIFF",
119
- types: ["tif", ".tiff"],
120
- color: "img"
121
- },
122
- {
123
- key: "svg",
124
- title: "SVG",
125
- types: [".svg"],
126
- color: "img"
127
- },
128
- {
129
- key: "webp",
130
- title: "WEBP",
131
- types: [".webp"],
132
- color: "img"
133
- }
134
- ]
135
- },
136
- {
137
- title: "音频",
138
- key: "audio",
139
- children: [
140
- {
141
- key: "mp3",
142
- title: "MP3",
143
- types: [".mp3"],
144
- color: "pink600"
145
- },
146
- {
147
- key: "wav",
148
- title: "WAV",
149
- types: [".wav"],
150
- color: "pink600"
151
- },
152
- {
153
- key: "flac",
154
- title: "FLAC",
155
- color: "pink600",
156
- types: [".flac"]
157
- },
158
- {
159
- key: "aac",
160
- title: "AAC",
161
- color: "pink600",
162
- types: [".aac", ".m4a"]
163
- },
164
- {
165
- key: "ogg",
166
- title: "OGG",
167
- types: [".ogg"],
168
- color: "pink600"
169
- }
170
- ]
171
- },
172
- {
173
- title: "视频",
174
- key: "video",
175
- children: [
176
- {
177
- key: "mp4",
178
- title: "MP4",
179
- types: [".mp4"],
180
- color: "blueDark"
181
- },
182
- {
183
- key: "avi",
184
- title: "AVI",
185
- types: [".avi"],
186
- color: "blueDark"
187
- },
188
- {
189
- key: "mkv",
190
- title: "MKV",
191
- types: [".mkv"],
192
- color: "blueDark"
193
- },
194
- {
195
- key: "mov",
196
- title: "MOV",
197
- types: [".mov"],
198
- color: "blueDark"
199
- },
200
- {
201
- key: "wmv",
202
- title: "WMV",
203
- types: [".wmv"],
204
- color: "blueDark"
205
- },
206
- {
207
- key: "flv",
208
- title: "FLV",
209
- types: [".flv"],
210
- color: "blueDark"
211
- }
212
- ]
213
- },
214
- {
215
- title: "压缩文件",
216
- key: "compressedFiles",
217
- children: [
218
- {
219
- key: "zip",
220
- title: "ZIP",
221
- types: [".zip"],
222
- color: "gray700"
223
- },
224
- {
225
- key: "rar",
226
- title: "RAR",
227
- types: [".rar"],
228
- color: "gray700"
229
- },
230
- {
231
- key: "7z",
232
- title: "7Z",
233
- types: [".7z"],
234
- color: "gray700"
235
- },
236
- {
237
- key: "tar",
238
- title: "TAR",
239
- types: [".tar"],
240
- color: "gray700"
241
- },
242
- {
243
- key: "gz",
244
- title: "GZ",
245
- types: [".gz"],
246
- color: "gray700"
247
- }
248
- ]
249
- }
250
- ];
251
- var allChildren = presetTypeData.map((item) => item.children).flat(1);
252
- var presetTypeMap = allChildren.reduce(
253
- (pre, cur) => {
254
- return {
255
- ...pre,
256
- [cur.key]: cur.types
257
- };
258
- },
259
- {}
260
- );
261
- var getPresetTypes = (presetTypes) => {
262
- if (!presetTypes)
263
- return [];
264
- const types = [];
265
- presetTypes.forEach((item) => {
266
- types.push(...presetTypeMap[item] || []);
267
- });
268
- return types;
42
+ var getSuffix = (name) => name.split(".").pop() || "";
43
+ var getPointSuffix = (name) => `.${getSuffix(name)}`;
44
+ var getFileType = (name) => getPointSuffix(getSuffix(name));
45
+ var getFileName = (url) => {
46
+ const parts = url.split("/");
47
+ return parts[parts.length - 1] || "";
269
48
  };
270
49
  var checkFileCount = ({
271
50
  multiple,
@@ -273,28 +52,200 @@ var checkFileCount = ({
273
52
  maxCount,
274
53
  valueLength
275
54
  }) => {
276
- if (multiple) {
277
- if (minCount === maxCount && valueLength !== minCount) {
278
- return {
279
- success: false,
280
- message: (0, import_locales.getText)("pisell-upload-count-error")(minCount)
281
- };
282
- } else if (minCount !== maxCount && (valueLength < minCount || valueLength > maxCount)) {
283
- return {
284
- success: false,
285
- message: (0, import_locales.getText)("pisell-upload-count-error")(`${minCount}-${maxCount}`)
286
- };
287
- }
55
+ if (!multiple)
56
+ return { success: true };
57
+ if (minCount === maxCount && valueLength !== minCount) {
58
+ return {
59
+ success: false,
60
+ message: (0, import_locales.getText)("pisell-upload-count-error")(minCount)
61
+ };
288
62
  }
63
+ if (minCount !== maxCount && (valueLength < minCount || valueLength > maxCount)) {
64
+ return {
65
+ success: false,
66
+ message: (0, import_locales.getText)("pisell-upload-count-error")(`${minCount}-${maxCount}`)
67
+ };
68
+ }
69
+ return { success: true };
70
+ };
71
+ var createVideoMetadata = async (file) => {
72
+ return new Promise((resolve) => {
73
+ const video = document.createElement("video");
74
+ const canvas = document.createElement("canvas");
75
+ video.preload = "metadata";
76
+ let hasMetadata = false;
77
+ let hasSeeked = false;
78
+ const tryResolve = () => {
79
+ if (!hasMetadata || !hasSeeked)
80
+ return;
81
+ canvas.width = video.videoWidth;
82
+ canvas.height = video.videoHeight;
83
+ const ctx = canvas.getContext("2d");
84
+ ctx == null ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
85
+ canvas.toBlob(
86
+ (blob) => {
87
+ const metadata = {
88
+ width: video.videoWidth,
89
+ height: video.videoHeight,
90
+ duration: video.duration,
91
+ bitrate: file.size / video.duration
92
+ };
93
+ if (blob) {
94
+ metadata.cover = new File([blob], `${file.name}-cover.jpg`, {
95
+ type: import_constants.IMAGE_TYPE
96
+ });
97
+ }
98
+ URL.revokeObjectURL(video.src);
99
+ resolve(metadata);
100
+ },
101
+ import_constants.IMAGE_TYPE,
102
+ import_constants.IMAGE_QUALITY
103
+ );
104
+ };
105
+ video.onloadedmetadata = () => {
106
+ hasMetadata = true;
107
+ tryResolve();
108
+ };
109
+ video.onseeked = () => {
110
+ hasSeeked = true;
111
+ tryResolve();
112
+ };
113
+ video.src = URL.createObjectURL(file);
114
+ });
115
+ };
116
+ var createAudioMetadata = async (file) => {
117
+ return new Promise((resolve) => {
118
+ const audio = document.createElement("audio");
119
+ audio.preload = "metadata";
120
+ audio.src = URL.createObjectURL(file);
121
+ audio.onloadedmetadata = () => {
122
+ URL.revokeObjectURL(audio.src);
123
+ resolve({
124
+ duration: audio.duration,
125
+ bitrate: file.size / audio.duration
126
+ });
127
+ };
128
+ });
129
+ };
130
+ var getMediaMetadata = async (file) => {
131
+ if (file.type.startsWith(import_constants.MEDIA_TYPES.VIDEO)) {
132
+ return createVideoMetadata(file);
133
+ }
134
+ if (file.type.startsWith(import_constants.MEDIA_TYPES.AUDIO)) {
135
+ return createAudioMetadata(file);
136
+ }
137
+ return null;
138
+ };
139
+ var genFileListByString = (value) => {
140
+ if (!value)
141
+ return [];
142
+ return [{
143
+ uid: generateUid(),
144
+ name: getFileName(value),
145
+ status: "done",
146
+ url: value
147
+ }];
148
+ };
149
+ var createMultilingualData = (value) => {
150
+ return import_constants.SUPPORTED_LANGUAGES.reduce((acc, lang) => {
151
+ acc[lang] = value;
152
+ return acc;
153
+ }, {});
154
+ };
155
+ var createMultilingualFileList = (value) => {
156
+ return import_constants.SUPPORTED_LANGUAGES.reduce((acc, lang) => {
157
+ acc[lang] = genFileListByString(value);
158
+ return acc;
159
+ }, {});
160
+ };
161
+ var handleMultilingualSingleFile = (value, index = 1) => ({
162
+ uid: `-${index}`,
163
+ name: getFileName(value),
164
+ status: "done",
165
+ url: value,
166
+ multilingualFileList: createMultilingualFileList(value),
167
+ multilingual: createMultilingualData(value)
168
+ });
169
+ var handleMultilingualObject = (value, index = 1) => {
170
+ const defaultUrl = value.original || value.en || value["zh-CN"] || value["zh-HK"];
289
171
  return {
290
- success: true
172
+ uid: `-${index}`,
173
+ name: getFileName(defaultUrl),
174
+ status: "done",
175
+ url: defaultUrl,
176
+ multilingual: value,
177
+ multilingualFileList: import_constants.SUPPORTED_LANGUAGES.reduce((acc, lang) => {
178
+ acc[lang] = genFileListByString(value[lang]);
179
+ return acc;
180
+ }, {})
291
181
  };
292
182
  };
183
+ var getDefaultFileList = (value, options) => {
184
+ if (!value)
185
+ return [];
186
+ const { enableMultilingual, multiple } = options;
187
+ if (enableMultilingual) {
188
+ if ((0, import_utils.isString)(value)) {
189
+ return [handleMultilingualSingleFile(value)];
190
+ }
191
+ if (Array.isArray(value)) {
192
+ return value.map((item, index) => {
193
+ if ((0, import_utils.isString)(item)) {
194
+ return handleMultilingualSingleFile(item, index);
195
+ }
196
+ if ((0, import_utils.isPlainObject)(item)) {
197
+ return handleMultilingualObject(item, index);
198
+ }
199
+ return [];
200
+ }).flat();
201
+ }
202
+ if ((0, import_utils.isPlainObject)(value)) {
203
+ return [handleMultilingualObject(value)];
204
+ }
205
+ }
206
+ if (multiple && Array.isArray(value)) {
207
+ return value.map((url, index) => ({
208
+ uid: `-${index}`,
209
+ name: getFileName(url),
210
+ status: "done",
211
+ url
212
+ }));
213
+ }
214
+ if ((0, import_utils.isString)(value)) {
215
+ return [{
216
+ uid: import_constants.DEFAULT_UID,
217
+ name: getFileName(value),
218
+ status: "done",
219
+ url: value
220
+ }];
221
+ }
222
+ return [];
223
+ };
224
+ var getFileMetadataParams = (file) => {
225
+ if (!file.metadata)
226
+ return {};
227
+ const metadataParams = {};
228
+ const metadataKeys = ["width", "height", "duration", "bitrate"];
229
+ metadataKeys.forEach((key) => {
230
+ var _a;
231
+ if (((_a = file.metadata) == null ? void 0 : _a[key]) !== void 0) {
232
+ metadataParams[`metadata[${key}]`] = file.metadata[key];
233
+ }
234
+ });
235
+ return metadataParams;
236
+ };
293
237
  // Annotate the CommonJS export names for ESM import in node:
294
238
  0 && (module.exports = {
295
239
  checkFileCount,
240
+ createMultilingualData,
241
+ createMultilingualFileList,
242
+ genFileListByString,
243
+ generateUid,
244
+ getDefaultFileList,
245
+ getFileMetadataParams,
246
+ getFileName,
296
247
  getFileType,
248
+ getMediaMetadata,
297
249
  getPointSuffix,
298
- getPresetTypes,
299
250
  getSuffix
300
251
  });
@@ -32,6 +32,7 @@ declare const formFieldMap: {
32
32
  FormItemPercent: import("react").FC<any>;
33
33
  FormItemTimePicker: import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
34
34
  'FormItemInput.JSON': import("react").FC<any>;
35
+ 'FormItemInput.Phone': import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
35
36
  'FormItemInput.Email': import("react").FC<import("antd").InputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
36
37
  'FormItemInput.URL': import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
37
38
  'FormItemInput.Password': import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
@@ -44,7 +45,7 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
44
45
  Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
45
46
  } & {
46
47
  Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
47
- }) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
48
+ }) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
48
49
  JSON: import("react").FC<any>;
49
50
  Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
50
51
  TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
@@ -54,6 +54,7 @@ var formFieldMap = {
54
54
  FormItemPercent: import_InputNumber.default,
55
55
  FormItemTimePicker: import_TimePicker.default,
56
56
  "FormItemInput.JSON": import_Input.default.JSON,
57
+ "FormItemInput.Phone": import_Input.default.Phone,
57
58
  "FormItemInput.Email": import_Input.default.Email,
58
59
  "FormItemInput.URL": import_Input.default.URL,
59
60
  "FormItemInput.Password": import_Input.default.Password,
@@ -152,6 +152,11 @@ declare const _default: {
152
152
  'pisell-upload-setting-type-error': (type: string) => string;
153
153
  'pisell-upload-count-error': (count: number) => string;
154
154
  'pisell-upload-error': (name: string) => string;
155
+ 'pisell-upload-multilingual-title': string;
156
+ 'pisell-upload-multilingual-item-title-original': string;
157
+ 'pisell-upload-multilingual-item-title-en': string;
158
+ 'pisell-upload-multilingual-item-title-zh-CN': string;
159
+ 'pisell-upload-multilingual-item-title-zh-HK': string;
155
160
  'pisell-color-picker-default': string;
156
161
  'pisell-action-get-data': string;
157
162
  'pisell-action-delete-failed': string;
@@ -190,6 +190,11 @@ var en_US_default = {
190
190
  "pisell-upload-setting-type-error": (type) => `${type} file type is not supported for upload.`,
191
191
  "pisell-upload-count-error": (count) => `Please upload ${count} file`,
192
192
  "pisell-upload-error": (name) => `${name} upload failed`,
193
+ "pisell-upload-multilingual-title": "Multilingual",
194
+ "pisell-upload-multilingual-item-title-original": "Original",
195
+ "pisell-upload-multilingual-item-title-en": "English",
196
+ "pisell-upload-multilingual-item-title-zh-CN": "简体中文",
197
+ "pisell-upload-multilingual-item-title-zh-HK": "繁體中文",
193
198
  // 颜色组件
194
199
  "pisell-color-picker-default": "Default",
195
200
  // 获取数据
@@ -152,6 +152,11 @@ declare const _default: {
152
152
  'pisell-upload-setting-type-error': (type: string) => string;
153
153
  'pisell-upload-count-error': (count: number) => string;
154
154
  'pisell-upload-error': (name: string) => string;
155
+ 'pisell-upload-multilingual-title': string;
156
+ 'pisell-upload-multilingual-item-title-original': string;
157
+ 'pisell-upload-multilingual-item-title-en': string;
158
+ 'pisell-upload-multilingual-item-title-zh-CN': string;
159
+ 'pisell-upload-multilingual-item-title-zh-HK': string;
155
160
  'pisell-color-picker-default': string;
156
161
  'pisell-action-get-data': string;
157
162
  'pisell-action-delete-failed': string;
@@ -189,6 +189,11 @@ var zh_CN_default = {
189
189
  "pisell-upload-setting-type-error": (type) => `不支持上传${type}类型的文件`,
190
190
  "pisell-upload-count-error": (count) => `请上传${count}个文件`,
191
191
  "pisell-upload-error": (name) => `${name} 上传失败`,
192
+ "pisell-upload-multilingual-title": "多语言",
193
+ "pisell-upload-multilingual-item-title-original": "原始",
194
+ "pisell-upload-multilingual-item-title-en": "English",
195
+ "pisell-upload-multilingual-item-title-zh-CN": "简体中文",
196
+ "pisell-upload-multilingual-item-title-zh-HK": "繁體中文",
192
197
  // 颜色组件
193
198
  "pisell-color-picker-default": "默认",
194
199
  // 获取数据
@@ -152,6 +152,11 @@ declare const _default: {
152
152
  'pisell-upload-setting-type-error': (type: string) => string;
153
153
  'pisell-upload-count-error': (count: number) => string;
154
154
  'pisell-upload-error': (name: string) => string;
155
+ 'pisell-upload-multilingual-title': string;
156
+ 'pisell-upload-multilingual-item-title-original': string;
157
+ 'pisell-upload-multilingual-item-title-en': string;
158
+ 'pisell-upload-multilingual-item-title-zh-CN': string;
159
+ 'pisell-upload-multilingual-item-title-zh-HK': string;
155
160
  'pisell-color-picker-default': string;
156
161
  'pisell-action-get-data': string;
157
162
  'pisell-action-delete-failed': string;
@@ -190,6 +190,11 @@ var zh_TW_default = {
190
190
  "pisell-upload-setting-type-error": (type) => `不支持上傳${type}類型的文件`,
191
191
  "pisell-upload-count-error": (count) => `請上傳${count}個文件`,
192
192
  "pisell-upload-error": (name) => `${name} 上傳失敗`,
193
+ "pisell-upload-multilingual-title": "多語言",
194
+ "pisell-upload-multilingual-item-title-original": "原始",
195
+ "pisell-upload-multilingual-item-title-en": "English",
196
+ "pisell-upload-multilingual-item-title-zh-CN": "简体中文",
197
+ "pisell-upload-multilingual-item-title-zh-HK": "繁體中文",
193
198
  // 颜色选择组件
194
199
  "pisell-color-picker-default": "默認",
195
200
  // 获取数据
@@ -53,6 +53,7 @@ export const createSubmitButton = (props: any = {}) => {
53
53
  },
54
54
  toastConfig: {
55
55
  enable: true,
56
+ showAfterSubmit: true,
56
57
  title: {
57
58
  type: 'i18n',
58
59
  en: 'Submitted successfully',
@@ -79,14 +80,14 @@ export const createFormItemChildren = (item: {
79
80
  ['Select', 'Radio.Group', 'Checkbox.Group'].includes(
80
81
  item.uiSchema['x-component']
81
82
  ) &&
82
- item.uiSchema.enum.length > 0
83
+ item.uiSchema?.enum?.length > 0
83
84
  ) {
84
85
  if (
85
86
  ['Radio.Group', 'Checkbox.Group'].includes(item.uiSchema['x-component'])
86
87
  ) {
87
88
  props.direction = 'horizontal';
88
89
  }
89
- props.options = item.uiSchema.enum;
90
+ props.options = item?.uiSchema?.enum || [];
90
91
  }
91
92
 
92
93
  if (item.uiSchema['x-read-pretty']) {
@@ -208,7 +209,7 @@ export const createFormItemSchema = (
208
209
 
209
210
  if (
210
211
  ['Select', 'Radio.Group', 'Checkbox.Group'].includes(xComponent) &&
211
- uiSchema.enum.length > 0
212
+ uiSchema?.enum?.length > 0
212
213
  ) {
213
214
  if (['Radio.Group', 'Checkbox.Group'].includes(xComponent)) {
214
215
  props.direction = 'horizontal';
@@ -221,7 +222,7 @@ export const createFormItemSchema = (
221
222
  }
222
223
  }
223
224
  props.optionSourceType = 'default';
224
- props.options = uiSchema.enum;
225
+ props.options = uiSchema?.enum || [];
225
226
  }
226
227
 
227
228
  if (xComponent === 'TimePicker') {
@@ -54,14 +54,14 @@ const createRenderSchema = (field: any) => {
54
54
  ['Select', 'Radio.Group', 'Checkbox.Group'].includes(
55
55
  field.uiSchema['x-component']
56
56
  ) &&
57
- field.uiSchema.enum.length > 0
57
+ field.uiSchema?.enum?.length > 0
58
58
  ) {
59
59
  if (
60
60
  ['Radio.Group', 'Checkbox.Group'].includes(field.uiSchema['x-component'])
61
61
  ) {
62
62
  props.direction = 'horizontal';
63
63
  }
64
- props.options = field.uiSchema.enum;
64
+ props.options = field?.uiSchema?.enum || [];
65
65
  }
66
66
 
67
67
  // 如果设置了x-read-pretty,则设置为只读
@@ -75,6 +75,17 @@ export default {
75
75
  defaultValue: true,
76
76
  setter: 'BoolSetter',
77
77
  },
78
+ {
79
+ name: 'enableMultilingual',
80
+ title: {
81
+ type: 'i18n',
82
+ 'en-US': 'Allow Multilingual',
83
+ 'zh-CN': '允许多语言',
84
+ },
85
+ propType: 'bool',
86
+ defaultValue: false,
87
+ setter: 'BoolSetter',
88
+ },
78
89
  ],
79
90
  },
80
91
  {