px-react-ui-components 1.0.2 → 1.0.3

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.
@@ -1,9 +1,33 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useEffect, useRef, useState } from "react";
3
- import styles from "./MyInput.module.css";
4
- import { PiCaretDownBold, PiEye, PiEyeSlash, PiImage } from "react-icons/pi";
5
- import { MdOutlineAttachFile } from "react-icons/md";
6
- export const MyInputType = Object.freeze({
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.MyInputType = exports.MyInputIsNumeric = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _MyInputModule = _interopRequireDefault(require("./MyInput.module.css"));
10
+ var _pi = require("react-icons/pi");
11
+ var _md = require("react-icons/md");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
+ 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; }
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
21
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
22
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
23
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
24
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
25
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
26
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
27
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
28
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
29
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
30
+ var MyInputType = exports.MyInputType = Object.freeze({
7
31
  TEXT: 'text',
8
32
  PASSWORD: 'password',
9
33
  SELECT: 'select',
@@ -21,85 +45,148 @@ export const MyInputType = Object.freeze({
21
45
  MAIL: 'mail',
22
46
  PHONE: 'phone'
23
47
  });
24
- export const MyInputIsNumeric = value => {
48
+ var MyInputIsNumeric = exports.MyInputIsNumeric = function MyInputIsNumeric(value) {
25
49
  if (value === null || value === undefined || value === '') return false;
26
50
  return !isNaN(value) && !isNaN(parseFloat(value));
27
51
  };
28
- function MyInput({
29
- id = null,
30
- ref = null,
31
- title = "",
32
- placeholder = "",
33
- placeholdersearchtext = "",
34
- description = null,
35
- type = MyInputType.TEXT,
36
- className = null,
37
- rows = 0,
38
- icon = null,
39
- options = null,
40
- options_key_value = "value",
41
- options_key_text = "text",
42
- options_key_subtext = "subtext",
43
- multiple = false,
44
- disabled = false,
45
- value = null,
46
- decimalCount = 2,
47
- buttonText = "",
48
- accept = ".jpg,.jpeg,.png",
49
- minDate = null,
50
- maxDate = null,
51
- style = null,
52
- maxlength = null,
53
- dangerouslySetInnerHTML = null,
54
- uppercase = false,
55
- lowercase = false,
56
- firstUppercase = false,
57
- onChange = null,
58
- onBlur = null,
59
- onFocus = null,
60
- onKeyDown = null,
61
- onKeyUp = null,
62
- onKeyPress = null,
63
- onMouseDown = null,
64
- onMouseUp = null,
65
- onMouseEnter = null,
66
- onMouseLeave = null,
67
- onRemoveImage = null
68
- }) {
69
- 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);
78
- const toBase64 = file => new Promise((resolve, reject) => {
79
- const reader = new FileReader();
80
- reader.readAsDataURL(file);
81
- reader.onload = () => resolve(reader.result);
82
- reader.onerror = reject;
83
- });
84
- const calculateFileSize = sizeInBytes => {
85
- const units = ['B', 'KB', 'MB'];
86
- let size = sizeInBytes;
87
- let unitIndex = 0;
52
+ function MyInput(_ref) {
53
+ var _ref$id = _ref.id,
54
+ id = _ref$id === void 0 ? null : _ref$id,
55
+ _ref$ref = _ref.ref,
56
+ ref = _ref$ref === void 0 ? null : _ref$ref,
57
+ _ref$title = _ref.title,
58
+ title = _ref$title === void 0 ? "" : _ref$title,
59
+ _ref$placeholder = _ref.placeholder,
60
+ placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
61
+ _ref$placeholdersearc = _ref.placeholdersearchtext,
62
+ placeholdersearchtext = _ref$placeholdersearc === void 0 ? "" : _ref$placeholdersearc,
63
+ _ref$description = _ref.description,
64
+ description = _ref$description === void 0 ? null : _ref$description,
65
+ _ref$type = _ref.type,
66
+ type = _ref$type === void 0 ? MyInputType.TEXT : _ref$type,
67
+ _ref$className = _ref.className,
68
+ className = _ref$className === void 0 ? null : _ref$className,
69
+ _ref$rows = _ref.rows,
70
+ rows = _ref$rows === void 0 ? 0 : _ref$rows,
71
+ _ref$icon = _ref.icon,
72
+ icon = _ref$icon === void 0 ? null : _ref$icon,
73
+ _ref$options = _ref.options,
74
+ options = _ref$options === void 0 ? null : _ref$options,
75
+ _ref$options_key_valu = _ref.options_key_value,
76
+ options_key_value = _ref$options_key_valu === void 0 ? "value" : _ref$options_key_valu,
77
+ _ref$options_key_text = _ref.options_key_text,
78
+ options_key_text = _ref$options_key_text === void 0 ? "text" : _ref$options_key_text,
79
+ _ref$options_key_subt = _ref.options_key_subtext,
80
+ options_key_subtext = _ref$options_key_subt === void 0 ? "subtext" : _ref$options_key_subt,
81
+ _ref$multiple = _ref.multiple,
82
+ multiple = _ref$multiple === void 0 ? false : _ref$multiple,
83
+ _ref$disabled = _ref.disabled,
84
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
85
+ _ref$value = _ref.value,
86
+ value = _ref$value === void 0 ? null : _ref$value,
87
+ _ref$decimalCount = _ref.decimalCount,
88
+ decimalCount = _ref$decimalCount === void 0 ? 2 : _ref$decimalCount,
89
+ _ref$buttonText = _ref.buttonText,
90
+ buttonText = _ref$buttonText === void 0 ? "" : _ref$buttonText,
91
+ _ref$accept = _ref.accept,
92
+ accept = _ref$accept === void 0 ? ".jpg,.jpeg,.png" : _ref$accept,
93
+ _ref$minDate = _ref.minDate,
94
+ minDate = _ref$minDate === void 0 ? null : _ref$minDate,
95
+ _ref$maxDate = _ref.maxDate,
96
+ maxDate = _ref$maxDate === void 0 ? null : _ref$maxDate,
97
+ _ref$style = _ref.style,
98
+ style = _ref$style === void 0 ? null : _ref$style,
99
+ _ref$maxlength = _ref.maxlength,
100
+ maxlength = _ref$maxlength === void 0 ? null : _ref$maxlength,
101
+ _ref$dangerouslySetIn = _ref.dangerouslySetInnerHTML,
102
+ dangerouslySetInnerHTML = _ref$dangerouslySetIn === void 0 ? null : _ref$dangerouslySetIn,
103
+ _ref$uppercase = _ref.uppercase,
104
+ uppercase = _ref$uppercase === void 0 ? false : _ref$uppercase,
105
+ _ref$lowercase = _ref.lowercase,
106
+ lowercase = _ref$lowercase === void 0 ? false : _ref$lowercase,
107
+ _ref$firstUppercase = _ref.firstUppercase,
108
+ firstUppercase = _ref$firstUppercase === void 0 ? false : _ref$firstUppercase,
109
+ _ref$onChange = _ref.onChange,
110
+ onChange = _ref$onChange === void 0 ? null : _ref$onChange,
111
+ _ref$onBlur = _ref.onBlur,
112
+ onBlur = _ref$onBlur === void 0 ? null : _ref$onBlur,
113
+ _ref$onFocus = _ref.onFocus,
114
+ onFocus = _ref$onFocus === void 0 ? null : _ref$onFocus,
115
+ _ref$onKeyDown = _ref.onKeyDown,
116
+ onKeyDown = _ref$onKeyDown === void 0 ? null : _ref$onKeyDown,
117
+ _ref$onKeyUp = _ref.onKeyUp,
118
+ onKeyUp = _ref$onKeyUp === void 0 ? null : _ref$onKeyUp,
119
+ _ref$onKeyPress = _ref.onKeyPress,
120
+ onKeyPress = _ref$onKeyPress === void 0 ? null : _ref$onKeyPress,
121
+ _ref$onMouseDown = _ref.onMouseDown,
122
+ onMouseDown = _ref$onMouseDown === void 0 ? null : _ref$onMouseDown,
123
+ _ref$onMouseUp = _ref.onMouseUp,
124
+ onMouseUp = _ref$onMouseUp === void 0 ? null : _ref$onMouseUp,
125
+ _ref$onMouseEnter = _ref.onMouseEnter,
126
+ onMouseEnter = _ref$onMouseEnter === void 0 ? null : _ref$onMouseEnter,
127
+ _ref$onMouseLeave = _ref.onMouseLeave,
128
+ onMouseLeave = _ref$onMouseLeave === void 0 ? null : _ref$onMouseLeave,
129
+ _ref$onRemoveImage = _ref.onRemoveImage,
130
+ onRemoveImage = _ref$onRemoveImage === void 0 ? null : _ref$onRemoveImage;
131
+ var myInputId = "key".concat(Date.now() + Math.random().toString(36).substr(2, 9));
132
+ var fileInputRef = (0, _react.useRef)(null);
133
+ var _useState = (0, _react.useState)(false),
134
+ _useState2 = _slicedToArray(_useState, 2),
135
+ loaded = _useState2[0],
136
+ setLoaded = _useState2[1];
137
+ var _useState3 = (0, _react.useState)(value),
138
+ _useState4 = _slicedToArray(_useState3, 2),
139
+ myValue = _useState4[0],
140
+ setMyValue = _useState4[1];
141
+ var _useState5 = (0, _react.useState)(false),
142
+ _useState6 = _slicedToArray(_useState5, 2),
143
+ myEyeView = _useState6[0],
144
+ setMyEyeView = _useState6[1];
145
+ var _useState7 = (0, _react.useState)(null),
146
+ _useState8 = _slicedToArray(_useState7, 2),
147
+ myFileName = _useState8[0],
148
+ setMyFileName = _useState8[1];
149
+ var _useState9 = (0, _react.useState)(""),
150
+ _useState10 = _slicedToArray(_useState9, 2),
151
+ myTitleLite = _useState10[0],
152
+ setMyTitleLite = _useState10[1];
153
+ var _useState11 = (0, _react.useState)(""),
154
+ _useState12 = _slicedToArray(_useState11, 2),
155
+ filtertext = _useState12[0],
156
+ setFiltertext = _useState12[1];
157
+ var _useState13 = (0, _react.useState)(false),
158
+ _useState14 = _slicedToArray(_useState13, 2),
159
+ isError = _useState14[0],
160
+ setIsError = _useState14[1];
161
+ var toBase64 = function toBase64(file) {
162
+ return new Promise(function (resolve, reject) {
163
+ var reader = new FileReader();
164
+ reader.readAsDataURL(file);
165
+ reader.onload = function () {
166
+ return resolve(reader.result);
167
+ };
168
+ reader.onerror = reject;
169
+ });
170
+ };
171
+ var calculateFileSize = function calculateFileSize(sizeInBytes) {
172
+ var units = ['B', 'KB', 'MB'];
173
+ var size = sizeInBytes;
174
+ var unitIndex = 0;
88
175
  while (size >= 1024 && unitIndex < units.length - 1) {
89
176
  size /= 1024;
90
177
  unitIndex++;
91
178
  }
92
- return `${size.toFixed(2)} ${units[unitIndex]}`;
179
+ return "".concat(size.toFixed(2), " ").concat(units[unitIndex]);
93
180
  };
94
- const moneyFormat = _value => {
95
- let money = '';
96
- let inputValue = _value;
181
+ var moneyFormat = function moneyFormat(_value) {
182
+ var money = '';
183
+ var inputValue = _value;
97
184
  if (inputValue == null || inputValue == undefined || inputValue == '') return money;
98
185
  try {
99
186
  inputValue = inputValue.toString();
100
187
  // Tüm virgülleri kaldır ve son girilen karakteri kontrol et
101
188
  money = inputValue.replace(/,/g, '');
102
- const lastChar = inputValue.slice(-1);
189
+ var lastChar = inputValue.slice(-1);
103
190
  if (lastChar === ',') {
104
191
  money = money + '.';
105
192
  }
@@ -108,7 +195,7 @@ function MyInput({
108
195
  money = money.replace(/[^0-9.]/g, '');
109
196
 
110
197
  // Birden fazla nokta varsa ilkini koru
111
- const parts = money.split('.');
198
+ var parts = money.split('.');
112
199
  if (parts.length > 2) {
113
200
  money = parts[0] + '.' + parts[1];
114
201
  }
@@ -120,14 +207,14 @@ function MyInput({
120
207
 
121
208
  // Binlik ayracı için formatlama
122
209
  if (money) {
123
- const numParts = money.split('.');
124
- if (numParts[0]) {
210
+ var _numParts = money.split('.');
211
+ if (_numParts[0]) {
125
212
  // Sayıyı önce tam sayıya çevir, sonra binlik ayracı ekle
126
- numParts[0] = parseInt(numParts[0], 10).toLocaleString('en-US');
213
+ _numParts[0] = parseInt(_numParts[0], 10).toLocaleString('en-US');
127
214
  }
128
- money = numParts.join('.');
215
+ money = _numParts.join('.');
129
216
  }
130
- const numParts = money.split('.');
217
+ var numParts = money.split('.');
131
218
  if (numParts[0]) {
132
219
  numParts[0] = numParts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
133
220
  }
@@ -139,7 +226,7 @@ function MyInput({
139
226
  }
140
227
  return money;
141
228
  };
142
- const onMyBlur = e => {
229
+ var onMyBlur = function onMyBlur(e) {
143
230
  setIsError(false);
144
231
  if (myValue != null && myValue != "") {
145
232
  switch (type) {
@@ -159,111 +246,147 @@ function MyInput({
159
246
  }
160
247
  if (onBlur != null) onBlur(e);
161
248
  };
162
- const onMyFocus = e => {
249
+ var onMyFocus = function onMyFocus(e) {
163
250
  if (onFocus != null) onFocus(e);
164
251
  };
165
- const onMyKeyDown = e => {
252
+ var onMyKeyDown = function onMyKeyDown(e) {
166
253
  if (onKeyDown != null) onKeyDown(e);
167
254
  };
168
- const onMyKeyUp = e => {
255
+ var onMyKeyUp = function onMyKeyUp(e) {
169
256
  if (onKeyUp != null) onKeyUp(e);
170
257
  };
171
- const onMyKeyPress = e => {
258
+ var onMyKeyPress = function onMyKeyPress(e) {
172
259
  if (onKeyPress != null) onKeyPress(e);
173
260
  };
174
- const onMyMouseDown = e => {
261
+ var onMyMouseDown = function onMyMouseDown(e) {
175
262
  if (onMouseDown != null) onMouseDown(e);
176
263
  };
177
- const onMyMouseUp = e => {
264
+ var onMyMouseUp = function onMyMouseUp(e) {
178
265
  if (onMouseUp != null) onMouseUp(e);
179
266
  };
180
- const onMyMouseEnter = e => {
267
+ var onMyMouseEnter = function onMyMouseEnter(e) {
181
268
  if (onMouseEnter != null) onMouseEnter(e);
182
269
  };
183
- const onMyMouseLeave = e => {
270
+ var onMyMouseLeave = function onMyMouseLeave(e) {
184
271
  if (onMouseLeave != null) onMouseLeave(e);
185
272
  };
186
- const onRemoveImageClick = e => {
273
+ var onRemoveImageClick = function onRemoveImageClick(e) {
187
274
  if (onRemoveImage != null) onRemoveImage();
188
275
  };
189
- const onMyChange = async e => {
190
- switch (type) {
191
- case MyInputType.FILE:
192
- case MyInputType.IMAGE:
193
- let files = [];
194
- if (e.target.files.length > 0) {
195
- let totalSize = 0;
196
- for (let i = 0; i < e.target.files.length; i++) {
197
- const file = e.target.files[i];
276
+ var onMyChange = /*#__PURE__*/function () {
277
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
278
+ var files, totalSize, i, file, number, numberParts, money, selectedDate;
279
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
280
+ while (1) switch (_context.prev = _context.next) {
281
+ case 0:
282
+ _context.t0 = type;
283
+ _context.next = _context.t0 === MyInputType.FILE ? 3 : _context.t0 === MyInputType.IMAGE ? 3 : _context.t0 === MyInputType.NUMBER ? 29 : _context.t0 === MyInputType.MONEY ? 34 : _context.t0 === MyInputType.DATE ? 37 : _context.t0 === MyInputType.DATETIME ? 37 : _context.t0 === MyInputType.TIME ? 37 : 40;
284
+ break;
285
+ case 3:
286
+ files = [];
287
+ if (!(e.target.files.length > 0)) {
288
+ _context.next = 26;
289
+ break;
290
+ }
291
+ totalSize = 0;
292
+ i = 0;
293
+ case 7:
294
+ if (!(i < e.target.files.length)) {
295
+ _context.next = 22;
296
+ break;
297
+ }
298
+ file = e.target.files[i];
198
299
  totalSize += parseInt(file.size);
199
- files.push({
200
- // file: file,
201
- base64: await toBase64(file),
202
- filename: file.name,
203
- size: file.size,
204
- sizeText: calculateFileSize(file.size)
205
- });
206
- } //for
207
-
208
- totalSize = calculateFileSize(totalSize);
209
- setMyFileName(`<span>${files.length == 1 ? files[0].filename : files.length + " Dosya Seçildi"}</span>
210
- <small>(${totalSize})</small>`);
211
- } else {
212
- setMyFileName("");
213
- }
214
- setMyValue(files);
215
- break;
216
- case MyInputType.NUMBER:
217
- let number = e.target.value.replace(/[^0-9.]/g, '');
300
+ _context.t1 = files;
301
+ _context.next = 13;
302
+ return toBase64(file);
303
+ case 13:
304
+ _context.t2 = _context.sent;
305
+ _context.t3 = file.name;
306
+ _context.t4 = file.size;
307
+ _context.t5 = calculateFileSize(file.size);
308
+ _context.t6 = {
309
+ base64: _context.t2,
310
+ filename: _context.t3,
311
+ size: _context.t4,
312
+ sizeText: _context.t5
313
+ };
314
+ _context.t1.push.call(_context.t1, _context.t6);
315
+ case 19:
316
+ i++;
317
+ _context.next = 7;
318
+ break;
319
+ case 22:
320
+ //for
218
321
 
219
- // Birden fazla nokta varsa ilkini koru
220
- const numberParts = number.split('.');
221
- if (numberParts.length > 2) {
222
- number = numberParts[0] + '.' + numberParts[1];
322
+ totalSize = calculateFileSize(totalSize);
323
+ setMyFileName("<span>".concat(files.length == 1 ? files[0].filename : files.length + " Dosya Seçildi", "</span>\n <small>(").concat(totalSize, ")</small>"));
324
+ _context.next = 27;
325
+ break;
326
+ case 26:
327
+ setMyFileName("");
328
+ case 27:
329
+ setMyValue(files);
330
+ return _context.abrupt("break", 42);
331
+ case 29:
332
+ number = e.target.value.replace(/[^0-9.]/g, ''); // Birden fazla nokta varsa ilkini koru
333
+ numberParts = number.split('.');
334
+ if (numberParts.length > 2) {
335
+ number = numberParts[0] + '.' + numberParts[1];
336
+ }
337
+ setMyValue(number);
338
+ return _context.abrupt("break", 42);
339
+ case 34:
340
+ money = moneyFormat(e.target.value);
341
+ setMyValue(money);
342
+ return _context.abrupt("break", 42);
343
+ case 37:
344
+ selectedDate = e.target.value;
345
+ setMyValue(selectedDate);
346
+ return _context.abrupt("break", 42);
347
+ case 40:
348
+ if (uppercase) setMyValue(e.target.value.toLocaleUpperCase("TR"));else if (lowercase) setMyValue(e.target.value.toLocaleLowerCase("TR"));else if (firstUppercase) setMyValue(e.target.value.split(' ').map(function (word) {
349
+ return word.charAt(0).toLocaleUpperCase("TR") + word.slice(1).toLocaleLowerCase("TR");
350
+ }).join(' '));else setMyValue(e.target.value);
351
+ return _context.abrupt("break", 42);
352
+ case 42:
353
+ case "end":
354
+ return _context.stop();
223
355
  }
224
- setMyValue(number);
225
- break;
226
- case MyInputType.MONEY:
227
- let money = moneyFormat(e.target.value);
228
- setMyValue(money);
229
- break;
230
- case MyInputType.DATE:
231
- case MyInputType.DATETIME:
232
- case MyInputType.TIME:
233
- const selectedDate = e.target.value;
234
- setMyValue(selectedDate);
235
- break;
236
- default:
237
- if (uppercase) setMyValue(e.target.value.toLocaleUpperCase("TR"));else if (lowercase) setMyValue(e.target.value.toLocaleLowerCase("TR"));else if (firstUppercase) setMyValue(e.target.value.split(' ').map(word => word.charAt(0).toLocaleUpperCase("TR") + word.slice(1).toLocaleLowerCase("TR")).join(' '));else setMyValue(e.target.value);
238
- break;
239
- }
240
- };
241
- const mySelectFilterListClick = item => {
242
- const selectElement = document.getElementById("mySelectFilterHiddenSelect" + myInputId);
356
+ }, _callee);
357
+ }));
358
+ return function onMyChange(_x) {
359
+ return _ref2.apply(this, arguments);
360
+ };
361
+ }();
362
+ var mySelectFilterListClick = function mySelectFilterListClick(item) {
363
+ var selectElement = document.getElementById("mySelectFilterHiddenSelect" + myInputId);
243
364
  selectElement.value = item.value;
244
365
  setMyValue(item.value);
245
366
  setFiltertext("");
246
367
  };
247
- const getMyValueText = () => {
368
+ var getMyValueText = function getMyValueText() {
248
369
  if (!myValue || myValue == 0) return "";
249
370
  if (!MyInputIsNumeric(myValue) || options == null) return myValue;
250
- let result = options.find(e => e.value.toString() == myValue.toString());
251
- if (result) return result.text + (result[options_key_subtext] ? ` - <span style="color: #73889d; font-style: italic; font-weight: 300;">${result[options_key_subtext]}</span>` : '');
371
+ var result = options.find(function (e) {
372
+ return e.value.toString() == myValue.toString();
373
+ });
374
+ if (result) return result.text + (result[options_key_subtext] ? " - <span style=\"color: #73889d; font-style: italic; font-weight: 300;\">".concat(result[options_key_subtext], "</span>") : '');
252
375
  return "";
253
376
  };
254
- const filterSelectEvents = () => {
255
- const selectElement = document.getElementById("mySelectFilterSelected" + (id ? id : myInputId));
256
- const selectListElement = document.getElementById("mySelectFilterList" + (id ? id : myInputId));
257
- const filterInput = document.getElementById("mySelectFilterInput" + (id ? id : myInputId));
377
+ var filterSelectEvents = function filterSelectEvents() {
378
+ var selectElement = document.getElementById("mySelectFilterSelected" + (id ? id : myInputId));
379
+ var selectListElement = document.getElementById("mySelectFilterList" + (id ? id : myInputId));
380
+ var filterInput = document.getElementById("mySelectFilterInput" + (id ? id : myInputId));
258
381
  if (!selectElement || !selectListElement || !filterInput) return;
259
- let isInputFocused = false;
382
+ var isInputFocused = false;
260
383
 
261
384
  // Select'e tıklandığında seçim listesini aç
262
385
  selectElement.addEventListener('click', function () {
263
386
  if (!isInputFocused) {
264
387
  filterInput.style.display = 'block';
265
388
  selectListElement.style.display = 'block';
266
- setTimeout(() => {
389
+ setTimeout(function () {
267
390
  filterInput.focus();
268
391
  }, 100); // Gecikme, select listesi açılırken input'a odaklanması için
269
392
  }
@@ -277,36 +400,42 @@ function MyInput({
277
400
  // Input odaktan çıktığında ve select'in blur olayında input'u gizle
278
401
  filterInput.addEventListener('blur', function () {
279
402
  isInputFocused = false;
280
- setTimeout(() => {
403
+ setTimeout(function () {
281
404
  setFiltertext("");
282
405
  filterInput.style.display = 'none';
283
406
  selectListElement.style.display = 'none';
284
407
  }, 150); // Gecikme ile select kapanmasını sağla
285
408
  });
286
409
  };
287
- const getFilterOptions = () => {
288
- let rv = options.filter(() => true);
410
+ var getFilterOptions = function getFilterOptions() {
411
+ var rv = options.filter(function () {
412
+ return true;
413
+ });
289
414
  if (filtertext != "") {
290
- rv = rv.filter(e => e.text.toLocaleLowerCase().includes(filtertext.toLocaleLowerCase()));
415
+ rv = rv.filter(function (e) {
416
+ return e.text.toLocaleLowerCase().includes(filtertext.toLocaleLowerCase());
417
+ });
291
418
  }
292
419
  return rv;
293
420
  };
294
- const getFileImageControl = filename => {
421
+ var getFileImageControl = function getFileImageControl(filename) {
295
422
  if (!filename) return false;
296
423
  if (filename.includes(";base64,")) return true;
297
- const validExtensions = ['.jpg', '.jpeg', '.png', '.webp', '.gif'];
298
- return validExtensions.some(ext => filename.toString().toLocaleLowerCase().includes(ext));
424
+ var validExtensions = ['.jpg', '.jpeg', '.png', '.webp', '.gif'];
425
+ return validExtensions.some(function (ext) {
426
+ return filename.toString().toLocaleLowerCase().includes(ext);
427
+ });
299
428
  };
300
- useEffect(() => {
429
+ (0, _react.useEffect)(function () {
301
430
  if (loaded) {
302
- let vl = value;
431
+ var vl = value;
303
432
  if (value == undefined) vl = null;
304
433
  if (vl == null && (type == MyInputType.TEXT || type == MyInputType.MAIL || type == MyInputType.TEXTAREA || type == MyInputType.PASSWORD)) vl = "";
305
434
  // if (vl != myValue) setMyValue(vl);
306
435
  if (vl == null) setMyFileName(null);
307
436
  }
308
437
  }, [value]);
309
- useEffect(() => {
438
+ (0, _react.useEffect)(function () {
310
439
  if (myValue != value && onChange != null) {
311
440
  onChange({
312
441
  value: myValue,
@@ -316,263 +445,297 @@ function MyInput({
316
445
  });
317
446
  }
318
447
  }, [myValue]);
319
- useEffect(() => {
448
+ (0, _react.useEffect)(function () {
320
449
  if (title) {
321
450
  setMyTitleLite(title.replace(/<\/?[^>]+(>|$)/g, ""));
322
451
  }
323
452
  }, [title]);
324
- useEffect(() => {
453
+ (0, _react.useEffect)(function () {
325
454
  setLoaded(true);
326
455
  if (type == MyInputType.SELECTFILTER) filterSelectEvents();
327
456
  if (type == MyInputType.DATE) {
328
- const dateInput = document.getElementById("myDate" + myInputId);
329
- dateInput.addEventListener('click', () => {
457
+ var dateInput = document.getElementById("myDate" + myInputId);
458
+ dateInput.addEventListener('click', function () {
459
+ var _dateInput$showPicker;
330
460
  // Tarih seçiciyi göstermek için odaklanma
331
- dateInput.showPicker?.(); // Eğer destekliyorsa
461
+ (_dateInput$showPicker = dateInput.showPicker) === null || _dateInput$showPicker === void 0 || _dateInput$showPicker.call(dateInput); // Eğer destekliyorsa
332
462
  });
333
463
  }
334
464
  if (type == MyInputType.DATETIME) {
335
- const dateTimeInput = document.getElementById("myDateTime" + myInputId);
336
- dateTimeInput.addEventListener('click', () => {
465
+ var dateTimeInput = document.getElementById("myDateTime" + myInputId);
466
+ dateTimeInput.addEventListener('click', function () {
467
+ var _dateTimeInput$showPi;
337
468
  // Tarih seçiciyi göstermek için odaklanma
338
- dateTimeInput.showPicker?.(); // Eğer destekliyorsa
469
+ (_dateTimeInput$showPi = dateTimeInput.showPicker) === null || _dateTimeInput$showPi === void 0 || _dateTimeInput$showPi.call(dateTimeInput); // Eğer destekliyorsa
339
470
  });
340
471
  }
341
472
  if (type == MyInputType.TIME) {
342
- const timeInput = document.getElementById("myTime" + myInputId);
343
- timeInput.addEventListener('click', () => {
473
+ var timeInput = document.getElementById("myTime" + myInputId);
474
+ timeInput.addEventListener('click', function () {
475
+ var _timeInput$showPicker;
344
476
  // Saat seçiciyi göstermek için odaklanma
345
- timeInput.showPicker?.(); // Eğer destekliyorsa
477
+ (_timeInput$showPicker = timeInput.showPicker) === null || _timeInput$showPicker === void 0 || _timeInput$showPicker.call(timeInput); // Eğer destekliyorsa
346
478
  });
347
479
  }
348
480
  }, []);
349
- const renderInput = () => {
481
+ var renderInput = function renderInput() {
482
+ var _inputTypes, _inputTypes$type;
350
483
  if (disabled || type === MyInputType.READONLY) {
351
- return /*#__PURE__*/React.createElement("span", {
352
- className: styles.disabledInput,
484
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
485
+ className: _MyInputModule["default"].disabledInput,
353
486
  dangerouslySetInnerHTML: dangerouslySetInnerHTML ? dangerouslySetInnerHTML : {
354
487
  __html: getMyValueText()
355
488
  },
356
- style: rows > 0 ? {
357
- ...(style ? style : {}),
489
+ style: rows > 0 ? _objectSpread(_objectSpread({}, style ? style : {}), {}, {
358
490
  height: rows * 30 + 'px',
359
491
  alignItems: "flex-start"
360
- } : style
492
+ }) : style
361
493
  });
362
494
  }
363
- const inputTypes = {
364
- [MyInputType.TEXT]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
365
- ref: ref,
366
- id: id,
367
- type: "text",
368
- value: myValue,
369
- onChange: onMyChange,
370
- placeholder: placeholder || myTitleLite,
371
- autoComplete: "off",
372
- style: style,
373
- maxLength: maxlength,
374
- onBlur: onMyBlur,
375
- onFocus: onMyFocus,
376
- onKeyDown: onMyKeyDown,
377
- onKeyUp: onMyKeyUp,
378
- onKeyPress: onMyKeyPress,
379
- onMouseDown: onMyMouseDown,
380
- onMouseUp: onMyMouseUp,
381
- onMouseEnter: onMyMouseEnter,
382
- onMouseLeave: onMyMouseLeave
383
- })),
384
- [MyInputType.MAIL]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
385
- ref: ref,
386
- id: id,
387
- type: "text",
388
- value: myValue?.toLowerCase(),
389
- onChange: e => onMyChange({
390
- ...e,
391
- target: {
392
- ...e.target,
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({
417
- ...e,
418
- target: {
419
- ...e.target,
420
- value
421
- }
422
- });
423
- },
424
- placeholder: placeholder || myTitleLite,
425
- autoComplete: "off",
426
- style: style,
427
- onBlur: onMyBlur,
428
- onFocus: onMyFocus,
429
- onKeyDown: onMyKeyDown,
430
- onKeyUp: onMyKeyUp,
431
- onKeyPress: onMyKeyPress,
432
- onMouseDown: onMyMouseDown,
433
- onMouseUp: onMyMouseUp,
434
- onMouseEnter: onMyMouseEnter,
435
- onMouseLeave: onMyMouseLeave
436
- })),
437
- [MyInputType.MONEY]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
438
- ref: ref,
439
- id: id,
440
- type: "text",
441
- value: moneyFormat(myValue),
442
- onChange: onMyChange,
443
- placeholder: placeholder || myTitleLite,
444
- autoComplete: "off",
445
- style: style,
446
- onBlur: onMyBlur,
447
- onFocus: onMyFocus,
448
- onKeyDown: onMyKeyDown,
449
- onKeyUp: onMyKeyUp,
450
- onKeyPress: onMyKeyPress,
451
- onMouseDown: onMyMouseDown,
452
- onMouseUp: onMyMouseUp,
453
- onMouseEnter: onMyMouseEnter,
454
- onMouseLeave: onMyMouseLeave
455
- })),
456
- [MyInputType.NUMBER]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
457
- ref: ref,
458
- id: id,
459
- type: "number",
460
- value: myValue,
461
- onChange: onMyChange,
462
- placeholder: placeholder || myTitleLite,
463
- autoComplete: "off",
464
- style: style,
465
- onBlur: onMyBlur,
466
- onFocus: onMyFocus,
467
- onKeyDown: onMyKeyDown,
468
- onKeyUp: onMyKeyUp,
469
- onKeyPress: onMyKeyPress,
470
- onMouseDown: onMyMouseDown,
471
- onMouseUp: onMyMouseUp,
472
- onMouseEnter: onMyMouseEnter,
473
- onMouseLeave: onMyMouseLeave
474
- })),
475
- [MyInputType.DATE]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
476
- ref: ref,
477
- type: "date",
478
- id: "myDate" + myInputId,
479
- value: myValue || '',
480
- onChange: onMyChange,
481
- placeholder: placeholder || myTitleLite,
482
- min: minDate,
483
- max: maxDate,
484
- style: style,
485
- onBlur: onMyBlur,
486
- onFocus: onMyFocus,
487
- onKeyDown: onMyKeyDown,
488
- onKeyUp: onMyKeyUp,
489
- onKeyPress: onMyKeyPress,
490
- onMouseDown: onMyMouseDown,
491
- onMouseUp: onMyMouseUp,
492
- onMouseEnter: onMyMouseEnter,
493
- onMouseLeave: onMyMouseLeave
494
- })),
495
- [MyInputType.DATETIME]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
496
- ref: ref,
497
- type: "datetime-local",
498
- id: "myDateTime" + myInputId,
499
- value: myValue || '',
500
- onChange: onMyChange,
501
- placeholder: placeholder || myTitleLite,
502
- min: minDate,
503
- max: maxDate,
504
- style: style,
505
- onBlur: onMyBlur,
506
- onFocus: onMyFocus,
507
- onKeyDown: onMyKeyDown,
508
- onKeyUp: onMyKeyUp,
509
- onKeyPress: onMyKeyPress,
510
- onMouseDown: onMyMouseDown,
511
- onMouseUp: onMyMouseUp,
512
- onMouseEnter: onMyMouseEnter,
513
- onMouseLeave: onMyMouseLeave
514
- })),
515
- [MyInputType.TIME]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
516
- ref: ref,
517
- type: "time",
518
- id: "myTime" + myInputId,
519
- value: myValue || '',
520
- onChange: onMyChange,
521
- placeholder: placeholder || myTitleLite,
522
- style: style,
523
- onBlur: onMyBlur,
524
- onFocus: onMyFocus,
525
- onKeyDown: onMyKeyDown,
526
- onKeyUp: onMyKeyUp,
527
- onKeyPress: onMyKeyPress,
528
- onMouseDown: onMyMouseDown,
529
- onMouseUp: onMyMouseUp,
530
- onMouseEnter: onMyMouseEnter,
531
- onMouseLeave: onMyMouseLeave
532
- })),
533
- [MyInputType.PASSWORD]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
534
- ref: ref,
535
- id: id,
536
- type: myEyeView ? "text" : "password",
537
- value: myValue,
538
- onChange: onMyChange,
539
- placeholder: placeholder || myTitleLite,
540
- autoComplete: "new-password",
541
- style: style,
542
- maxLength: maxlength,
543
- onBlur: onMyBlur,
544
- onFocus: onMyFocus,
545
- onKeyDown: onMyKeyDown,
546
- onKeyUp: onMyKeyUp,
547
- onKeyPress: onMyKeyPress,
548
- onMouseDown: onMyMouseDown,
549
- onMouseUp: onMyMouseUp,
550
- onMouseEnter: onMyMouseEnter,
551
- onMouseLeave: onMyMouseLeave
552
- }), /*#__PURE__*/React.createElement("button", {
553
- type: "button",
554
- className: styles.eye,
555
- onClick: () => setMyEyeView(!myEyeView)
556
- }, myEyeView ? /*#__PURE__*/React.createElement(PiEyeSlash, null) : /*#__PURE__*/React.createElement(PiEye, null))),
557
- [MyInputType.COLOR]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
558
- ref: ref,
559
- id: id,
560
- type: "color",
561
- value: myValue,
562
- onChange: onMyChange,
563
- placeholder: placeholder || myTitleLite,
564
- style: style,
565
- onBlur: onMyBlur,
566
- onFocus: onMyFocus,
567
- onKeyDown: onMyKeyDown,
568
- onKeyUp: onMyKeyUp,
569
- onKeyPress: onMyKeyPress,
570
- onMouseDown: onMyMouseDown,
571
- onMouseUp: onMyMouseUp,
572
- onMouseEnter: onMyMouseEnter,
573
- onMouseLeave: onMyMouseLeave
574
- })),
575
- [MyInputType.TEXTAREA]: () => /*#__PURE__*/React.createElement("textarea", {
495
+ var inputTypes = (_inputTypes = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_inputTypes, MyInputType.TEXT, function () {
496
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
497
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
498
+ ref: ref,
499
+ id: id,
500
+ type: "text",
501
+ value: myValue,
502
+ onChange: onMyChange,
503
+ placeholder: placeholder || myTitleLite,
504
+ autoComplete: "off",
505
+ style: style,
506
+ maxLength: maxlength,
507
+ onBlur: onMyBlur,
508
+ onFocus: onMyFocus,
509
+ onKeyDown: onMyKeyDown,
510
+ onKeyUp: onMyKeyUp,
511
+ onKeyPress: onMyKeyPress,
512
+ onMouseDown: onMyMouseDown,
513
+ onMouseUp: onMyMouseUp,
514
+ onMouseEnter: onMyMouseEnter,
515
+ onMouseLeave: onMyMouseLeave
516
+ })
517
+ });
518
+ }), MyInputType.MAIL, function () {
519
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
520
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
521
+ ref: ref,
522
+ id: id,
523
+ type: "text",
524
+ value: myValue === null || myValue === void 0 ? void 0 : myValue.toLowerCase(),
525
+ onChange: function onChange(e) {
526
+ return onMyChange(_objectSpread(_objectSpread({}, e), {}, {
527
+ target: _objectSpread(_objectSpread({}, e.target), {}, {
528
+ value: e.target.value.toLowerCase().replace(/\s/g, '')
529
+ })
530
+ }));
531
+ },
532
+ placeholder: placeholder || myTitleLite,
533
+ autoComplete: "off",
534
+ style: style,
535
+ onBlur: onMyBlur,
536
+ onFocus: onMyFocus,
537
+ onKeyDown: onMyKeyDown,
538
+ onKeyUp: onMyKeyUp,
539
+ onKeyPress: onMyKeyPress,
540
+ onMouseDown: onMyMouseDown,
541
+ onMouseUp: onMyMouseUp,
542
+ onMouseEnter: onMyMouseEnter,
543
+ onMouseLeave: onMyMouseLeave
544
+ })
545
+ });
546
+ }), MyInputType.PHONE, function () {
547
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
548
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
549
+ ref: ref,
550
+ id: id,
551
+ type: "text",
552
+ value: myValue,
553
+ onChange: function onChange(e) {
554
+ var value = e.target.value.replace(/[^0-9()-]/g, '');
555
+ onMyChange(_objectSpread(_objectSpread({}, e), {}, {
556
+ target: _objectSpread(_objectSpread({}, e.target), {}, {
557
+ value: value
558
+ })
559
+ }));
560
+ },
561
+ placeholder: placeholder || myTitleLite,
562
+ autoComplete: "off",
563
+ style: style,
564
+ onBlur: onMyBlur,
565
+ onFocus: onMyFocus,
566
+ onKeyDown: onMyKeyDown,
567
+ onKeyUp: onMyKeyUp,
568
+ onKeyPress: onMyKeyPress,
569
+ onMouseDown: onMyMouseDown,
570
+ onMouseUp: onMyMouseUp,
571
+ onMouseEnter: onMyMouseEnter,
572
+ onMouseLeave: onMyMouseLeave
573
+ })
574
+ });
575
+ }), MyInputType.MONEY, function () {
576
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
577
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
578
+ ref: ref,
579
+ id: id,
580
+ type: "text",
581
+ value: moneyFormat(myValue),
582
+ onChange: onMyChange,
583
+ placeholder: placeholder || myTitleLite,
584
+ autoComplete: "off",
585
+ style: style,
586
+ onBlur: onMyBlur,
587
+ onFocus: onMyFocus,
588
+ onKeyDown: onMyKeyDown,
589
+ onKeyUp: onMyKeyUp,
590
+ onKeyPress: onMyKeyPress,
591
+ onMouseDown: onMyMouseDown,
592
+ onMouseUp: onMyMouseUp,
593
+ onMouseEnter: onMyMouseEnter,
594
+ onMouseLeave: onMyMouseLeave
595
+ })
596
+ });
597
+ }), MyInputType.NUMBER, function () {
598
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
599
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
600
+ ref: ref,
601
+ id: id,
602
+ type: "number",
603
+ value: myValue,
604
+ onChange: onMyChange,
605
+ placeholder: placeholder || myTitleLite,
606
+ autoComplete: "off",
607
+ style: style,
608
+ onBlur: onMyBlur,
609
+ onFocus: onMyFocus,
610
+ onKeyDown: onMyKeyDown,
611
+ onKeyUp: onMyKeyUp,
612
+ onKeyPress: onMyKeyPress,
613
+ onMouseDown: onMyMouseDown,
614
+ onMouseUp: onMyMouseUp,
615
+ onMouseEnter: onMyMouseEnter,
616
+ onMouseLeave: onMyMouseLeave
617
+ })
618
+ });
619
+ }), MyInputType.DATE, function () {
620
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
621
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
622
+ ref: ref,
623
+ type: "date",
624
+ id: "myDate" + myInputId,
625
+ value: myValue || '',
626
+ onChange: onMyChange,
627
+ placeholder: placeholder || myTitleLite,
628
+ min: minDate,
629
+ max: maxDate,
630
+ style: style,
631
+ onBlur: onMyBlur,
632
+ onFocus: onMyFocus,
633
+ onKeyDown: onMyKeyDown,
634
+ onKeyUp: onMyKeyUp,
635
+ onKeyPress: onMyKeyPress,
636
+ onMouseDown: onMyMouseDown,
637
+ onMouseUp: onMyMouseUp,
638
+ onMouseEnter: onMyMouseEnter,
639
+ onMouseLeave: onMyMouseLeave
640
+ })
641
+ });
642
+ }), MyInputType.DATETIME, function () {
643
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
644
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
645
+ ref: ref,
646
+ type: "datetime-local",
647
+ id: "myDateTime" + myInputId,
648
+ value: myValue || '',
649
+ onChange: onMyChange,
650
+ placeholder: placeholder || myTitleLite,
651
+ min: minDate,
652
+ max: maxDate,
653
+ style: style,
654
+ onBlur: onMyBlur,
655
+ onFocus: onMyFocus,
656
+ onKeyDown: onMyKeyDown,
657
+ onKeyUp: onMyKeyUp,
658
+ onKeyPress: onMyKeyPress,
659
+ onMouseDown: onMyMouseDown,
660
+ onMouseUp: onMyMouseUp,
661
+ onMouseEnter: onMyMouseEnter,
662
+ onMouseLeave: onMyMouseLeave
663
+ })
664
+ });
665
+ }), MyInputType.TIME, function () {
666
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
667
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
668
+ ref: ref,
669
+ type: "time",
670
+ id: "myTime" + myInputId,
671
+ value: myValue || '',
672
+ onChange: onMyChange,
673
+ placeholder: placeholder || myTitleLite,
674
+ style: style,
675
+ onBlur: onMyBlur,
676
+ onFocus: onMyFocus,
677
+ onKeyDown: onMyKeyDown,
678
+ onKeyUp: onMyKeyUp,
679
+ onKeyPress: onMyKeyPress,
680
+ onMouseDown: onMyMouseDown,
681
+ onMouseUp: onMyMouseUp,
682
+ onMouseEnter: onMyMouseEnter,
683
+ onMouseLeave: onMyMouseLeave
684
+ })
685
+ });
686
+ }), MyInputType.PASSWORD, function () {
687
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
688
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
689
+ ref: ref,
690
+ id: id,
691
+ type: myEyeView ? "text" : "password",
692
+ value: myValue,
693
+ onChange: onMyChange,
694
+ placeholder: placeholder || myTitleLite,
695
+ autoComplete: "new-password",
696
+ style: style,
697
+ maxLength: maxlength,
698
+ onBlur: onMyBlur,
699
+ onFocus: onMyFocus,
700
+ onKeyDown: onMyKeyDown,
701
+ onKeyUp: onMyKeyUp,
702
+ onKeyPress: onMyKeyPress,
703
+ onMouseDown: onMyMouseDown,
704
+ onMouseUp: onMyMouseUp,
705
+ onMouseEnter: onMyMouseEnter,
706
+ onMouseLeave: onMyMouseLeave
707
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
708
+ type: "button",
709
+ className: _MyInputModule["default"].eye,
710
+ onClick: function onClick() {
711
+ return setMyEyeView(!myEyeView);
712
+ },
713
+ children: myEyeView ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiEyeSlash, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiEye, {})
714
+ })]
715
+ });
716
+ }), MyInputType.COLOR, function () {
717
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
718
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
719
+ ref: ref,
720
+ id: id,
721
+ type: "color",
722
+ value: myValue,
723
+ onChange: onMyChange,
724
+ placeholder: placeholder || myTitleLite,
725
+ style: style,
726
+ onBlur: onMyBlur,
727
+ onFocus: onMyFocus,
728
+ onKeyDown: onMyKeyDown,
729
+ onKeyUp: onMyKeyUp,
730
+ onKeyPress: onMyKeyPress,
731
+ onMouseDown: onMyMouseDown,
732
+ onMouseUp: onMyMouseUp,
733
+ onMouseEnter: onMyMouseEnter,
734
+ onMouseLeave: onMyMouseLeave
735
+ })
736
+ });
737
+ }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_inputTypes, MyInputType.TEXTAREA, function () {
738
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
576
739
  ref: ref,
577
740
  id: id,
578
741
  onChange: onMyChange,
@@ -590,176 +753,210 @@ function MyInput({
590
753
  onMouseUp: onMyMouseUp,
591
754
  onMouseEnter: onMyMouseEnter,
592
755
  onMouseLeave: onMyMouseLeave
593
- }),
594
- [MyInputType.SELECT]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("select", {
595
- ref: ref,
596
- id: id,
597
- onChange: e => onMyChange(e),
598
- value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
599
- style: style,
600
- onBlur: onMyBlur,
601
- onFocus: onMyFocus,
602
- onKeyDown: onMyKeyDown,
603
- onKeyUp: onMyKeyUp,
604
- onKeyPress: onMyKeyPress,
605
- onMouseDown: onMyMouseDown,
606
- onMouseUp: onMyMouseUp,
607
- onMouseEnter: onMyMouseEnter,
608
- onMouseLeave: onMyMouseLeave
609
- }, options && options.map(e => {
610
- return /*#__PURE__*/React.createElement("option", {
611
- key: e[options_key_value],
612
- value: MyInputIsNumeric(e[options_key_value]) ? parseInt(e[options_key_value]) : e[options_key_value]
613
- }, e[options_key_text] || e["label"]);
614
- })), !myValue && !options && (placeholder || myTitleLite) && /*#__PURE__*/React.createElement("span", {
615
- className: styles.placeholder
616
- }, placeholder ? placeholder : myTitleLite)),
617
- [MyInputType.SELECTFILTER]: () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
618
- ref: ref,
619
- id: "mySelectFilterInput" + (id ? id : myInputId),
620
- type: "text",
621
- className: styles.filterInput,
622
- style: style,
623
- value: filtertext,
624
- onChange: e => setFiltertext(e.target.value),
625
- placeholder: placeholdersearchtext && placeholdersearchtext != "" ? placeholdersearchtext : (placeholder ? placeholder : myTitleLite) + " ...",
626
- onBlur: onMyBlur,
627
- onFocus: onMyFocus,
628
- onKeyDown: onMyKeyDown,
629
- onKeyUp: onMyKeyUp,
630
- onKeyPress: onMyKeyPress,
631
- onMouseDown: onMyMouseDown,
632
- onMouseUp: onMyMouseUp,
633
- onMouseEnter: onMyMouseEnter,
634
- onMouseLeave: onMyMouseLeave
635
- }), /*#__PURE__*/React.createElement("div", {
636
- className: styles.filterInputSelectedContainer + " " + (myValue ? styles.filterInputSelectedContainerSelected : '')
637
- }, /*#__PURE__*/React.createElement("span", {
638
- id: "mySelectFilterSelected" + (id ? id : myInputId),
639
- className: styles.filterInputSelected,
640
- dangerouslySetInnerHTML: {
641
- __html: getMyValueText()
642
- }
643
- }), myValue && /*#__PURE__*/React.createElement("span", {
644
- className: styles.filterInputSelectedX,
645
- onClick: () => setMyValue(null),
646
- title: t("Seçimi Kaldır")
647
- }, "x") || "", /*#__PURE__*/React.createElement(PiCaretDownBold, {
648
- className: styles.caretdown
649
- })), !myValue && (placeholder || myTitleLite) && /*#__PURE__*/React.createElement("span", {
650
- className: styles.placeholder
651
- }, placeholder ? placeholder : myTitleLite), /*#__PURE__*/React.createElement("ul", {
652
- id: "mySelectFilterList" + (id ? id : myInputId),
653
- className: styles.filterInputList
654
- }, options && getFilterOptions().map(item => {
655
- return /*#__PURE__*/React.createElement("li", {
656
- key: item[options_key_value],
657
- value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
658
- onClick: () => mySelectFilterListClick(item),
659
- className: item[options_key_subtext] ? styles.subtextli : ''
660
- }, /*#__PURE__*/React.createElement("span", {
756
+ });
757
+ }), MyInputType.SELECT, function () {
758
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
759
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("select", {
760
+ ref: ref,
761
+ id: id,
762
+ onChange: function onChange(e) {
763
+ return onMyChange(e);
764
+ },
765
+ value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
766
+ style: style,
767
+ onBlur: onMyBlur,
768
+ onFocus: onMyFocus,
769
+ onKeyDown: onMyKeyDown,
770
+ onKeyUp: onMyKeyUp,
771
+ onKeyPress: onMyKeyPress,
772
+ onMouseDown: onMyMouseDown,
773
+ onMouseUp: onMyMouseUp,
774
+ onMouseEnter: onMyMouseEnter,
775
+ onMouseLeave: onMyMouseLeave,
776
+ children: options && options.map(function (e) {
777
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
778
+ value: MyInputIsNumeric(e[options_key_value]) ? parseInt(e[options_key_value]) : e[options_key_value],
779
+ children: e[options_key_text] || e["label"]
780
+ }, e[options_key_value]);
781
+ })
782
+ }), !myValue && !options && (placeholder || myTitleLite) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
783
+ className: _MyInputModule["default"].placeholder,
784
+ children: placeholder ? placeholder : myTitleLite
785
+ })]
786
+ });
787
+ }), MyInputType.SELECTFILTER, function () {
788
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
789
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
790
+ ref: ref,
791
+ id: "mySelectFilterInput" + (id ? id : myInputId),
792
+ type: "text",
793
+ className: _MyInputModule["default"].filterInput,
794
+ style: style,
795
+ value: filtertext,
796
+ onChange: function onChange(e) {
797
+ return setFiltertext(e.target.value);
798
+ },
799
+ placeholder: placeholdersearchtext && placeholdersearchtext != "" ? placeholdersearchtext : (placeholder ? placeholder : myTitleLite) + " ...",
800
+ onBlur: onMyBlur,
801
+ onFocus: onMyFocus,
802
+ onKeyDown: onMyKeyDown,
803
+ onKeyUp: onMyKeyUp,
804
+ onKeyPress: onMyKeyPress,
805
+ onMouseDown: onMyMouseDown,
806
+ onMouseUp: onMyMouseUp,
807
+ onMouseEnter: onMyMouseEnter,
808
+ onMouseLeave: onMyMouseLeave
809
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
810
+ className: _MyInputModule["default"].filterInputSelectedContainer + " " + (myValue ? _MyInputModule["default"].filterInputSelectedContainerSelected : ''),
811
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
812
+ id: "mySelectFilterSelected" + (id ? id : myInputId),
813
+ className: _MyInputModule["default"].filterInputSelected,
814
+ dangerouslySetInnerHTML: {
815
+ __html: getMyValueText()
816
+ }
817
+ }), myValue && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
818
+ className: _MyInputModule["default"].filterInputSelectedX,
819
+ onClick: function onClick() {
820
+ return setMyValue(null);
821
+ },
822
+ title: t("Seçimi Kaldır"),
823
+ children: "x"
824
+ }) || "", /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiCaretDownBold, {
825
+ className: _MyInputModule["default"].caretdown
826
+ })]
827
+ }), !myValue && (placeholder || myTitleLite) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
828
+ className: _MyInputModule["default"].placeholder,
829
+ children: placeholder ? placeholder : myTitleLite
830
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
831
+ id: "mySelectFilterList" + (id ? id : myInputId),
832
+ className: _MyInputModule["default"].filterInputList,
833
+ children: options && getFilterOptions().map(function (item) {
834
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
835
+ value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
836
+ onClick: function onClick() {
837
+ return mySelectFilterListClick(item);
838
+ },
839
+ className: item[options_key_subtext] ? _MyInputModule["default"].subtextli : '',
840
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
841
+ dangerouslySetInnerHTML: {
842
+ __html: item[options_key_text] || item["label"]
843
+ }
844
+ }), item[options_key_subtext] && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
845
+ className: _MyInputModule["default"].subtext,
846
+ children: item[options_key_subtext]
847
+ })]
848
+ }, item[options_key_value]);
849
+ })
850
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
851
+ style: {
852
+ display: "none"
853
+ },
854
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("select", {
855
+ id: "mySelectFilterHiddenSelect" + myInputId,
856
+ onChange: function onChange(e) {
857
+ return onMyChange(e);
858
+ },
859
+ value: myValue && !isNaN(myValue) ? MyInputIsNumeric(myValue) ? parseInt(myValue) : myValue : "",
860
+ children: options && options.map(function (item) {
861
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
862
+ value: MyInputIsNumeric(item[options_key_value]) ? parseInt(item[options_key_value]) : item[options_key_value],
863
+ children: item[options_key_text] || item["label"]
864
+ }, item[options_key_value]);
865
+ })
866
+ })
867
+ })]
868
+ });
869
+ }), MyInputType.FILE, function () {
870
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
871
+ className: _MyInputModule["default"].fileinput,
872
+ children: [function () {
873
+ // Dosya önizleme gösterimi için kontrol
874
+ if (myValue && (type === MyInputType.IMAGE || accept === '.jpg,.jpeg,.png')) {
875
+ if (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename)) {
876
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
877
+ src: myValue[0].base64,
878
+ className: _MyInputModule["default"].fileImagePreview,
879
+ alt: "Preview"
880
+ });
881
+ } else if (getFileImageControl(myValue)) {
882
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
883
+ src: myValue,
884
+ className: _MyInputModule["default"].fileImagePreview,
885
+ alt: "Preview"
886
+ });
887
+ }
888
+ }
889
+ return null;
890
+ }(), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
891
+ className: _MyInputModule["default"].filename + " " + (myFileName && _MyInputModule["default"].selected),
661
892
  dangerouslySetInnerHTML: {
662
- __html: item[options_key_text] || item["label"]
893
+ __html: myFileName || (placeholder ? placeholder : t(type === MyInputType.IMAGE ? "Görsel Seçiniz" : "Dosya Seçiniz"))
663
894
  }
