px-react-ui-components 1.1.24 → 1.1.25
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.
|
@@ -20,8 +20,13 @@ let Resizer, Camera, FACING_MODES, IMAGE_TYPES;
|
|
|
20
20
|
let hasImageResizer = false;
|
|
21
21
|
let hasCamera = false;
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const raw = require("react-image-file-resizer");
|
|
24
|
+
// Vite/ESM: default export is { default: { imageFileResizer } }; CJS often { imageFileResizer }
|
|
25
|
+
const resolved = raw && (raw.default ?? raw);
|
|
26
|
+
if (resolved && typeof resolved.imageFileResizer === "function") {
|
|
27
|
+
Resizer = resolved;
|
|
28
|
+
hasImageResizer = true;
|
|
29
|
+
}
|
|
25
30
|
} catch (error) {
|
|
26
31
|
console.warn("MyFileUpload: react-image-file-resizer bağımlılığı bulunamadı.");
|
|
27
32
|
}
|
|
@@ -51,6 +56,8 @@ function MyFileUpload({
|
|
|
51
56
|
camera = true,
|
|
52
57
|
maxSizeMB = 50,
|
|
53
58
|
onData,
|
|
59
|
+
label = null,
|
|
60
|
+
labelClassName = null,
|
|
54
61
|
className = null,
|
|
55
62
|
classNameContainer = null,
|
|
56
63
|
classNameItem = null,
|
|
@@ -150,7 +157,7 @@ function MyFileUpload({
|
|
|
150
157
|
continue;
|
|
151
158
|
}
|
|
152
159
|
let extension_type = type_image.indexOf(file_ext) > -1 ? "image" : "file";
|
|
153
|
-
if (extension_type == "file") {
|
|
160
|
+
if (extension_type == "file" || !hasImageResizer) {
|
|
154
161
|
const reader = new FileReader();
|
|
155
162
|
reader.onload = function () {
|
|
156
163
|
let fileitem = {
|
|
@@ -246,9 +253,26 @@ function MyFileUpload({
|
|
|
246
253
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MyWaiting.default, {
|
|
247
254
|
show: loading,
|
|
248
255
|
message: ""
|
|
249
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
250
|
-
|
|
251
|
-
|
|
256
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
257
|
+
style: {
|
|
258
|
+
display: 'flex',
|
|
259
|
+
flexDirection: 'row',
|
|
260
|
+
gap: '1px'
|
|
261
|
+
},
|
|
262
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
263
|
+
style: {
|
|
264
|
+
display: "block",
|
|
265
|
+
fontSize: 11,
|
|
266
|
+
fontWeight: "bold",
|
|
267
|
+
color: "black",
|
|
268
|
+
marginBottom: "0.25rem",
|
|
269
|
+
paddingLeft: "0.5rem",
|
|
270
|
+
textTransform: "uppercase",
|
|
271
|
+
letterSpacing: "0.05em"
|
|
272
|
+
},
|
|
273
|
+
className: labelClassName ? labelClassName : '',
|
|
274
|
+
children: label
|
|
275
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
252
276
|
className: _MyFileUploadModule.default.myFileUploadContainer + (className != null ? " " + className : ''),
|
|
253
277
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
254
278
|
className: _MyFileUploadModule.default.myFileUploadContainerItem + (classNameItem != null ? " " + classNameItem : ''),
|
|
@@ -301,7 +325,7 @@ function MyFileUpload({
|
|
|
301
325
|
})
|
|
302
326
|
})]
|
|
303
327
|
})]
|
|
304
|
-
})
|
|
328
|
+
})]
|
|
305
329
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MyModal.default, {
|
|
306
330
|
show: cameraopen,
|
|
307
331
|
onClose: () => setCameraopen(false),
|