@sydsoft/base 1.49.0 → 1.51.0
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/_lib/baseFunctions.js +24 -11
- package/_dist/_lib/inputMask.js +7 -3
- package/_dist/_lib/listFunctions.js +7 -2
- package/_dist/_lib/storage/cookies.js +20 -12
- package/_dist/_lib/storage/encData.js +10 -5
- package/_dist/_lib/storage/localStorage.js +23 -14
- package/_dist/_lib/storage/sessionStorage.js +23 -14
- package/_dist/_lib/useInterval.js +8 -5
- package/_dist/alert/index.js +22 -13
- package/_dist/box/Box.js +12 -8
- package/_dist/box/BoxContent.js +9 -4
- package/_dist/box/BoxFooter.js +9 -5
- package/_dist/box/BoxHeader.js +10 -6
- package/_dist/box/index.js +7 -4
- package/_dist/countDown/index.js +17 -12
- package/_dist/dateTime/index.js +4 -1
- package/_dist/form/Button.js +24 -20
- package/_dist/form/Checkbox.js +11 -6
- package/_dist/form/Dialog.js +12 -8
- package/_dist/form/Form.js +7 -4
- package/_dist/form/FormOlustur.js +16 -12
- package/_dist/form/Input.js +49 -44
- package/_dist/form/Label.js +10 -6
- package/_dist/form/SearchableInput.js +47 -43
- package/_dist/form/UploadBase.js +16 -11
- package/_dist/form/index.js +12 -9
- package/_dist/grid/index.js +38 -30
- package/_dist/icon/icons.js +10 -7
- package/_dist/icon/index.js +13 -9
- package/_dist/icon/mui.js +2 -1
- package/_dist/index.js +22 -19
- package/_dist/menu/index.js +20 -16
- package/_dist/modal/index.js +16 -12
- package/_dist/popover/index.js +37 -33
- package/_dist/tooltip/index.js +8 -4
- package/package.json +3 -5
- package/_lib/baseFunctions.ts +0 -94
- package/_lib/inputMask.ts +0 -257
- package/_lib/listFunctions.ts +0 -106
- package/_lib/storage/cookies.ts +0 -39
- package/_lib/storage/encData.ts +0 -41
- package/_lib/storage/localStorage.ts +0 -67
- package/_lib/storage/sessionStorage.ts +0 -67
- package/_lib/useInterval.ts +0 -30
- package/alert/index.module.css +0 -119
- package/alert/index.tsx +0 -131
- package/box/Box.module.css +0 -153
- package/box/Box.tsx +0 -33
- package/box/BoxContent.tsx +0 -18
- package/box/BoxFooter.tsx +0 -25
- package/box/BoxHeader.tsx +0 -46
- package/box/index.ts +0 -10
- package/countDown/index.tsx +0 -116
- package/dateTime/index.ts +0 -79
- package/form/Button.tsx +0 -143
- package/form/Checkbox.tsx +0 -48
- package/form/Dialog.tsx +0 -109
- package/form/Form.tsx +0 -19
- package/form/FormOlustur.tsx +0 -105
- package/form/Input.tsx +0 -364
- package/form/Label.tsx +0 -20
- package/form/SearchableInput.tsx +0 -406
- package/form/UploadBase.tsx +0 -133
- package/form/index.ts +0 -10
- package/form/styles/Button.module.css +0 -145
- package/form/styles/Input.module.css +0 -221
- package/form/styles/Label.module.css +0 -31
- package/form/styles/SearchableInput.module.css +0 -80
- package/global.d.ts +0 -9
- package/grid/index.module.css +0 -805
- package/grid/index.tsx +0 -171
- package/icon/icons.tsx +0 -33
- package/icon/index.tsx +0 -95
- package/icon/mui.tsx +0 -5932
- package/index.ts +0 -21
- package/menu/index.module.css +0 -92
- package/menu/index.tsx +0 -143
- package/modal/index.module.css +0 -77
- package/modal/index.tsx +0 -106
- package/npm_recovery_codes.txt +0 -5
- package/popover/index.module.css +0 -89
- package/popover/index.tsx +0 -392
- package/tooltip/index.tsx +0 -216
- package/tsconfig.json +0 -24
package/_dist/countDown/index.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCountDown = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
const useInterval_1 = require("../_lib/useInterval");
|
|
8
|
+
const useCountDown = ({ autoStart = false, onComplete, getStatus, targetTime, timerType = 'countdown', countType = 'seconds', speed = 1000, hide }) => {
|
|
9
|
+
const refCountDownRender = (0, react_1.useRef)(null);
|
|
10
|
+
const [enabled, setEnabled] = (0, react_1.useState)(timerType === 'datetime' || autoStart);
|
|
11
|
+
const [timer, setTimer] = (0, react_1.useState)(0);
|
|
12
|
+
const [timerSpeed, setTimerSpeed] = (0, react_1.useState)(typeof speed === 'number' && speed > 0 ? speed : 1000);
|
|
13
|
+
(0, react_1.useEffect)(() => prepareTimer(targetTime), [targetTime]);
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
11
15
|
if (!hide)
|
|
12
16
|
render();
|
|
13
17
|
}, [timer]);
|
|
14
|
-
useInterval(() => {
|
|
18
|
+
(0, useInterval_1.useInterval)(() => {
|
|
15
19
|
if (enabled) {
|
|
16
20
|
if (timer <= 1) {
|
|
17
21
|
stopCountDown();
|
|
@@ -82,7 +86,7 @@ export const useCountDown = ({ autoStart = false, onComplete, getStatus, targetT
|
|
|
82
86
|
}
|
|
83
87
|
};
|
|
84
88
|
return {
|
|
85
|
-
ComponentCountDown: (children) => (hide ? null :
|
|
89
|
+
ComponentCountDown: (children) => (hide ? null : react_2.default.cloneElement(children, { ref: refCountDownRender })),
|
|
86
90
|
startCountDown: () => setEnabled(true),
|
|
87
91
|
stopCountDown: () => setEnabled(false),
|
|
88
92
|
setTargetTime: (targetTime) => prepareTimer(targetTime),
|
|
@@ -90,3 +94,4 @@ export const useCountDown = ({ autoStart = false, onComplete, getStatus, targetT
|
|
|
90
94
|
getChildrenRef: () => refCountDownRender.current || null
|
|
91
95
|
};
|
|
92
96
|
};
|
|
97
|
+
exports.useCountDown = useCountDown;
|
package/_dist/dateTime/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class dateTime {
|
|
2
4
|
constructor(datetime = null, format = "y-m-d h:i:s") {
|
|
3
5
|
this.resut_format = "y-m-d h:i:s";
|
|
4
6
|
this.format(format);
|
|
@@ -68,3 +70,4 @@ export default class dateTime {
|
|
|
68
70
|
return this.getResult();
|
|
69
71
|
}
|
|
70
72
|
}
|
|
73
|
+
exports.default = dateTime;
|
package/_dist/form/Button.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const Dialog_1 = require("./Dialog");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const tooltip_1 = require("../tooltip");
|
|
9
|
+
const link_1 = tslib_1.__importDefault(require("next/link"));
|
|
10
|
+
const Button_module_css_1 = tslib_1.__importDefault(require("./styles/Button.module.css"));
|
|
11
|
+
exports.Button = (0, react_1.memo)(function MemoFunction({ children, component = "button", className, buttonClass = "default", buttonSize = "medium", style, type = "button", fullWidth = false, onlyIcon, onClick, href, target, tabIndex, title, titlePosition, titleArrow, dialog, autoFocus, ...other }) {
|
|
8
12
|
const Comp = component;
|
|
9
13
|
const ripple = (e) => {
|
|
10
14
|
const el = e.currentTarget;
|
|
11
15
|
const circle = document.createElement("span");
|
|
12
16
|
const diameter = Math.max(el.clientWidth, el.clientHeight);
|
|
13
17
|
circle.style.width = circle.style.height = `${diameter}px`;
|
|
14
|
-
circle.classList.add(
|
|
15
|
-
const ripple = el.getElementsByClassName(
|
|
18
|
+
circle.classList.add(Button_module_css_1.default.ripple);
|
|
19
|
+
const ripple = el.getElementsByClassName(Button_module_css_1.default.ripple)[0];
|
|
16
20
|
if (ripple)
|
|
17
21
|
ripple.remove();
|
|
18
22
|
el.appendChild(circle);
|
|
@@ -20,7 +24,7 @@ export const Button = memo(function MemoFunction({ children, component = "button
|
|
|
20
24
|
const handleClick = (e) => {
|
|
21
25
|
ripple(e);
|
|
22
26
|
if (dialog) {
|
|
23
|
-
Dialog(dialog).then((result) => {
|
|
27
|
+
(0, Dialog_1.Dialog)(dialog).then((result) => {
|
|
24
28
|
if (result && onClick) {
|
|
25
29
|
onClick(e);
|
|
26
30
|
}
|
|
@@ -31,20 +35,20 @@ export const Button = memo(function MemoFunction({ children, component = "button
|
|
|
31
35
|
onClick(e);
|
|
32
36
|
}
|
|
33
37
|
};
|
|
34
|
-
const createClassList = useCallback(() => {
|
|
35
|
-
const list = ["sbutton",
|
|
38
|
+
const createClassList = (0, react_1.useCallback)(() => {
|
|
39
|
+
const list = ["sbutton", Button_module_css_1.default.button];
|
|
36
40
|
if (buttonClass)
|
|
37
|
-
list.push(
|
|
41
|
+
list.push(Button_module_css_1.default[buttonClass]);
|
|
38
42
|
if (className)
|
|
39
43
|
list.push(className);
|
|
40
44
|
if (onlyIcon)
|
|
41
|
-
list.push(
|
|
45
|
+
list.push(Button_module_css_1.default.iconbutton);
|
|
42
46
|
if (fullWidth)
|
|
43
|
-
list.push(
|
|
47
|
+
list.push(Button_module_css_1.default.fullwidth);
|
|
44
48
|
return list.join(" ");
|
|
45
49
|
}, [buttonClass, className, onlyIcon, fullWidth]);
|
|
46
|
-
const [classList, setClassList] = useState(() => createClassList());
|
|
47
|
-
useEffect(() => {
|
|
50
|
+
const [classList, setClassList] = (0, react_1.useState)(() => createClassList());
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
48
52
|
const newClassList = createClassList().split(" ").filter(Boolean);
|
|
49
53
|
if (href && typeof window !== "undefined" && window.location.pathname === href) {
|
|
50
54
|
newClassList.push("active");
|
|
@@ -67,14 +71,14 @@ export const Button = memo(function MemoFunction({ children, component = "button
|
|
|
67
71
|
}
|
|
68
72
|
else {
|
|
69
73
|
let checkHref = (other === null || other === void 0 ? void 0 : other.disabled) ? "#" : href;
|
|
70
|
-
renderComponent = (
|
|
74
|
+
renderComponent = ((0, jsx_runtime_1.jsx)(link_1.default, { href: checkHref, target: (other === null || other === void 0 ? void 0 : other.disabled) ? "_self" : target, children: (0, jsx_runtime_1.jsx)(Comp, { ...ortakProps, children: onlyIcon ? onlyIcon : children }) }));
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
else {
|
|
74
|
-
renderComponent = (
|
|
78
|
+
renderComponent = ((0, jsx_runtime_1.jsx)(Comp, { type: type, ...ortakProps, children: onlyIcon ? onlyIcon : children }));
|
|
75
79
|
}
|
|
76
80
|
if (title && renderComponent) {
|
|
77
|
-
return (
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { title: title, position: titlePosition, arrow: titleArrow, children: renderComponent }));
|
|
78
82
|
}
|
|
79
83
|
else {
|
|
80
84
|
return renderComponent;
|
package/_dist/form/Checkbox.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Checkbox = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const Input_module_css_1 = tslib_1.__importDefault(require("./styles/Input.module.css"));
|
|
8
|
+
const Checkbox = ({ ref, children, name, label, checked, className, style, styleCheckbox, styleLabel, onToogle, disabled, tabIndex, required = false }) => {
|
|
9
|
+
const refMain = (0, react_1.useRef)(null);
|
|
6
10
|
// checked değerini boolean hâline getiriyoruz
|
|
7
11
|
const isChecked = checked === "1" || checked === true;
|
|
8
12
|
const handleChange = (newChecked) => {
|
|
@@ -18,5 +22,6 @@ export const Checkbox = ({ ref, children, name, label, checked, className, style
|
|
|
18
22
|
const toggleCheck = () => {
|
|
19
23
|
handleChange(!isChecked);
|
|
20
24
|
};
|
|
21
|
-
return (
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: refMain, className: `${Input_module_css_1.default.checkbox} ${className || ""}`, style: style, tabIndex: tabIndex, onClick: toggleCheck, children: [(0, jsx_runtime_1.jsx)("input", { ref: ref, type: "checkbox", name: name, onChange: (e) => handleChange(e.target.checked), checked: isChecked, required: required, style: styleCheckbox, disabled: disabled }), label && (0, jsx_runtime_1.jsx)("label", { style: styleLabel, children: label }), children && (0, jsx_runtime_1.jsx)("div", { children: children })] }));
|
|
22
26
|
};
|
|
27
|
+
exports.Checkbox = Checkbox;
|
package/_dist/form/Dialog.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Dialog = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const box_1 = require("../box");
|
|
6
|
+
const client_1 = require("react-dom/client");
|
|
7
|
+
const modal_1 = require("../modal");
|
|
8
|
+
const Button_1 = require("./Button");
|
|
9
|
+
const Dialog = (config) => new Promise((resolve) => {
|
|
7
10
|
if (typeof window === 'undefined')
|
|
8
11
|
return false;
|
|
9
12
|
let mainDiv = document.getElementById('sdialog');
|
|
@@ -13,7 +16,7 @@ export const Dialog = (config) => new Promise((resolve) => {
|
|
|
13
16
|
document.body.appendChild(createDiv);
|
|
14
17
|
mainDiv = createDiv;
|
|
15
18
|
}
|
|
16
|
-
const root = createRoot(mainDiv);
|
|
19
|
+
const root = (0, client_1.createRoot)(mainDiv);
|
|
17
20
|
const settings = {
|
|
18
21
|
acceptButtonShow: true,
|
|
19
22
|
cancelButtonShow: true,
|
|
@@ -48,6 +51,7 @@ export const Dialog = (config) => new Promise((resolve) => {
|
|
|
48
51
|
resolve(true);
|
|
49
52
|
close();
|
|
50
53
|
};
|
|
51
|
-
const Component = (
|
|
54
|
+
const Component = ((0, jsx_runtime_1.jsx)(modal_1.Modal, { open: true, keepMounted: false, close: onCancel, hideBackdrop: settings.hideBackdrop, hideEsc: settings.hideEsc, hideCloseButton: true, vertialAlign: settings.vertialAlign, horizontalAlign: settings.horizontalAlign, backdropStyle: settings.backdropStyle, children: (0, jsx_runtime_1.jsxs)(box_1.Box, { style: settings.styleBox, children: [(0, jsx_runtime_1.jsx)("div", { className: "sbox_content", style: settings.styleMessage, dangerouslySetInnerHTML: { __html: settings.message } }), (settings.acceptButtonShow || settings.cancelButtonShow) && ((0, jsx_runtime_1.jsxs)(box_1.BoxFooter, { style: settings.styleBoxFooter, children: [settings.cancelButtonShow && ((0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: settings.autoFocus === 'cancel', buttonClass: settings.cancelButtonClass, onClick: onCancel, children: settings.cancelButtonText })), settings.acceptButtonShow && ((0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: settings.autoFocus === 'accept', buttonClass: settings.acceptButtonClass, onClick: onAccept, children: settings.acceptButtonText }))] }))] }) }));
|
|
52
55
|
root.render(Component);
|
|
53
56
|
});
|
|
57
|
+
exports.Dialog = Dialog;
|
package/_dist/form/Form.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Form = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.Form = (0, react_1.memo)(function FunctionMemo({ encType = "multipart/form-data", onSubmit, style, disableOnEnterSubmit = false, ...other }) {
|
|
4
7
|
const onKeyDown = (e) => {
|
|
5
8
|
if (e.key === "Enter" && disableOnEnterSubmit) {
|
|
6
9
|
e.preventDefault();
|
|
7
10
|
}
|
|
8
11
|
};
|
|
9
|
-
return
|
|
12
|
+
return (0, jsx_runtime_1.jsx)("form", { style: style, encType: encType, onSubmit: onSubmit, onKeyDown: onKeyDown, ...other });
|
|
10
13
|
});
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormOlustur = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const grid_1 = require("../grid");
|
|
8
|
+
const baseFunctions_1 = require("../_lib/baseFunctions");
|
|
9
|
+
const Label_1 = require("./Label");
|
|
10
|
+
exports.FormOlustur = (0, react_1.memo)(function FunctionMemo(props) {
|
|
7
11
|
const { form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing } = props;
|
|
8
|
-
useEffect(() => {
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
9
13
|
if (formOgeler && onChange && form) {
|
|
10
14
|
formOgeler.forEach((formOgeler) => {
|
|
11
15
|
var _a, _b, _c, _d;
|
|
12
16
|
const fieldName = (_b = (_a = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.name;
|
|
13
17
|
if (formOgeler.noRender && fieldName && form[fieldName] && form[fieldName] != '') {
|
|
14
|
-
isDev && console.log('noRenderGuncelle');
|
|
18
|
+
baseFunctions_1.isDev && console.log('noRenderGuncelle');
|
|
15
19
|
if ((formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) && ((_d = (_c = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.name)) {
|
|
16
20
|
onChange({
|
|
17
21
|
target: {
|
|
@@ -24,13 +28,13 @@ export const FormOlustur = memo(function FunctionMemo(props) {
|
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
}, [JSON.stringify(form), formOgeler]);
|
|
27
|
-
const result = useMemo(() => {
|
|
31
|
+
const result = (0, react_1.useMemo)(() => {
|
|
28
32
|
return formOgeler.map(({ noRender, fullComponent, component, propsComponent, propsRow, label, propsLabel, gridLabel, gridInput }, i) => {
|
|
29
33
|
if (noRender) {
|
|
30
34
|
return null;
|
|
31
35
|
}
|
|
32
36
|
if (fullComponent)
|
|
33
|
-
return
|
|
37
|
+
return react_1.default.cloneElement(fullComponent, { key: i });
|
|
34
38
|
let newProps = { ...propsComponent };
|
|
35
39
|
if (onChange && component && !component.props.onChange) {
|
|
36
40
|
newProps = { ...newProps, onChange };
|
|
@@ -43,8 +47,8 @@ export const FormOlustur = memo(function FunctionMemo(props) {
|
|
|
43
47
|
const detectLabel = label || component.props.label;
|
|
44
48
|
gridLabel = { ...sabitGrid.label, ...gridLabel };
|
|
45
49
|
gridInput = { ...sabitGrid.input, ...gridInput };
|
|
46
|
-
return (
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(grid_1.Row, { justifyContent: justifyContent, rowSpacing: rowSpacing, colSpacing: colSpacing, ...propsRow, children: [formType === 'label' && detectLabel && ((0, jsx_runtime_1.jsx)(grid_1.Col, { ...gridLabel, children: (0, jsx_runtime_1.jsx)(Label_1.Label, { required: component.props.required, ...propsLabel, children: detectLabel }) })), (0, jsx_runtime_1.jsx)(grid_1.Col, { ...gridInput, children: react_1.default.cloneElement(component, newProps) })] }, i));
|
|
47
51
|
});
|
|
48
52
|
}, [form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing]);
|
|
49
|
-
return
|
|
53
|
+
return (0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: result });
|
|
50
54
|
});
|
package/_dist/form/Input.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Input = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
6
|
/**
|
|
3
7
|
* @author : izzetseydaoglu
|
|
4
8
|
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
5
9
|
* @version : 2026-01-21 21:35:48
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const baseFunctions_1 = require("../_lib/baseFunctions");
|
|
13
|
+
const inputMask_1 = require("../_lib/inputMask");
|
|
14
|
+
const alert_1 = require("../alert");
|
|
15
|
+
const Dialog_1 = require("./Dialog");
|
|
16
|
+
const Input_module_css_1 = tslib_1.__importDefault(require("./styles/Input.module.css"));
|
|
17
|
+
const Input = ({ componentRef, inputRef, className, propsComponent, propsInput, id, name, value = '', type, label, startAdornment, endAdornment, placeholder, onChange, onFocus, onBlur, onClick, onKeyPress, onKeyUp, onKeyDown, disabled = false, required = false, loading = false, autoFocus = false, select, valueKey = 'value', labelKey = 'label', ilkSec = false, multiline = false, rows = 2, sadeceYazi, sadeceSayi, tumuBuyuk, tumuKucuk, seoCevir, dosyaNoGiris, fileNameGiris, dateGecmisKontrol, autoSelectText, mask = '', maskSettings = {
|
|
14
18
|
clearIfNotMatch: true,
|
|
15
19
|
reverse: false, //Tersten doldurmaya başla, fiyatlar için geçerli
|
|
16
20
|
selectOnFocus: false
|
|
17
21
|
} }) => {
|
|
18
|
-
const refMain = useRef(null);
|
|
19
|
-
const refInput = useRef(null);
|
|
20
|
-
const refLabel = useRef(null);
|
|
21
|
-
const [inputFilled, setInputFilled] = useState(value && value.toString().length > 0);
|
|
22
|
-
const [focus, setFocus] = useState(false);
|
|
23
|
-
useEffect(() => {
|
|
22
|
+
const refMain = (0, react_1.useRef)(null);
|
|
23
|
+
const refInput = (0, react_1.useRef)(null);
|
|
24
|
+
const refLabel = (0, react_1.useRef)(null);
|
|
25
|
+
const [inputFilled, setInputFilled] = (0, react_1.useState)(value && value.toString().length > 0);
|
|
26
|
+
const [focus, setFocus] = (0, react_1.useState)(false);
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
24
28
|
if (inputRef)
|
|
25
29
|
inputRef.current = refInput.current;
|
|
26
30
|
if (componentRef)
|
|
27
31
|
componentRef.current = refMain.current;
|
|
28
32
|
}, [componentRef, inputRef]);
|
|
29
|
-
useEffect(() => {
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
30
34
|
autoSelectText && !select && (refInput === null || refInput === void 0 ? void 0 : refInput.current) && refInput.current.select();
|
|
31
35
|
}, [autoSelectText, select]);
|
|
32
|
-
useEffect(() => {
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
33
37
|
var _a, _b;
|
|
34
38
|
const filled = String(value) && value.toString().length > 0 ? true : false;
|
|
35
39
|
setInputFilled(filled);
|
|
36
|
-
filled && ((_b = (_a = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.remove(
|
|
40
|
+
filled && ((_b = (_a = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.remove(Input_module_css_1.default.error));
|
|
37
41
|
}, [value]);
|
|
38
|
-
useEffect(() => {
|
|
42
|
+
(0, react_1.useEffect)(() => {
|
|
39
43
|
// if (type === "number") sadeceSayi = true; //TODO: sadeceSayi burada değiştirelemez ki!!!
|
|
40
44
|
if (select && ilkSec && (value === '' || value === null || value === undefined)) {
|
|
41
45
|
if (select.length) {
|
|
@@ -44,13 +48,13 @@ export const Input = ({ componentRef, inputRef, className, propsComponent, props
|
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
}, [select]);
|
|
47
|
-
useEffect(() => {
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
48
52
|
var _a;
|
|
49
53
|
if (typeof window !== 'undefined' && (mask === null || mask === void 0 ? void 0 : mask.length) > 0 && (refInput === null || refInput === void 0 ? void 0 : refInput.current)) {
|
|
50
54
|
(_a = refInput.current) === null || _a === void 0 ? void 0 : _a.setAttribute('autocomplete', 'off');
|
|
51
55
|
}
|
|
52
56
|
if ((mask === null || mask === void 0 ? void 0 : mask.length) > 0 && (refInput === null || refInput === void 0 ? void 0 : refInput.current)) {
|
|
53
|
-
const maskInstance = applyInputMask(refInput.current, mask, {
|
|
57
|
+
const maskInstance = (0, inputMask_1.applyInputMask)(refInput.current, mask, {
|
|
54
58
|
...maskSettings,
|
|
55
59
|
onChange: (masked, clean, e) => {
|
|
56
60
|
if (onChange) {
|
|
@@ -65,40 +69,40 @@ export const Input = ({ componentRef, inputRef, className, propsComponent, props
|
|
|
65
69
|
return () => maskInstance === null || maskInstance === void 0 ? void 0 : maskInstance.destroy();
|
|
66
70
|
}
|
|
67
71
|
}, [mask]);
|
|
68
|
-
const Change = useCallback((e) => {
|
|
72
|
+
const Change = (0, react_1.useCallback)((e) => {
|
|
69
73
|
if (tumuBuyuk)
|
|
70
|
-
inputTumuBuyukCevir(e);
|
|
74
|
+
(0, baseFunctions_1.inputTumuBuyukCevir)(e);
|
|
71
75
|
if (tumuKucuk)
|
|
72
|
-
inputTumuKucukCevir(e);
|
|
76
|
+
(0, baseFunctions_1.inputTumuKucukCevir)(e);
|
|
73
77
|
if (seoCevir)
|
|
74
|
-
convertForSEO(e);
|
|
78
|
+
(0, baseFunctions_1.convertForSEO)(e);
|
|
75
79
|
setInputFilled(e.target.value.length > 0);
|
|
76
80
|
onChange ? onChange(e) : null;
|
|
77
81
|
}, [onChange, seoCevir, tumuBuyuk, tumuKucuk]);
|
|
78
|
-
const Focus = useCallback((e) => {
|
|
82
|
+
const Focus = (0, react_1.useCallback)((e) => {
|
|
79
83
|
var _a, _b;
|
|
80
84
|
onFocus ? onFocus(e) : null;
|
|
81
85
|
setFocus(true);
|
|
82
|
-
(_b = (_a = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.remove(
|
|
86
|
+
(_b = (_a = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.remove(Input_module_css_1.default.error);
|
|
83
87
|
}, [onFocus]);
|
|
84
|
-
const Blur = useCallback((e) => {
|
|
88
|
+
const Blur = (0, react_1.useCallback)((e) => {
|
|
85
89
|
var _a, _b, _c, _d;
|
|
86
90
|
if (fileNameGiris && e.target.value !== '' && /[/\\?%*:|"'<>]/g.test(e.target.value)) {
|
|
87
91
|
e.target.value = e.target.value.replace(/[/\\?%*:|"'<>]/g, '-');
|
|
88
92
|
if (onChange)
|
|
89
93
|
onChange(e);
|
|
90
|
-
alert_add({ type: 'warning', message: 'Lütfen dosya adındaki özel karakter değiştirildi.' });
|
|
94
|
+
(0, alert_1.alert_add)({ type: 'warning', message: 'Lütfen dosya adındaki özel karakter değiştirildi.' });
|
|
91
95
|
}
|
|
92
96
|
if (dosyaNoGiris && e.target.value !== '' && !/^[1-2]\d{3}\/\d/.test(e.target.value)) {
|
|
93
97
|
e.target.value = '';
|
|
94
98
|
if (onChange)
|
|
95
99
|
onChange(e);
|
|
96
|
-
alert_add({ type: 'error', message: 'Lütfen doğru bir dosya numarası giriniz. Örn: 2022/123' });
|
|
100
|
+
(0, alert_1.alert_add)({ type: 'error', message: 'Lütfen doğru bir dosya numarası giriniz. Örn: 2022/123' });
|
|
97
101
|
}
|
|
98
102
|
if (dateGecmisKontrol && e.target.value !== '') {
|
|
99
103
|
const today = new Date().toISOString().slice(0, 10);
|
|
100
104
|
if (e.target.value < today) {
|
|
101
|
-
Dialog({
|
|
105
|
+
(0, Dialog_1.Dialog)({
|
|
102
106
|
message: 'Geçmiş bir tarihi seçtiniz. Devam etmek istiyor musunuz?'
|
|
103
107
|
}).then((r) => {
|
|
104
108
|
if (!r) {
|
|
@@ -112,10 +116,10 @@ export const Input = ({ componentRef, inputRef, className, propsComponent, props
|
|
|
112
116
|
}
|
|
113
117
|
if (required) {
|
|
114
118
|
if (e.target.value === '') {
|
|
115
|
-
(_b = (_a = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add(
|
|
119
|
+
(_b = (_a = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add(Input_module_css_1.default.error);
|
|
116
120
|
}
|
|
117
121
|
else {
|
|
118
|
-
(_d = (_c = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _c === void 0 ? void 0 : _c.classList) === null || _d === void 0 ? void 0 : _d.remove(
|
|
122
|
+
(_d = (_c = refMain === null || refMain === void 0 ? void 0 : refMain.current) === null || _c === void 0 ? void 0 : _c.classList) === null || _d === void 0 ? void 0 : _d.remove(Input_module_css_1.default.error);
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
if (value !== e.target.value) {
|
|
@@ -124,8 +128,8 @@ export const Input = ({ componentRef, inputRef, className, propsComponent, props
|
|
|
124
128
|
onBlur ? onBlur(e) : null;
|
|
125
129
|
setFocus(false);
|
|
126
130
|
}, [fileNameGiris, dosyaNoGiris, dateGecmisKontrol, required, value, onBlur, onChange, name]);
|
|
127
|
-
const Click = useCallback((e) => (onClick ? onClick(e) : null), [onClick]);
|
|
128
|
-
const KeyPress = useCallback((e) => {
|
|
131
|
+
const Click = (0, react_1.useCallback)((e) => (onClick ? onClick(e) : null), [onClick]);
|
|
132
|
+
const KeyPress = (0, react_1.useCallback)((e) => {
|
|
129
133
|
if (sadeceYazi) {
|
|
130
134
|
const turkishLetters = /[ğüşıöçĞÜŞİÖÇ]/;
|
|
131
135
|
if (!(/[A-Za-z\s.]/.test(e.key) || turkishLetters.test(e.key))) {
|
|
@@ -140,8 +144,8 @@ export const Input = ({ componentRef, inputRef, className, propsComponent, props
|
|
|
140
144
|
}
|
|
141
145
|
onKeyPress ? onKeyPress(e) : null;
|
|
142
146
|
}, [sadeceYazi, sadeceSayi, dosyaNoGiris, onKeyPress]);
|
|
143
|
-
const KeyUp = useCallback((e) => (onKeyUp ? onKeyUp(e) : null), [onKeyUp]);
|
|
144
|
-
const KeyDown = useCallback((e) => {
|
|
147
|
+
const KeyUp = (0, react_1.useCallback)((e) => (onKeyUp ? onKeyUp(e) : null), [onKeyUp]);
|
|
148
|
+
const KeyDown = (0, react_1.useCallback)((e) => {
|
|
145
149
|
onKeyDown ? onKeyDown(e) : null;
|
|
146
150
|
}, [onKeyDown]);
|
|
147
151
|
const ortakProps = {
|
|
@@ -163,29 +167,29 @@ export const Input = ({ componentRef, inputRef, className, propsComponent, props
|
|
|
163
167
|
};
|
|
164
168
|
let component;
|
|
165
169
|
if (select) {
|
|
166
|
-
component = (
|
|
170
|
+
component = ((0, jsx_runtime_1.jsxs)("select", { className: `${Input_module_css_1.default.input} ${Input_module_css_1.default.select}`, ...ortakProps, ...propsInput, children: [ilkSec === false && (0, jsx_runtime_1.jsx)("option", { value: '' }), select.map((item) => {
|
|
167
171
|
const value = item[valueKey];
|
|
168
172
|
const label = item[labelKey];
|
|
169
|
-
return (
|
|
173
|
+
return ((0, jsx_runtime_1.jsx)("option", { value: value, children: label ? label : value }, value));
|
|
170
174
|
})] }));
|
|
171
175
|
}
|
|
172
176
|
else if (multiline) {
|
|
173
|
-
component =
|
|
177
|
+
component = (0, jsx_runtime_1.jsx)("textarea", { className: `${Input_module_css_1.default.input} ${Input_module_css_1.default.textarea}`, rows: rows, ...ortakProps, ...propsInput });
|
|
174
178
|
}
|
|
175
179
|
else {
|
|
176
|
-
component =
|
|
180
|
+
component = (0, jsx_runtime_1.jsx)("input", { className: `${Input_module_css_1.default.input}`, type: type, ...ortakProps, ...propsInput });
|
|
177
181
|
}
|
|
178
182
|
const classList = () => {
|
|
179
|
-
const list = ['sInputComponent',
|
|
183
|
+
const list = ['sInputComponent', Input_module_css_1.default.component];
|
|
180
184
|
if (className)
|
|
181
185
|
list.push(className);
|
|
182
186
|
if (label) {
|
|
183
|
-
list.push(
|
|
187
|
+
list.push(Input_module_css_1.default.hidePlaceHolder);
|
|
184
188
|
}
|
|
185
189
|
// if (props.required && (value.length === 0 || !value)) list.push("error");
|
|
186
190
|
return list.join(' ');
|
|
187
191
|
};
|
|
188
|
-
useEffect(() => {
|
|
192
|
+
(0, react_1.useEffect)(() => {
|
|
189
193
|
if (propsComponent && propsComponent.hasOwnProperty('style')) {
|
|
190
194
|
const background = propsComponent.style.background ? propsComponent.style.background : propsComponent.style.backgroundColor ? propsComponent.style.backgroundColor : null;
|
|
191
195
|
if (background && refLabel.current) {
|
|
@@ -193,5 +197,6 @@ export const Input = ({ componentRef, inputRef, className, propsComponent, props
|
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
199
|
}, [propsComponent]);
|
|
196
|
-
return (
|
|
200
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: refMain, className: classList(), "data-disabled": disabled, ...propsComponent, children: [startAdornment && (0, jsx_runtime_1.jsx)("div", { className: `adornment_start ${Input_module_css_1.default.adornment} ${Input_module_css_1.default.start}`, children: startAdornment }), (0, jsx_runtime_1.jsxs)("div", { className: `${Input_module_css_1.default.inputBase} ${inputFilled || focus || type == 'date' ? Input_module_css_1.default.open : ''}`, children: [component, label && ((0, jsx_runtime_1.jsxs)("div", { ref: refLabel, className: `label ${Input_module_css_1.default.label}`, children: [label, required && (0, jsx_runtime_1.jsx)("span", { className: Input_module_css_1.default.required, children: "*" })] }))] }), (endAdornment || loading) && ((0, jsx_runtime_1.jsxs)("div", { className: `adornment_end ${Input_module_css_1.default.adornment} ${Input_module_css_1.default.end}`, children: [endAdornment, loading && (0, jsx_runtime_1.jsx)("div", { className: Input_module_css_1.default.loading })] }))] }));
|
|
197
201
|
};
|
|
202
|
+
exports.Input = Input;
|
package/_dist/form/Label.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Label = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const tooltip_1 = require("../tooltip");
|
|
8
|
+
const Label_module_css_1 = tslib_1.__importDefault(require("./styles/Label.module.css"));
|
|
9
|
+
exports.Label = (0, react_1.memo)(function FMemo({ required = false, children, ...other }) {
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("label", { className: Label_module_css_1.default.label, ...other, children: [children, (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { title: 'Zorunlu Alan', children: (0, jsx_runtime_1.jsx)("span", { className: Label_module_css_1.default.required, children: required && '*' }) })] }));
|
|
7
11
|
});
|