664
- }), item[options_key_subtext] && /*#__PURE__*/React.createElement("span", {
665
- className: styles.subtext
666
- }, item[options_key_subtext]));
667
- })), /*#__PURE__*/React.createElement("div", {
668
- style: {
669
- display: "none"
670
- }
671
- }, /*#__PURE__*/React.createElement("select", {
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"
895
+ }), function () {
896
+ if (onRemoveImage && myValue && type === MyInputType.IMAGE && (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename) || getFileImageControl(myValue) && !(myValue.includes("nologo") || myValue.includes("noimage")))) {
897
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
898
+ type: "button",
899
+ onClick: onRemoveImageClick,
900
+ className: _MyInputModule["default"].filebuttonremove,
901
+ title: t("Kaldır"),
902
+ children: "x"
697
903
  });
698
904
  }
699
- }
700
- return null;
701
- })(), /*#__PURE__*/React.createElement("div", {
702
- className: styles.filename + " " + (myFileName && styles.selected),
703
- dangerouslySetInnerHTML: {
704
- __html: myFileName || (placeholder ? placeholder : t(type === MyInputType.IMAGE ? "Görsel Seçiniz" : "Dosya Seçiniz"))
705
- }
706
- }), (() => {
707
- if (onRemoveImage && myValue && type === MyInputType.IMAGE && (Array.isArray(myValue) && myValue.length === 1 && getFileImageControl(myValue[0].filename) || getFileImageControl(myValue) && !(myValue.includes("nologo") || myValue.includes("noimage")))) {
708
- return /*#__PURE__*/React.createElement("button", {
709
- type: "button",
710
- onClick: onRemoveImageClick,
711
- className: styles.filebuttonremove,
712
- title: t("Kaldır")
713
- }, "x");
714
- }
715
- return null;
716
- })(), /*#__PURE__*/React.createElement("button", {
717
- type: "button",
718
- onClick: () => fileInputRef.current.click(),
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
- }))),
733
- [MyInputType.IMAGE]: function () {
734
- return this[MyInputType.FILE]();
735
- }
736
- };
737
- return inputTypes[type]?.() || null;
905
+ return null;
906
+ }(), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
907
+ type: "button",
908
+ onClick: function onClick() {
909
+ return fileInputRef.current.click();
910
+ },
911
+ className: _MyInputModule["default"].filebutton,
912
+ children: type === MyInputType.IMAGE ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_pi.PiImage, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdOutlineAttachFile, {})
913
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
914
+ type: "file",
915
+ ref: fileInputRef,
916
+ onChange: function onChange(e) {
917
+ return onMyChange(e);
918
+ },
919
+ placeholder: placeholder || myTitleLite,
920
+ style: {
921
+ display: "none"
922
+ }
923
+ }, multiple ? {
924
+ multiple: true
925
+ } : {}), {}, {
926
+ accept: type === MyInputType.IMAGE ? '.jpg,.jpeg,.png' : accept
927
+ }))]
928
+ });
929
+ }), MyInputType.IMAGE, function () {
930
+ return this[MyInputType.FILE]();
931
+ }));
932
+ return ((_inputTypes$type = inputTypes[type]) === null || _inputTypes$type === void 0 ? void 0 : _inputTypes$type.call(inputTypes)) || null;
738
933
  };
