px-react-ui-components 1.0.2 → 1.0.5
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.
- package/dist/components/MyAlert/MyAlert.js +17 -9
- package/dist/components/MyContainer/MyContainer.js +42 -26
- package/dist/components/MyContainer/MyContainerBody.js +14 -5
- package/dist/components/MyContainer/MyContainerFooter.js +14 -5
- package/dist/components/MyContainer/MyContainerRight.js +15 -6
- package/dist/components/MyEditor/MyEditor.js +73 -59
- package/dist/components/MyFileUpload/MyFileUpload.js +132 -102
- package/dist/components/MyImageCropper/MyImageCropper.js +37 -24
- package/dist/components/MyInput/MyInput.js +435 -384
- package/dist/components/MyInput/index.js +23 -0
- package/dist/components/MyMaps/YandexMaps.js +21 -13
- package/dist/components/MyMenu/MenuItem.js +60 -38
- package/dist/components/MyModal/MyModal.js +39 -22
- package/dist/components/MyModal/MyModalBody.js +14 -5
- package/dist/components/MyModal/MyModalFooter.js +14 -5
- package/dist/components/MyNotFound/MyNotFound.js +22 -12
- package/dist/components/MyScrollableCard/MyScrollableCard.js +22 -12
- package/dist/components/MyTable/MyTable.js +142 -108
- package/dist/components/MyTable/MyTableBody.js +14 -5
- package/dist/components/MyTable/MyTableHead.js +14 -5
- package/dist/components/MyTabs/MyTabPane.js +14 -3
- package/dist/components/MyTabs/MyTabs.js +59 -41
- package/dist/components/MyWaiting/MyWaiting.js +30 -19
- package/dist/components/MyZoomImage/MyZoomImage.js +101 -77
- package/dist/index.js +131 -15
- package/package.json +7 -8
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AcceptType = void 0;
|
|
7
|
+
exports.default = MyFileUpload;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _pi = require("react-icons/pi");
|
|
10
|
+
var _reactImageFileResizer = _interopRequireDefault(require("react-image-file-resizer"));
|
|
11
|
+
var _reactHtml5CameraPhoto = _interopRequireWildcard(require("react-html5-camera-photo"));
|
|
12
|
+
require("react-html5-camera-photo/build/css/index.css");
|
|
13
|
+
var _MyWaiting = _interopRequireDefault(require("../MyWaiting/MyWaiting"));
|
|
14
|
+
var _MyAlert = require("../MyAlert/MyAlert");
|
|
15
|
+
var _MyFileUploadModule = _interopRequireDefault(require("./MyFileUpload.module.css"));
|
|
16
|
+
var _MyModal = _interopRequireDefault(require("../MyModal/MyModal"));
|
|
17
|
+
var _md = require("react-icons/md");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
const AcceptType = exports.AcceptType = {
|
|
12
23
|
ALL: "all",
|
|
13
24
|
FILE: "file",
|
|
14
25
|
IMAGE: "image",
|
|
@@ -16,8 +27,8 @@ export const AcceptType = {
|
|
|
16
27
|
PDF: "pdf",
|
|
17
28
|
IMAGEPDF: "imagepdf"
|
|
18
29
|
};
|
|
19
|
-
Object.freeze(MyAlertType);
|
|
20
|
-
|
|
30
|
+
Object.freeze(_MyAlert.MyAlertType);
|
|
31
|
+
function MyFileUpload({
|
|
21
32
|
multiple = false,
|
|
22
33
|
accept = AcceptType.ALL,
|
|
23
34
|
className = null,
|
|
@@ -25,18 +36,18 @@ export default function MyFileUpload({
|
|
|
25
36
|
maxSizeMB = 50,
|
|
26
37
|
onData
|
|
27
38
|
}) {
|
|
28
|
-
const [loading, setLoading] = useState(false);
|
|
29
|
-
const [accepttypes, setAccepttypes] = useState(AcceptType.ALL);
|
|
30
|
-
const [acceptlabel, setAcceptlabel] = useState(AcceptType.ALL);
|
|
31
|
-
const [cameraopen, setCameraopen] = useState(false);
|
|
32
|
-
const [cameraopened, setCameraopened] = useState(false);
|
|
33
|
-
const [devices, setDevices] = useState([]);
|
|
34
|
-
const [selectedDeviceId, setSelectedDeviceId] = useState("");
|
|
35
|
-
const fileInputRef = useRef(null);
|
|
39
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
40
|
+
const [accepttypes, setAccepttypes] = (0, _react.useState)(AcceptType.ALL);
|
|
41
|
+
const [acceptlabel, setAcceptlabel] = (0, _react.useState)(AcceptType.ALL);
|
|
42
|
+
const [cameraopen, setCameraopen] = (0, _react.useState)(false);
|
|
43
|
+
const [cameraopened, setCameraopened] = (0, _react.useState)(false);
|
|
44
|
+
const [devices, setDevices] = (0, _react.useState)([]);
|
|
45
|
+
const [selectedDeviceId, setSelectedDeviceId] = (0, _react.useState)("");
|
|
46
|
+
const fileInputRef = (0, _react.useRef)(null);
|
|
36
47
|
let type_files = ".pdf,.rar,.zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx,msword,msexcel,vnd.ms-excel,vnd.openxmlformats-officedocument.spreadsheetml.sheet,vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
37
48
|
let type_image = ".jpg,.jpeg,.png";
|
|
38
49
|
let type_media = ".mp3,.mp4,.avi,.wav";
|
|
39
|
-
useEffect(() => {
|
|
50
|
+
(0, _react.useEffect)(() => {
|
|
40
51
|
switch (accept) {
|
|
41
52
|
case AcceptType.ALL:
|
|
42
53
|
setAccepttypes(type_files + "," + type_image + "," + type_media);
|
|
@@ -76,7 +87,7 @@ export default function MyFileUpload({
|
|
|
76
87
|
let message = _error.map((e, i) => {
|
|
77
88
|
return i + 1 + ".) <b><i>" + e.filename + "</i></b><br/>---- " + e.message + "<br/>";
|
|
78
89
|
});
|
|
79
|
-
MyAlert("<br/><br/><div style='display: block;font-size:13px;width: 100%;text-align: left;'>" + message + "</div>", MyAlertType.WARNING);
|
|
90
|
+
(0, _MyAlert.MyAlert)("<br/><br/><div style='display: block;font-size:13px;width: 100%;text-align: left;'>" + message + "</div>", _MyAlert.MyAlertType.WARNING);
|
|
80
91
|
}
|
|
81
92
|
if (onData && (Array.isArray(resdata) && resdata.length > 0 || !Array.isArray(resdata) && resdata)) onData(resdata);
|
|
82
93
|
setLoading(false);
|
|
@@ -145,7 +156,7 @@ export default function MyFileUpload({
|
|
|
145
156
|
ext: file_ext,
|
|
146
157
|
type_image: type_image
|
|
147
158
|
};
|
|
148
|
-
|
|
159
|
+
_reactImageFileResizer.default.imageFileResizer(file, 2600, 2600, "JPEG", 100, 0, uri => {
|
|
149
160
|
fileReaderCalc++;
|
|
150
161
|
let fileitem = {
|
|
151
162
|
base64: uri,
|
|
@@ -170,7 +181,7 @@ export default function MyFileUpload({
|
|
|
170
181
|
|
|
171
182
|
// responseData(response_files, _error);
|
|
172
183
|
};
|
|
173
|
-
useEffect(() => {
|
|
184
|
+
(0, _react.useEffect)(() => {
|
|
174
185
|
if (!cameraopen) {
|
|
175
186
|
setCameraopened(false);
|
|
176
187
|
}
|
|
@@ -207,81 +218,100 @@ export default function MyFileUpload({
|
|
|
207
218
|
const handleCameraStop = () => {
|
|
208
219
|
// setCameraopened(false);
|
|
209
220
|
};
|
|
210
|
-
return /*#__PURE__*/
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
},
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
221
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
222
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MyWaiting.default, {
|
|
223
|
+
show: loading,
|
|
224
|
+
message: ""
|
|
225
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
226
|
+
className: className,
|
|
227
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
228
|
+
className: _MyFileUploadModule.default.myFileUploadContainer,
|
|
229
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
230
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItem,
|
|
231
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
232
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItemIcon,
|
|
233
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiFileArrowUpLight, {
|
|
234
|
+
className: _MyFileUploadModule.default.Icon
|
|
235
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
236
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItemIconText,
|
|
237
|
+
children: [acceptlabel, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), " ", maxSizeMB, " MB"]
|
|
238
|
+
})]
|
|
239
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
240
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItemFile,
|
|
241
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
242
|
+
type: "file",
|
|
243
|
+
hidden: true,
|
|
244
|
+
ref: fileInputRef,
|
|
245
|
+
onChange: handleFileInputChange,
|
|
246
|
+
multiple: multiple,
|
|
247
|
+
accept: accepttypes
|
|
248
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
249
|
+
className: _MyFileUploadModule.default.myFileUploadButton,
|
|
250
|
+
onClick: () => fileInputRef.current.click(),
|
|
251
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineAttachFile, {})
|
|
252
|
+
})]
|
|
253
|
+
})]
|
|
254
|
+
}), camera && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
255
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItem,
|
|
256
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
257
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItemIcon,
|
|
258
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiCamera, {
|
|
259
|
+
className: _MyFileUploadModule.default.Icon
|
|
260
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
261
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItemIconText,
|
|
262
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
263
|
+
children: "You can take a photo from the camera."
|
|
264
|
+
})
|
|
265
|
+
})]
|
|
266
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
267
|
+
className: _MyFileUploadModule.default.myFileUploadContainerItemFile,
|
|
268
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
269
|
+
type: "button",
|
|
270
|
+
className: _MyFileUploadModule.default.myFileUploadButton,
|
|
271
|
+
onClick: () => setCameraopen(true),
|
|
272
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiCamera, {})
|
|
273
|
+
})
|
|
274
|
+
})]
|
|
275
|
+
})]
|
|
276
|
+
})
|
|
277
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MyModal.default, {
|
|
278
|
+
show: cameraopen,
|
|
279
|
+
onClose: () => setCameraopen(false),
|
|
280
|
+
title: t("Fotoğraf Çek"),
|
|
281
|
+
closeOnEsc: false,
|
|
282
|
+
closeOnBackdropClick: false,
|
|
283
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
284
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHtml5CameraPhoto.default, {
|
|
285
|
+
videoConstraints: {
|
|
286
|
+
deviceId: selectedDeviceId ? {
|
|
287
|
+
exact: selectedDeviceId
|
|
288
|
+
} : undefined
|
|
289
|
+
},
|
|
290
|
+
onTakePhoto: dataUri => {
|
|
291
|
+
console.log(dataUri);
|
|
292
|
+
handleTakePhoto(dataUri);
|
|
293
|
+
},
|
|
294
|
+
onCameraError: handleCameraError,
|
|
295
|
+
onCameraStart: stream => {
|
|
296
|
+
handleCameraStart(stream);
|
|
297
|
+
},
|
|
298
|
+
onCameraStop: () => {
|
|
299
|
+
handleCameraStop();
|
|
300
|
+
},
|
|
301
|
+
idealFacingMode: _reactHtml5CameraPhoto.FACING_MODES.ENVIRONMENT,
|
|
302
|
+
idealResolution: {
|
|
303
|
+
width: 1024,
|
|
304
|
+
height: 1024
|
|
305
|
+
},
|
|
306
|
+
imageType: _reactHtml5CameraPhoto.IMAGE_TYPES.JPG,
|
|
307
|
+
isMaxResolution: true,
|
|
308
|
+
isImageMirror: false,
|
|
309
|
+
isSilentMode: false,
|
|
310
|
+
isDisplayStartCameraError: true,
|
|
311
|
+
isFullscreen: false,
|
|
312
|
+
sizeFactor: 1
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
})]
|
|
316
|
+
});
|
|
287
317
|
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactImageCrop = _interopRequireDefault(require("react-image-crop"));
|
|
9
|
+
require("react-image-crop/dist/ReactCrop.css");
|
|
10
|
+
var _MyZoomImage = _interopRequireDefault(require("../MyZoomImage/MyZoomImage"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
5
15
|
const MyImageCropper = ({
|
|
6
16
|
image,
|
|
7
17
|
style = null,
|
|
8
18
|
onChange = null
|
|
9
19
|
}) => {
|
|
10
|
-
const [crop, setCrop] = useState({
|
|
20
|
+
const [crop, setCrop] = (0, _react.useState)({
|
|
11
21
|
x: 0,
|
|
12
22
|
y: 0,
|
|
13
23
|
width: 0,
|
|
@@ -15,13 +25,13 @@ const MyImageCropper = ({
|
|
|
15
25
|
aspect: 1
|
|
16
26
|
});
|
|
17
27
|
// const [croppedImageUrl, setCroppedImageUrl] = useState(null);
|
|
18
|
-
const [imageRef, setImageRef] = useState(null);
|
|
19
|
-
const [zoom, setZoom] = useState({
|
|
28
|
+
const [imageRef, setImageRef] = (0, _react.useState)(null);
|
|
29
|
+
const [zoom, setZoom] = (0, _react.useState)({
|
|
20
30
|
scale: 1,
|
|
21
31
|
positionX: 0,
|
|
22
32
|
positionY: 0
|
|
23
33
|
}); // Zoom seviyesini saklamak için state
|
|
24
|
-
const [scaleFactor, setScaleFactor] = useState(1.5);
|
|
34
|
+
const [scaleFactor, setScaleFactor] = (0, _react.useState)(1.5);
|
|
25
35
|
|
|
26
36
|
// Görüntü yüklendiğinde çağrılır
|
|
27
37
|
const handleImageLoad = e => {
|
|
@@ -76,20 +86,23 @@ const MyImageCropper = ({
|
|
|
76
86
|
});
|
|
77
87
|
}
|
|
78
88
|
};
|
|
79
|
-
return /*#__PURE__*/
|
|
80
|
-
style: style
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
90
|
+
style: style,
|
|
91
|
+
children: image && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactImageCrop.default, {
|
|
92
|
+
crop: crop,
|
|
93
|
+
onComplete: onCropComplete,
|
|
94
|
+
onChange: newCrop => setCrop(newCrop),
|
|
95
|
+
style: style,
|
|
96
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MyZoomImage.default, {
|
|
97
|
+
onZoomChange: handleZoomChange,
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
99
|
+
src: image,
|
|
100
|
+
alt: "Crop preview",
|
|
101
|
+
onLoad: handleImageLoad,
|
|
102
|
+
className: "rounded-e-md"
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
});
|
|
94
107
|
};
|
|
95
|
-
|
|
108
|
+
var _default = exports.default = MyImageCropper;
|