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,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.MyInputType = exports.MyInputIsNumeric = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _MyInputModule = _interopRequireDefault(require("./MyInput.module.css"));
|
|
9
|
+
var _pi = require("react-icons/pi");
|
|
10
|
+
var _md = require("react-icons/md");
|
|
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; }
|
|
15
|
+
const MyInputType = exports.MyInputType = Object.freeze({
|
|
7
16
|
TEXT: 'text',
|
|
8
17
|
PASSWORD: 'password',
|
|
9
18
|
SELECT: 'select',
|
|
@@ -21,10 +30,11 @@ export const MyInputType = Object.freeze({
|
|
|
21
30
|
MAIL: 'mail',
|
|
22
31
|
PHONE: 'phone'
|
|
23
32
|
});
|
|
24
|
-
|
|
33
|
+
const MyInputIsNumeric = value => {
|
|
25
34
|
if (value === null || value === undefined || value === '') return false;
|
|
26
35
|
return !isNaN(value) && !isNaN(parseFloat(value));
|
|
27
36
|
};
|
|
37
|
+
exports.MyInputIsNumeric = MyInputIsNumeric;
|
|
28
38
|
function MyInput({
|
|
29
39
|
id = null,
|
|
30
40
|
ref = null,
|
|
@@ -67,14 +77,14 @@ function MyInput({
|
|
|
67
77
|
onRemoveImage = null
|
|
68
78
|
}) {
|
|
69
79
|
const myInputId = `key${Date.now() + Math.random().toString(36).substr(2, 9)}`;
|
|
70
|
-
const fileInputRef = useRef(null);
|
|
71
|
-
const [loaded, setLoaded] = useState(false);
|
|
72
|
-
const [myValue, setMyValue] = useState(value);
|
|
73
|
-
const [myEyeView, setMyEyeView] = useState(false);
|
|
74
|
-
const [myFileName, setMyFileName] = useState(null);
|
|
75
|
-
const [myTitleLite, setMyTitleLite] = useState("");
|
|
76
|
-
const [filtertext, setFiltertext] = useState("");
|
|
77
|
-
const [isError, setIsError] = useState(false);
|
|
80
|
+
const fileInputRef = (0, _react.useRef)(null);
|
|
81
|
+
const [loaded, setLoaded] = (0, _react.useState)(false);
|
|
82
|
+
const [myValue, setMyValue] = (0, _react.useState)(value);
|
|
83
|
+
const [myEyeView, setMyEyeView] = (0, _react.useState)(false);
|
|
84
|
+
const [myFileName, setMyFileName] = (0, _react.useState)(null);
|
|
85
|
+
const [myTitleLite, setMyTitleLite] = (0, _react.useState)("");
|
|
86
|
+
const [filtertext, setFiltertext] = (0, _react.useState)("");
|
|
87
|
+
const [isError, setIsError] = (0, _react.useState)(false);
|
|
78
88
|
const toBase64 = file => new Promise((resolve, reject) => {
|
|
79
89
|
const reader = new FileReader();
|
|
80
90
|
reader.readAsDataURL(file);
|
|
@@ -297,7 +307,7 @@ function MyInput({
|
|
|
297
307
|
const validExtensions = ['.jpg', '.jpeg', '.png', '.webp', '.gif'];
|
|
298
308
|
return validExtensions.some(ext => filename.toString().toLocaleLowerCase().includes(ext));
|
|
299
309
|
};
|
|
300
|
-
useEffect(() => {
|
|
310
|
+
(0, _react.useEffect)(() => {
|
|
301
311
|
if (loaded) {
|
|
302
312
|
let vl = value;
|
|
303
313
|
if (value == undefined) vl = null;
|
|
@@ -306,7 +316,7 @@ function MyInput({
|
|
|
306
316
|
if (vl == null) setMyFileName(null);
|
|
307
317
|
}
|
|
308
318
|
}, [value]);
|
|
309
|
-
useEffect(() => {
|
|
319
|
+
(0, _react.useEffect)(() => {
|
|
310
320
|
if (myValue != value && onChange != null) {
|
|
311
321
|
onChange({
|
|
312
322
|
value: myValue,
|
|
@@ -316,12 +326,12 @@ function MyInput({
|
|
|
316
326
|
});
|
|
317
327
|
}
|
|
318
328
|
}, [myValue]);
|
|
319
|
-
useEffect(() => {
|
|
329
|
+
(0, _react.useEffect)(() => {
|
|
320
330
|
if (title) {
|
|
321
331
|
setMyTitleLite(title.replace(/<\/?[^>]+(>|$)/g, ""));
|
|
322
332
|
}
|
|
323
333
|
}, [title]);
|
|
324
|
-
useEffect(() => {
|
|
334
|
+
(0, _react.useEffect)(() => {
|
|
325
335
|
setLoaded(true);
|
|
326
336
|
if (type == MyInputType.SELECTFILTER) filterSelectEvents();
|
|
327
337
|
if (type == MyInputType.DATE) {
|
|
@@ -348,8 +358,8 @@ function MyInput({
|
|
|
348
358
|
}, []);
|
|
349
359
|
const renderInput = () => {
|
|
350
360
|
if (disabled || type === MyInputType.READONLY) {
|
|
351
|
-
return /*#__PURE__*/
|
|
352
|
-
className:
|
|
361
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
362
|
+
className: _MyInputModule.default.disabledInput,
|
|
353
363
|
dangerouslySetInnerHTML: dangerouslySetInnerHTML ? dangerouslySetInnerHTML : {
|
|
354
364
|
__html: getMyValueText()
|
|
355
365
|
},
|
|
@@ -361,218 +371,239 @@ function MyInput({
|
|
|
361
371
|
});
|
|
362
372
|
}
|
|
363
373
|
const inputTypes = {
|
|
364
|
-
[MyInputType.TEXT]: () => /*#__PURE__*/
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
value: e.target.value.toLowerCase().replace(/\s/g, '')
|
|
394
|
-
}
|
|
395
|
-
}),
|
|
396
|
-
placeholder: placeholder || myTitleLite,
|
|
397
|
-
autoComplete: "off",
|
|
398
|
-
style: style,
|
|
399
|
-
onBlur: onMyBlur,
|
|
400
|
-
onFocus: onMyFocus,
|
|
401
|
-
onKeyDown: onMyKeyDown,
|
|
402
|
-
onKeyUp: onMyKeyUp,
|
|
403
|
-
onKeyPress: onMyKeyPress,
|
|
404
|
-
onMouseDown: onMyMouseDown,
|
|
405
|
-
onMouseUp: onMyMouseUp,
|
|
406
|
-
onMouseEnter: onMyMouseEnter,
|
|
407
|
-
onMouseLeave: onMyMouseLeave
|
|
408
|
-
})),
|
|
409
|
-
[MyInputType.PHONE]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
|
|
410
|
-
ref: ref,
|
|
411
|
-
id: id,
|
|
412
|
-
type: "text",
|
|
413
|
-
value: myValue,
|
|
414
|
-
onChange: e => {
|
|
415
|
-
const value = e.target.value.replace(/[^0-9()-]/g, '');
|
|
416
|
-
onMyChange({
|
|
374
|
+
[MyInputType.TEXT]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
375
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
376
|
+
ref: ref,
|
|
377
|
+
id: id,
|
|
378
|
+
type: "text",
|
|
379
|
+
value: myValue,
|
|
380
|
+
onChange: onMyChange,
|
|
381
|
+
placeholder: placeholder || myTitleLite,
|
|
382
|
+
autoComplete: "off",
|
|
383
|
+
style: style,
|
|
384
|
+
maxLength: maxlength,
|
|
385
|
+
onBlur: onMyBlur,
|
|
386
|
+
onFocus: onMyFocus,
|
|
387
|
+
onKeyDown: onMyKeyDown,
|
|
388
|
+
onKeyUp: onMyKeyUp,
|
|
389
|
+
onKeyPress: onMyKeyPress,
|
|
390
|
+
onMouseDown: onMyMouseDown,
|
|
391
|
+
onMouseUp: onMyMouseUp,
|
|
392
|
+
onMouseEnter: onMyMouseEnter,
|
|
393
|
+
onMouseLeave: onMyMouseLeave
|
|
394
|
+
})
|
|
395
|
+
}),
|
|
396
|
+
[MyInputType.MAIL]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
397
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
398
|
+
ref: ref,
|
|
399
|
+
id: id,
|
|
400
|
+
type: "text",
|
|
401
|
+
value: myValue?.toLowerCase(),
|
|
402
|
+
onChange: e => onMyChange({
|
|
417
403
|
...e,
|
|
418
404
|
target: {
|
|
419
405
|
...e.target,
|
|
420
|
-
value
|
|
406
|
+
value: e.target.value.toLowerCase().replace(/\s/g, '')
|
|
421
407
|
}
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
})
|
|
437
|
-
[MyInputType.
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}),
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
408
|
+
}),
|
|
409
|
+
placeholder: placeholder || myTitleLite,
|
|
410
|
+
autoComplete: "off",
|
|
411
|
+
style: style,
|
|
412
|
+
onBlur: onMyBlur,
|
|
413
|
+
onFocus: onMyFocus,
|
|
414
|
+
onKeyDown: onMyKeyDown,
|
|
415
|
+
onKeyUp: onMyKeyUp,
|
|
416
|
+
onKeyPress: onMyKeyPress,
|
|
417
|
+
onMouseDown: onMyMouseDown,
|
|
418
|
+
onMouseUp: onMyMouseUp,
|
|
419
|
+
onMouseEnter: onMyMouseEnter,
|
|
420
|
+
onMouseLeave: onMyMouseLeave
|
|
421
|
+
})
|
|
422
|
+
}),
|
|
423
|
+
[MyInputType.PHONE]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
424
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
425
|
+
ref: ref,
|
|
426
|
+
id: id,
|
|
427
|
+
type: "text",
|
|
428
|
+
value: myValue,
|
|
429
|
+
onChange: e => {
|
|
430
|
+
const value = e.target.value.replace(/[^0-9()-]/g, '');
|
|
431
|
+
onMyChange({
|
|
432
|
+
...e,
|
|
433
|
+
target: {
|
|
434
|
+
...e.target,
|
|
435
|
+
value
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
},
|
|
439
|
+
placeholder: placeholder || myTitleLite,
|
|
440
|
+
autoComplete: "off",
|
|
441
|
+
style: style,
|
|
442
|
+
onBlur: onMyBlur,
|
|
443
|
+
onFocus: onMyFocus,
|
|
444
|
+
onKeyDown: onMyKeyDown,
|
|
445
|
+
onKeyUp: onMyKeyUp,
|
|
446
|
+
onKeyPress: onMyKeyPress,
|
|
447
|
+
onMouseDown: onMyMouseDown,
|
|
448
|
+
onMouseUp: onMyMouseUp,
|
|
449
|
+
onMouseEnter: onMyMouseEnter,
|
|
450
|
+
onMouseLeave: onMyMouseLeave
|
|
451
|
+
})
|
|
452
|
+
}),
|
|
453
|
+
[MyInputType.MONEY]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
454
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
455
|
+
ref: ref,
|
|
456
|
+
id: id,
|
|
457
|
+
type: "text",
|
|
458
|
+
value: moneyFormat(myValue),
|
|
459
|
+
onChange: onMyChange,
|
|
460
|
+
placeholder: placeholder || myTitleLite,
|
|
461
|
+
autoComplete: "off",
|
|
462
|
+
style: style,
|
|
463
|
+
onBlur: onMyBlur,
|
|
464
|
+
onFocus: onMyFocus,
|
|
465
|
+
onKeyDown: onMyKeyDown,
|
|
466
|
+
onKeyUp: onMyKeyUp,
|
|
467
|
+
onKeyPress: onMyKeyPress,
|
|
468
|
+
onMouseDown: onMyMouseDown,
|
|
469
|
+
onMouseUp: onMyMouseUp,
|
|
470
|
+
onMouseEnter: onMyMouseEnter,
|
|
471
|
+
onMouseLeave: onMyMouseLeave
|
|
472
|
+
})
|
|
473
|
+
}),
|
|
474
|
+
[MyInputType.NUMBER]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
475
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
476
|
+
ref: ref,
|
|
477
|
+
id: id,
|
|
478
|
+
type: "number",
|
|
479
|
+
value: myValue,
|
|
480
|
+
onChange: onMyChange,
|
|
481
|
+
placeholder: placeholder || myTitleLite,
|
|
482
|
+
autoComplete: "off",
|
|
483
|
+
style: style,
|
|
484
|
+
onBlur: onMyBlur,
|
|
485
|
+
onFocus: onMyFocus,
|
|
486
|
+
onKeyDown: onMyKeyDown,
|
|
487
|
+
onKeyUp: onMyKeyUp,
|
|
488
|
+
onKeyPress: onMyKeyPress,
|
|
489
|
+
onMouseDown: onMyMouseDown,
|
|
490
|
+
onMouseUp: onMyMouseUp,
|
|
491
|
+
onMouseEnter: onMyMouseEnter,
|
|
492
|
+
onMouseLeave: onMyMouseLeave
|
|
493
|
+
})
|
|
494
|
+
}),
|
|
495
|
+
[MyInputType.DATE]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
496
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
497
|
+
ref: ref,
|
|
498
|
+
type: "date",
|
|
499
|
+
id: "myDate" + myInputId,
|
|
500
|
+
value: myValue || '',
|
|
501
|
+
onChange: onMyChange,
|
|
502
|
+
placeholder: placeholder || myTitleLite,
|
|
503
|
+
min: minDate,
|
|
504
|
+
max: maxDate,
|
|
505
|
+
style: style,
|
|
506
|
+
onBlur: onMyBlur,
|
|
507
|
+
onFocus: onMyFocus,
|
|
508
|
+
onKeyDown: onMyKeyDown,
|
|
509
|
+
onKeyUp: onMyKeyUp,
|
|
510
|
+
onKeyPress: onMyKeyPress,
|
|
511
|
+
onMouseDown: onMyMouseDown,
|
|
512
|
+
onMouseUp: onMyMouseUp,
|
|
513
|
+
onMouseEnter: onMyMouseEnter,
|
|
514
|
+
onMouseLeave: onMyMouseLeave
|
|
515
|
+
})
|
|
516
|
+
}),
|
|
517
|
+
[MyInputType.DATETIME]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
518
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
519
|
+
ref: ref,
|
|
520
|
+
type: "datetime-local",
|
|
521
|
+
id: "myDateTime" + myInputId,
|
|
522
|
+
value: myValue || '',
|
|
523
|
+
onChange: onMyChange,
|
|
524
|
+
placeholder: placeholder || myTitleLite,
|
|
525
|
+
min: minDate,
|
|
526
|
+
max: maxDate,
|
|
527
|
+
style: style,
|
|
528
|
+
onBlur: onMyBlur,
|
|
529
|
+
onFocus: onMyFocus,
|
|
530
|
+
onKeyDown: onMyKeyDown,
|
|
531
|
+
onKeyUp: onMyKeyUp,
|
|
532
|
+
onKeyPress: onMyKeyPress,
|
|
533
|
+
onMouseDown: onMyMouseDown,
|
|
534
|
+
onMouseUp: onMyMouseUp,
|
|
535
|
+
onMouseEnter: onMyMouseEnter,
|
|
536
|
+
onMouseLeave: onMyMouseLeave
|
|
537
|
+
})
|
|
538
|
+
}),
|
|
539
|
+
[MyInputType.TIME]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
540
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
541
|
+
ref: ref,
|
|
542
|
+
type: "time",
|
|
543
|
+
id: "myTime" + myInputId,
|
|
544
|
+
value: myValue || '',
|
|
545
|
+
onChange: onMyChange,
|
|
546
|
+
placeholder: placeholder || myTitleLite,
|
|
547
|
+
style: style,
|
|
548
|
+
onBlur: onMyBlur,
|
|
549
|
+
onFocus: onMyFocus,
|
|
550
|
+
onKeyDown: onMyKeyDown,
|
|
551
|
+
onKeyUp: onMyKeyUp,
|
|
552
|
+
onKeyPress: onMyKeyPress,
|
|
553
|
+
onMouseDown: onMyMouseDown,
|
|
554
|
+
onMouseUp: onMyMouseUp,
|
|
555
|
+
onMouseEnter: onMyMouseEnter,
|
|
556
|
+
onMouseLeave: onMyMouseLeave
|
|
557
|
+
})
|
|
558
|
+
}),
|
|
559
|
+
[MyInputType.PASSWORD]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
560
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
561
|
+
ref: ref,
|
|
562
|
+
id: id,
|
|
563
|
+
type: myEyeView ? "text" : "password",
|
|
564
|
+
value: myValue,
|
|
565
|
+
onChange: onMyChange,
|
|
566
|
+
placeholder: placeholder || myTitleLite,
|
|
567
|
+
autoComplete: "new-password",
|
|
568
|
+
style: style,
|
|
569
|
+
maxLength: maxlength,
|
|
570
|
+
onBlur: onMyBlur,
|
|
571
|
+
onFocus: onMyFocus,
|
|
572
|
+
onKeyDown: onMyKeyDown,
|
|
573
|
+
onKeyUp: onMyKeyUp,
|
|
574
|
+
onKeyPress: onMyKeyPress,
|
|
575
|
+
onMouseDown: onMyMouseDown,
|
|
576
|
+
onMouseUp: onMyMouseUp,
|
|
577
|
+
onMouseEnter: onMyMouseEnter,
|
|
578
|
+
onMouseLeave: onMyMouseLeave
|
|
579
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
580
|
+
type: "button",
|
|
581
|
+
className: _MyInputModule.default.eye,
|
|
582
|
+
onClick: () => setMyEyeView(!myEyeView),
|
|
583
|
+
children: myEyeView ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiEyeSlash, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiEye, {})
|
|
584
|
+
})]
|
|
585
|
+
}),
|
|
586
|
+
[MyInputType.COLOR]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
587
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
588
|
+
ref: ref,
|
|
589
|
+
id: id,
|
|
590
|
+
type: "color",
|
|
591
|
+
value: myValue,
|
|
592
|
+
onChange: onMyChange,
|
|
593
|
+
placeholder: placeholder || myTitleLite,
|
|
594
|
+
style: style,
|
|
595
|
+
onBlur: onMyBlur,
|
|
596
|
+
onFocus: onMyFocus,
|
|
597
|
+
onKeyDown: onMyKeyDown,
|
|
598
|
+
onKeyUp: onMyKeyUp,
|
|
599
|
+
onKeyPress: onMyKeyPress,
|
|
600
|
+
onMouseDown: onMyMouseDown,
|
|
601
|
+
onMouseUp: onMyMouseUp,
|
|
602
|
+
onMouseEnter: onMyMouseEnter,
|
|
603
|
+
onMouseLeave: onMyMouseLeave
|
|
604
|
+
})
|
|
605
|
+
}),
|
|
606
|
+
[MyInputType.TEXTAREA]: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
|
|
576
607
|
ref: ref,
|
|
577
608
|
id: id,
|
|
578
609
|
onChange: onMyChange,
|
|
@@ -591,175 +622,195 @@ function MyInput({
|
|
|
591
622
|
onMouseEnter: onMyMouseEnter,
|
|
592
623
|
onMouseLeave: onMyMouseLeave
|
|
593
624
|
}),
|
|
594
|
-
[MyInputType.SELECT]: () => /*#__PURE__*/
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
625
|
+
[MyInputType.SELECT]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
626
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("select", {
|
|
627
|
+
ref: ref,
|
|
628
|
+
id: id,
|
|
629
|
+
onChange: e => onMyChange(e),
|
|
630
|
+
value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
|
|
631
|
+
style: style,
|
|
632
|
+
onBlur: onMyBlur,
|
|
633
|
+
onFocus: onMyFocus,
|
|
634
|
+
onKeyDown: onMyKeyDown,
|
|
635
|
+
onKeyUp: onMyKeyUp,
|
|
636
|
+
onKeyPress: onMyKeyPress,
|
|
637
|
+
onMouseDown: onMyMouseDown,
|
|
638
|
+
onMouseUp: onMyMouseUp,
|
|
639
|
+
onMouseEnter: onMyMouseEnter,
|
|
640
|
+
onMouseLeave: onMyMouseLeave,
|
|
641
|
+
children: options && options.map(e => {
|
|
642
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
643
|
+
value: MyInputIsNumeric(e[options_key_value]) ? parseInt(e[options_key_value]) : e[options_key_value],
|
|
644
|
+
children: e[options_key_text] || e["label"]
|
|
645
|
+
}, e[options_key_value]);
|
|
646
|
+
})
|
|
647
|
+
}), !myValue && !options && (placeholder || myTitleLite) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
648
|
+
className: _MyInputModule.default.placeholder,
|
|
649
|
+
children: placeholder ? placeholder : myTitleLite
|
|
650
|
+
})]
|
|
651
|
+
}),
|
|
652
|
+
[MyInputType.SELECTFILTER]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
653
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
654
|
+
ref: ref,
|
|
655
|
+
id: "mySelectFilterInput" + (id ? id : myInputId),
|
|
656
|
+
type: "text",
|
|
657
|
+
className: _MyInputModule.default.filterInput,
|
|
658
|
+
style: style,
|
|
659
|
+
value: filtertext,
|
|
660
|
+
onChange: e => setFiltertext(e.target.value),
|
|
661
|
+
placeholder: placeholdersearchtext && placeholdersearchtext != "" ? placeholdersearchtext : (placeholder ? placeholder : myTitleLite) + " ...",
|
|
662
|
+
onBlur: onMyBlur,
|
|
663
|
+
onFocus: onMyFocus,
|
|
664
|
+
onKeyDown: onMyKeyDown,
|
|
665
|
+
onKeyUp: onMyKeyUp,
|
|
666
|
+
onKeyPress: onMyKeyPress,
|
|
667
|
+
onMouseDown: onMyMouseDown,
|
|
668
|
+
onMouseUp: onMyMouseUp,
|
|
669
|
+
onMouseEnter: onMyMouseEnter,
|
|
670
|
+
onMouseLeave: onMyMouseLeave
|
|
671
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
672
|
+
className: _MyInputModule.default.filterInputSelectedContainer + " " + (myValue ? _MyInputModule.default.filterInputSelectedContainerSelected : ''),
|
|
673
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
674
|
+
id: "mySelectFilterSelected" + (id ? id : myInputId),
|
|
675
|
+
className: _MyInputModule.default.filterInputSelected,
|
|
676
|
+
dangerouslySetInnerHTML: {
|
|
677
|
+
__html: getMyValueText()
|
|
678
|
+
}
|
|
679
|
+
}), myValue && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
680
|
+
className: _MyInputModule.default.filterInputSelectedX,
|
|
681
|
+
onClick: () => setMyValue(null),
|
|
682
|
+
title: t("Seçimi Kaldır"),
|
|
683
|
+
children: "x"
|
|
684
|
+
}) || "", /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiCaretDownBold, {
|
|
685
|
+
className: _MyInputModule.default.caretdown
|
|
686
|
+
})]
|
|
687
|
+
}), !myValue && (placeholder || myTitleLite) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
688
|
+
className: _MyInputModule.default.placeholder,
|
|
689
|
+
children: placeholder ? placeholder : myTitleLite
|
|
690
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
691
|
+
id: "mySelectFilterList" + (id ? id : myInputId),
|
|
692
|
+
className: _MyInputModule.default.filterInputList,
|
|
693
|
+
children: options && getFilterOptions().map(item => {
|
|
694
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
695
|
+
value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
|
|
696
|
+
onClick: () => mySelectFilterListClick(item),
|
|
697
|
+
className: item[options_key_subtext] ? _MyInputModule.default.subtextli : '',
|
|
698
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
699
|
+
dangerouslySetInnerHTML: {
|
|
700
|
+
__html: item[options_key_text] || item["label"]
|
|
701
|
+
}
|
|
702
|
+
}), item[options_key_subtext] && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
703
|
+
className: _MyInputModule.default.subtext,
|
|
704
|
+
children: item[options_key_subtext]
|
|
705
|
+
})]
|
|
706
|
+
}, item[options_key_value]);
|
|
707
|
+
})
|
|
708
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
709
|
+
style: {
|
|
710
|
+
display: "none"
|
|
711
|
+
},
|
|
712
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("select", {
|
|
713
|
+
id: "mySelectFilterHiddenSelect" + myInputId,
|
|
714
|
+
onChange: e => onMyChange(e),
|
|
715
|
+
value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
|
|
716
|
+
children: options && options.map(item => {
|
|
717
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
718
|
+
value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
|
|
719
|
+
children: item[options_key_text] || item["label"]
|
|
720
|
+
}, item[options_key_value]);
|
|
721
|
+
})
|
|
722
|
+
})
|
|
723
|
+
})]
|
|
724
|
+
}),
|
|
725
|
+
[MyInputType.FILE]: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
726
|
+
className: _MyInputModule.default.fileinput,
|
|
727
|
+
children: [(() => {
|
|
728
|
+
// Dosya önizleme gösterimi için kontrol
|
|
729
|
+
if (myValue && (type === MyInputType.IMAGE || accept === '.jpg,.jpeg,.png')) {
|
|
730
|
+
if (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename)) {
|
|
731
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
732
|
+
src: myValue[0].base64,
|
|
733
|
+
className: _MyInputModule.default.fileImagePreview,
|
|
734
|
+
alt: "Preview"
|
|
735
|
+
});
|
|
736
|
+
} else if (getFileImageControl(myValue)) {
|
|
737
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
738
|
+
src: myValue,
|
|
739
|
+
className: _MyInputModule.default.fileImagePreview,
|
|
740
|
+
alt: "Preview"
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return null;
|
|
745
|
+
})(), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
746
|
+
className: _MyInputModule.default.filename + " " + (myFileName && _MyInputModule.default.selected),
|
|
661
747
|
dangerouslySetInnerHTML: {
|
|
662
|
-
__html:
|
|
748
|
+
__html: myFileName || (placeholder ? placeholder : t(type === MyInputType.IMAGE ? "Görsel Seçiniz" : "Dosya Seçiniz"))
|
|
663
749
|
}
|
|
664
|
-
}),
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
id: "mySelectFilterHiddenSelect" + myInputId,
|
|
673
|
-
onChange: e => onMyChange(e),
|
|
674
|
-
value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : ""
|
|
675
|
-
}, options && options.map(item => {
|
|
676
|
-
return /*#__PURE__*/React.createElement("option", {
|
|
677
|
-
key: item[options_key_value],
|
|
678
|
-
value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value]
|
|
679
|
-
}, item[options_key_text] || item["label"]);
|
|
680
|
-
})))),
|
|
681
|
-
[MyInputType.FILE]: () => /*#__PURE__*/React.createElement("div", {
|
|
682
|
-
className: styles.fileinput
|
|
683
|
-
}, (() => {
|
|
684
|
-
// Dosya önizleme gösterimi için kontrol
|
|
685
|
-
if (myValue && (type === MyInputType.IMAGE || accept === '.jpg,.jpeg,.png')) {
|
|
686
|
-
if (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename)) {
|
|
687
|
-
return /*#__PURE__*/React.createElement("img", {
|
|
688
|
-
src: myValue[0].base64,
|
|
689
|
-
className: styles.fileImagePreview,
|
|
690
|
-
alt: "Preview"
|
|
691
|
-
});
|
|
692
|
-
} else if (getFileImageControl(myValue)) {
|
|
693
|
-
return /*#__PURE__*/React.createElement("img", {
|
|
694
|
-
src: myValue,
|
|
695
|
-
className: styles.fileImagePreview,
|
|
696
|
-
alt: "Preview"
|
|
750
|
+
}), (() => {
|
|
751
|
+
if (onRemoveImage && myValue && type === MyInputType.IMAGE && (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename) || getFileImageControl(myValue) && !(myValue.includes("nologo") || myValue.includes("noimage")))) {
|
|
752
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
753
|
+
type: "button",
|
|
754
|
+
onClick: onRemoveImageClick,
|
|
755
|
+
className: _MyInputModule.default.filebuttonremove,
|
|
756
|
+
title: t("Kaldır"),
|
|
757
|
+
children: "x"
|
|
697
758
|
});
|
|
698
759
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
className: styles.filebutton
|
|
720
|
-
}, type === MyInputType.IMAGE ? /*#__PURE__*/React.createElement(PiImage, null) : /*#__PURE__*/React.createElement(MdOutlineAttachFile, null)), /*#__PURE__*/React.createElement("input", _extends({
|
|
721
|
-
type: "file",
|
|
722
|
-
ref: fileInputRef,
|
|
723
|
-
onChange: e => onMyChange(e),
|
|
724
|
-
placeholder: placeholder || myTitleLite,
|
|
725
|
-
style: {
|
|
726
|
-
display: "none"
|
|
727
|
-
}
|
|
728
|
-
}, multiple ? {
|
|
729
|
-
multiple: true
|
|
730
|
-
} : {}, {
|
|
731
|
-
accept: type === MyInputType.IMAGE ? '.jpg,.jpeg,.png' : accept
|
|
732
|
-
}))),
|
|
760
|
+
return null;
|
|
761
|
+
})(), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
762
|
+
type: "button",
|
|
763
|
+
onClick: () => fileInputRef.current.click(),
|
|
764
|
+
className: _MyInputModule.default.filebutton,
|
|
765
|
+
children: type === MyInputType.IMAGE ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiImage, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineAttachFile, {})
|
|
766
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
767
|
+
type: "file",
|
|
768
|
+
ref: fileInputRef,
|
|
769
|
+
onChange: e => onMyChange(e),
|
|
770
|
+
placeholder: placeholder || myTitleLite,
|
|
771
|
+
style: {
|
|
772
|
+
display: "none"
|
|
773
|
+
},
|
|
774
|
+
...(multiple ? {
|
|
775
|
+
multiple: true
|
|
776
|
+
} : {}),
|
|
777
|
+
accept: type === MyInputType.IMAGE ? '.jpg,.jpeg,.png' : accept
|
|
778
|
+
})]
|
|
779
|
+
}),
|
|
733
780
|
[MyInputType.IMAGE]: function () {
|
|
734
781
|
return this[MyInputType.FILE]();
|
|
735
782
|
}
|
|
736
783
|
};
|
|
737
784
|
return inputTypes[type]?.() || null;
|
|
738
785
|
};
|
|
739
|
-
return /*#__PURE__*/
|
|
786
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
740
787
|
id: "myinput" + myInputId,
|
|
741
|
-
className:
|
|
788
|
+
className: _MyInputModule.default.container + " " + (className != null ? className : '') + " " + (isError ? _MyInputModule.default.error : ''),
|
|
742
789
|
title: title && myTitleLite || placeholder && placeholder,
|
|
743
790
|
style: style && style.width && {
|
|
744
791
|
display: 'inline-block'
|
|
745
792
|
} || {
|
|
746
793
|
width: '100%'
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
794
|
+
},
|
|
795
|
+
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
|
|
796
|
+
dangerouslySetInnerHTML: {
|
|
797
|
+
__html: title
|
|
798
|
+
}
|
|
799
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
800
|
+
className: _MyInputModule.default.inputblock + " " + (disabled || type === MyInputType.READONLY ? _MyInputModule.default.inputblockdisabled : '') + " " + (icon || type === MyInputType.IMAGE ? _MyInputModule.default.inputblockicon : ''),
|
|
801
|
+
style: style && {
|
|
802
|
+
...(style.backgroundColor && {
|
|
803
|
+
backgroundColor: style.backgroundColor
|
|
804
|
+
})
|
|
805
|
+
},
|
|
806
|
+
children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
807
|
+
className: `${_MyInputModule.default.icon} ${type === MyInputType.TEXTAREA || rows > 0 ? _MyInputModule.default.icontextarea : ''}`,
|
|
808
|
+
children: icon
|
|
809
|
+
}), renderInput()]
|
|
810
|
+
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
|
|
811
|
+
className: _MyInputModule.default.description,
|
|
812
|
+
children: description
|
|
813
|
+
})]
|
|
814
|
+
});
|
|
764
815
|
}
|
|
765
|
-
|
|
816
|
+
var _default = exports.default = MyInput;
|