739
- return /*#__PURE__*/React.createElement("div", {
934
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
740
935
  id: "myinput" + myInputId,
741
- className: styles.container + " " + (className != null ? className : '') + " " + (isError ? styles.error : ''),
936
+ className: _MyInputModule["default"].container + " " + (className != null ? className : '') + " " + (isError ? _MyInputModule["default"].error : ''),
742
937
  title: title && myTitleLite || placeholder && placeholder,
743
938
  style: style && style.width && {
744
939
  display: 'inline-block'
745
940
  } || {
746
941
  width: '100%'
747
- }
748
- }, title && /*#__PURE__*/React.createElement("small", {
749
- dangerouslySetInnerHTML: {
750
- __html: title
751
- }
752
- }), /*#__PURE__*/React.createElement("div", {
753
- className: styles.inputblock + " " + (disabled || type === MyInputType.READONLY ? styles.inputblockdisabled : '') + " " + (icon || type === MyInputType.IMAGE ? styles.inputblockicon : ''),
754
- style: style && {
755
- ...(style.backgroundColor && {
942
+ },
943
+ children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
944
+ dangerouslySetInnerHTML: {
945
+ __html: title
946
+ }
947
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
948
+ className: _MyInputModule["default"].inputblock + " " + (disabled || type === MyInputType.READONLY ? _MyInputModule["default"].inputblockdisabled : '') + " " + (icon || type === MyInputType.IMAGE ? _MyInputModule["default"].inputblockicon : ''),
949
+ style: style && _objectSpread({}, style.backgroundColor && {
756
950
  backgroundColor: style.backgroundColor
757
- })
758
- }
759
- }, icon && /*#__PURE__*/React.createElement("div", {
760
- className: `${styles.icon} ${type === MyInputType.TEXTAREA || rows > 0 ? styles.icontextarea : ''}`
761
- }, icon), renderInput()), description && /*#__PURE__*/React.createElement("small", {
762
- className: styles.description
763
- }, description));
951
+ }),
952
+ children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
953
+ className: "".concat(_MyInputModule["default"].icon, " ").concat(type === MyInputType.TEXTAREA || rows > 0 ? _MyInputModule["default"].icontextarea : ''),
954
+ children: icon
955
+ }), renderInput()]
956
+ }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
957
+ className: _MyInputModule["default"].description,
958
+ children: description
959
+ })]
960
+ });
764
961
  }
765
- export default MyInput;
962
+ var _default = exports["default"] = MyInput;