@sydsoft/base 1.47.0 → 1.48.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/README.md +8 -1
- package/dist/esm/_lib/baseFunctions.js +25 -38
- package/dist/esm/_lib/inputMask.js +66 -69
- package/dist/esm/_lib/listFunctions.js +12 -13
- package/dist/esm/_lib/storage/cookies.js +20 -21
- package/dist/esm/_lib/storage/encData.js +18 -20
- package/dist/esm/_lib/storage/localStorage.js +10 -10
- package/dist/esm/_lib/storage/sessionStorage.js +10 -10
- package/dist/esm/_lib/useInterval.js +5 -5
- package/dist/esm/alert/index.js +28 -30
- package/dist/esm/box/Box.js +6 -7
- package/dist/esm/box/BoxContent.js +2 -4
- package/dist/esm/box/BoxFooter.js +6 -4
- package/dist/esm/box/BoxHeader.js +6 -5
- package/dist/esm/countDown/index.js +28 -33
- package/dist/esm/dateTime/index.js +25 -31
- package/dist/esm/form/Button.js +28 -22
- package/dist/esm/form/Checkbox.js +7 -8
- package/dist/esm/form/Dialog.js +47 -34
- package/dist/esm/form/Form.js +3 -5
- package/dist/esm/form/FormOlustur.js +15 -17
- package/dist/esm/form/Input.js +57 -56
- package/dist/esm/form/Label.js +2 -4
- package/dist/esm/form/SearchableInput.js +77 -89
- package/dist/esm/form/UploadBase.js +30 -32
- package/dist/esm/grid/index.js +40 -41
- package/dist/esm/icon/icons.js +1 -1
- package/dist/esm/icon/index.js +16 -8
- package/dist/esm/menu/index.js +14 -16
- package/dist/esm/modal/index.js +14 -16
- package/dist/esm/popover/index.js +100 -100
- package/dist/esm/tooltip/index.js +117 -34
- package/package.json +12 -6
- package/dist/esm/alert/index.module.css +0 -119
- package/dist/esm/grid/index.module.css +0 -805
- package/dist/esm/menu/index.module.css +0 -92
- package/dist/esm/modal/index.module.css +0 -77
- /package/dist/esm/{box/Box.module.css → Box.module.css} +0 -0
- /package/dist/esm/{popover/index.module.css → index.module.css} +0 -0
- /package/dist/esm/{form/styles → styles}/Button.module.css +0 -0
- /package/dist/esm/{form/styles → styles}/Input.module.css +0 -0
- /package/dist/esm/{form/styles → styles}/Label.module.css +0 -0
- /package/dist/esm/{form/styles → styles}/SearchableInput.module.css +0 -0
package/dist/esm/form/Dialog.js
CHANGED
|
@@ -1,40 +1,53 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Box, BoxFooter } from '../box';
|
|
4
3
|
import { createRoot } from 'react-dom/client';
|
|
5
4
|
import { Modal } from '../modal';
|
|
6
5
|
import { Button } from './Button';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
export const Dialog = (config) => new Promise((resolve) => {
|
|
7
|
+
if (typeof window === 'undefined')
|
|
8
|
+
return false;
|
|
9
|
+
let mainDiv = document.getElementById('sdialog');
|
|
10
|
+
if (!mainDiv) {
|
|
11
|
+
const createDiv = document.createElement('div');
|
|
12
|
+
createDiv.setAttribute('id', 'sdialog');
|
|
13
|
+
document.body.appendChild(createDiv);
|
|
14
|
+
mainDiv = createDiv;
|
|
15
|
+
}
|
|
16
|
+
const root = createRoot(mainDiv);
|
|
17
|
+
const settings = {
|
|
18
|
+
acceptButtonShow: true,
|
|
19
|
+
cancelButtonShow: true,
|
|
20
|
+
acceptButtonText: 'EVET',
|
|
21
|
+
cancelButtonText: 'HAYIR',
|
|
22
|
+
acceptButtonClass: 'danger',
|
|
23
|
+
cancelButtonClass: 'secondary',
|
|
24
|
+
vertialAlign: 'center',
|
|
25
|
+
horizontalAlign: 'center',
|
|
26
|
+
hideBackdrop: true,
|
|
27
|
+
hideEsc: true,
|
|
28
|
+
styleMessage: {
|
|
29
|
+
fontSize: '1.1rem',
|
|
30
|
+
padding: '10px 20px'
|
|
31
|
+
},
|
|
32
|
+
styleBox: { padding: 0, margin: 0, minWidth: 250 },
|
|
33
|
+
styleBoxFooter: { padding: '8px 5px' },
|
|
34
|
+
autoFocus: 'accept',
|
|
35
|
+
...config
|
|
36
|
+
};
|
|
37
|
+
const close = () => {
|
|
38
|
+
if (mainDiv) {
|
|
39
|
+
root.unmount();
|
|
40
|
+
mainDiv.remove();
|
|
17
41
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
resolve(false);
|
|
31
|
-
close();
|
|
32
|
-
};
|
|
33
|
-
var onAccept = function () {
|
|
34
|
-
resolve(true);
|
|
35
|
-
close();
|
|
36
|
-
};
|
|
37
|
-
var Component = (_jsx(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: _jsxs(Box, { style: settings.styleBox, children: [_jsx("div", { className: "sbox_content", style: settings.styleMessage, dangerouslySetInnerHTML: { __html: settings.message } }), (settings.acceptButtonShow || settings.cancelButtonShow) && (_jsxs(BoxFooter, { style: settings.styleBoxFooter, children: [settings.cancelButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'cancel', buttonClass: settings.cancelButtonClass, onClick: onCancel, children: settings.cancelButtonText })), settings.acceptButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'accept', buttonClass: settings.acceptButtonClass, onClick: onAccept, children: settings.acceptButtonText }))] }))] }) }));
|
|
38
|
-
root.render(Component);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
42
|
+
};
|
|
43
|
+
const onCancel = () => {
|
|
44
|
+
resolve(false);
|
|
45
|
+
close();
|
|
46
|
+
};
|
|
47
|
+
const onAccept = () => {
|
|
48
|
+
resolve(true);
|
|
49
|
+
close();
|
|
50
|
+
};
|
|
51
|
+
const Component = (_jsx(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: _jsxs(Box, { style: settings.styleBox, children: [_jsx("div", { className: "sbox_content", style: settings.styleMessage, dangerouslySetInnerHTML: { __html: settings.message } }), (settings.acceptButtonShow || settings.cancelButtonShow) && (_jsxs(BoxFooter, { style: settings.styleBoxFooter, children: [settings.cancelButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'cancel', buttonClass: settings.cancelButtonClass, onClick: onCancel, children: settings.cancelButtonText })), settings.acceptButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'accept', buttonClass: settings.acceptButtonClass, onClick: onAccept, children: settings.acceptButtonText }))] }))] }) }));
|
|
52
|
+
root.render(Component);
|
|
53
|
+
});
|
package/dist/esm/form/Form.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { memo } from "react";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
var onKeyDown = function (e) {
|
|
3
|
+
export const Form = memo(function FunctionMemo({ encType = "multipart/form-data", onSubmit, style, disableOnEnterSubmit = false, ...other }) {
|
|
4
|
+
const onKeyDown = (e) => {
|
|
7
5
|
if (e.key === "Enter" && disableOnEnterSubmit) {
|
|
8
6
|
e.preventDefault();
|
|
9
7
|
}
|
|
10
8
|
};
|
|
11
|
-
return _jsx("form",
|
|
9
|
+
return _jsx("form", { style: style, encType: encType, onSubmit: onSubmit, onKeyDown: onKeyDown, ...other });
|
|
12
10
|
});
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import React, { memo, useEffect, useMemo } from 'react';
|
|
4
3
|
import { Col, Row } from '../grid';
|
|
5
4
|
import { isDev } from '../_lib/baseFunctions';
|
|
6
5
|
import { Label } from './Label';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
useEffect(
|
|
6
|
+
export const FormOlustur = memo(function FunctionMemo(props) {
|
|
7
|
+
const { form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing } = props;
|
|
8
|
+
useEffect(() => {
|
|
10
9
|
if (formOgeler && onChange && form) {
|
|
11
|
-
formOgeler.forEach(
|
|
10
|
+
formOgeler.forEach((formOgeler) => {
|
|
12
11
|
var _a, _b, _c, _d;
|
|
13
|
-
|
|
12
|
+
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;
|
|
14
13
|
if (formOgeler.noRender && fieldName && form[fieldName] && form[fieldName] != '') {
|
|
15
14
|
isDev && console.log('noRenderGuncelle');
|
|
16
15
|
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)) {
|
|
@@ -25,27 +24,26 @@ export var FormOlustur = memo(function FunctionMemo(props) {
|
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
26
|
}, [JSON.stringify(form), formOgeler]);
|
|
28
|
-
|
|
29
|
-
return formOgeler.map(
|
|
30
|
-
var noRender = _a.noRender, fullComponent = _a.fullComponent, component = _a.component, propsComponent = _a.propsComponent, propsRow = _a.propsRow, label = _a.label, propsLabel = _a.propsLabel, gridLabel = _a.gridLabel, gridInput = _a.gridInput;
|
|
27
|
+
const result = useMemo(() => {
|
|
28
|
+
return formOgeler.map(({ noRender, fullComponent, component, propsComponent, propsRow, label, propsLabel, gridLabel, gridInput }, i) => {
|
|
31
29
|
if (noRender) {
|
|
32
30
|
return null;
|
|
33
31
|
}
|
|
34
32
|
if (fullComponent)
|
|
35
33
|
return React.cloneElement(fullComponent, { key: i });
|
|
36
|
-
|
|
34
|
+
let newProps = { ...propsComponent };
|
|
37
35
|
if (onChange && component && !component.props.onChange) {
|
|
38
|
-
newProps =
|
|
36
|
+
newProps = { ...newProps, onChange };
|
|
39
37
|
}
|
|
40
38
|
if (onChange && form && component.props.name && !component.props.value) {
|
|
41
|
-
newProps =
|
|
39
|
+
newProps = { ...newProps, value: form[component.props.name] && form[component.props.name].length > 0 ? String(form[component.props.name]) : '' };
|
|
42
40
|
}
|
|
43
41
|
if (formType === 'label')
|
|
44
|
-
newProps =
|
|
45
|
-
|
|
46
|
-
gridLabel =
|
|
47
|
-
gridInput =
|
|
48
|
-
return (_jsxs(Row,
|
|
42
|
+
newProps = { ...newProps, label: '' };
|
|
43
|
+
const detectLabel = label || component.props.label;
|
|
44
|
+
gridLabel = { ...sabitGrid.label, ...gridLabel };
|
|
45
|
+
gridInput = { ...sabitGrid.input, ...gridInput };
|
|
46
|
+
return (_jsxs(Row, { justifyContent: justifyContent, rowSpacing: rowSpacing, colSpacing: colSpacing, ...propsRow, children: [formType === 'label' && detectLabel && (_jsx(Col, { ...gridLabel, children: _jsx(Label, { required: component.props.required, ...propsLabel, children: detectLabel }) })), _jsx(Col, { ...gridInput, children: React.cloneElement(component, newProps) })] }, i));
|
|
49
47
|
});
|
|
50
48
|
}, [form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing]);
|
|
51
49
|
return _jsx(React.Fragment, { children: result });
|
package/dist/esm/form/Input.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
/**
|
|
4
3
|
* @author : izzetseydaoglu
|
|
@@ -11,60 +10,62 @@ import { applyInputMask } from '../_lib/inputMask';
|
|
|
11
10
|
import { alert_add } from '../alert';
|
|
12
11
|
import { Dialog } from './Dialog';
|
|
13
12
|
import styles from './styles/Input.module.css';
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
useEffect(function () {
|
|
13
|
+
export 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
|
+
clearIfNotMatch: true,
|
|
15
|
+
reverse: false, //Tersten doldurmaya başla, fiyatlar için geçerli
|
|
16
|
+
selectOnFocus: false
|
|
17
|
+
} }) => {
|
|
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(() => {
|
|
26
24
|
if (inputRef)
|
|
27
25
|
inputRef.current = refInput.current;
|
|
28
26
|
if (componentRef)
|
|
29
27
|
componentRef.current = refMain.current;
|
|
30
28
|
}, [componentRef, inputRef]);
|
|
31
|
-
useEffect(
|
|
29
|
+
useEffect(() => {
|
|
32
30
|
autoSelectText && !select && (refInput === null || refInput === void 0 ? void 0 : refInput.current) && refInput.current.select();
|
|
33
31
|
}, [autoSelectText, select]);
|
|
34
|
-
useEffect(
|
|
32
|
+
useEffect(() => {
|
|
35
33
|
var _a, _b;
|
|
36
|
-
|
|
34
|
+
const filled = String(value) && value.toString().length > 0 ? true : false;
|
|
37
35
|
setInputFilled(filled);
|
|
38
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(styles.error));
|
|
39
37
|
}, [value]);
|
|
40
|
-
useEffect(
|
|
38
|
+
useEffect(() => {
|
|
41
39
|
// if (type === "number") sadeceSayi = true; //TODO: sadeceSayi burada değiştirelemez ki!!!
|
|
42
40
|
if (select && ilkSec && (value === '' || value === null || value === undefined)) {
|
|
43
41
|
if (select.length) {
|
|
44
|
-
|
|
45
|
-
onChange && onChange({ target: { name
|
|
42
|
+
const ilkItem = select[0][valueKey] ? select[0][valueKey] : '';
|
|
43
|
+
onChange && onChange({ target: { name, value: ilkItem } });
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
}, [select]);
|
|
49
|
-
useEffect(
|
|
47
|
+
useEffect(() => {
|
|
50
48
|
var _a;
|
|
51
49
|
if (typeof window !== 'undefined' && (mask === null || mask === void 0 ? void 0 : mask.length) > 0 && (refInput === null || refInput === void 0 ? void 0 : refInput.current)) {
|
|
52
50
|
(_a = refInput.current) === null || _a === void 0 ? void 0 : _a.setAttribute('autocomplete', 'off');
|
|
53
51
|
}
|
|
54
52
|
if ((mask === null || mask === void 0 ? void 0 : mask.length) > 0 && (refInput === null || refInput === void 0 ? void 0 : refInput.current)) {
|
|
55
|
-
|
|
53
|
+
const maskInstance = applyInputMask(refInput.current, mask, {
|
|
54
|
+
...maskSettings,
|
|
55
|
+
onChange: (masked, clean, e) => {
|
|
56
56
|
if (onChange) {
|
|
57
|
-
onChange({ target: { name
|
|
57
|
+
onChange({ target: { name, value: masked } });
|
|
58
58
|
}
|
|
59
59
|
if (maskSettings && maskSettings.onChange) {
|
|
60
60
|
maskSettings.onChange(masked, clean, e);
|
|
61
61
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
maskInstance === null || maskInstance === void 0 ? void 0 : maskInstance.setValue(value ? value : null);
|
|
65
|
+
return () => maskInstance === null || maskInstance === void 0 ? void 0 : maskInstance.destroy();
|
|
65
66
|
}
|
|
66
67
|
}, [mask]);
|
|
67
|
-
|
|
68
|
+
const Change = useCallback((e) => {
|
|
68
69
|
if (tumuBuyuk)
|
|
69
70
|
inputTumuBuyukCevir(e);
|
|
70
71
|
if (tumuKucuk)
|
|
@@ -74,13 +75,13 @@ export var Input = function (_a) {
|
|
|
74
75
|
setInputFilled(e.target.value.length > 0);
|
|
75
76
|
onChange ? onChange(e) : null;
|
|
76
77
|
}, [onChange, seoCevir, tumuBuyuk, tumuKucuk]);
|
|
77
|
-
|
|
78
|
+
const Focus = useCallback((e) => {
|
|
78
79
|
var _a, _b;
|
|
79
80
|
onFocus ? onFocus(e) : null;
|
|
80
81
|
setFocus(true);
|
|
81
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(styles.error);
|
|
82
83
|
}, [onFocus]);
|
|
83
|
-
|
|
84
|
+
const Blur = useCallback((e) => {
|
|
84
85
|
var _a, _b, _c, _d;
|
|
85
86
|
if (fileNameGiris && e.target.value !== '' && /[/\\?%*:|"'<>]/g.test(e.target.value)) {
|
|
86
87
|
e.target.value = e.target.value.replace(/[/\\?%*:|"'<>]/g, '-');
|
|
@@ -95,11 +96,11 @@ export var Input = function (_a) {
|
|
|
95
96
|
alert_add({ type: 'error', message: 'Lütfen doğru bir dosya numarası giriniz. Örn: 2022/123' });
|
|
96
97
|
}
|
|
97
98
|
if (dateGecmisKontrol && e.target.value !== '') {
|
|
98
|
-
|
|
99
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
99
100
|
if (e.target.value < today) {
|
|
100
101
|
Dialog({
|
|
101
102
|
message: 'Geçmiş bir tarihi seçtiniz. Devam etmek istiyor musunuz?'
|
|
102
|
-
}).then(
|
|
103
|
+
}).then((r) => {
|
|
103
104
|
if (!r) {
|
|
104
105
|
e.target.value = '';
|
|
105
106
|
if (onChange)
|
|
@@ -118,15 +119,15 @@ export var Input = function (_a) {
|
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
if (value !== e.target.value) {
|
|
121
|
-
onChange && onChange({ target: { name
|
|
122
|
+
onChange && onChange({ target: { name, value: e.target.value } });
|
|
122
123
|
}
|
|
123
124
|
onBlur ? onBlur(e) : null;
|
|
124
125
|
setFocus(false);
|
|
125
126
|
}, [fileNameGiris, dosyaNoGiris, dateGecmisKontrol, required, value, onBlur, onChange, name]);
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
const Click = useCallback((e) => (onClick ? onClick(e) : null), [onClick]);
|
|
128
|
+
const KeyPress = useCallback((e) => {
|
|
128
129
|
if (sadeceYazi) {
|
|
129
|
-
|
|
130
|
+
const turkishLetters = /[ğüşıöçĞÜŞİÖÇ]/;
|
|
130
131
|
if (!(/[A-Za-z\s.]/.test(e.key) || turkishLetters.test(e.key))) {
|
|
131
132
|
e.preventDefault();
|
|
132
133
|
return;
|
|
@@ -139,19 +140,19 @@ export var Input = function (_a) {
|
|
|
139
140
|
}
|
|
140
141
|
onKeyPress ? onKeyPress(e) : null;
|
|
141
142
|
}, [sadeceYazi, sadeceSayi, dosyaNoGiris, onKeyPress]);
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
const KeyUp = useCallback((e) => (onKeyUp ? onKeyUp(e) : null), [onKeyUp]);
|
|
144
|
+
const KeyDown = useCallback((e) => {
|
|
144
145
|
onKeyDown ? onKeyDown(e) : null;
|
|
145
146
|
}, [onKeyDown]);
|
|
146
|
-
|
|
147
|
+
const ortakProps = {
|
|
147
148
|
ref: refInput,
|
|
148
|
-
id
|
|
149
|
-
name
|
|
150
|
-
value
|
|
151
|
-
autoFocus
|
|
152
|
-
disabled
|
|
153
|
-
required
|
|
154
|
-
placeholder
|
|
149
|
+
id,
|
|
150
|
+
name,
|
|
151
|
+
value,
|
|
152
|
+
autoFocus,
|
|
153
|
+
disabled,
|
|
154
|
+
required,
|
|
155
|
+
placeholder,
|
|
155
156
|
onChange: Change,
|
|
156
157
|
onFocus: Focus,
|
|
157
158
|
onBlur: Blur,
|
|
@@ -160,22 +161,22 @@ export var Input = function (_a) {
|
|
|
160
161
|
onKeyUp: KeyUp,
|
|
161
162
|
onKeyDown: KeyDown
|
|
162
163
|
};
|
|
163
|
-
|
|
164
|
+
let component;
|
|
164
165
|
if (select) {
|
|
165
|
-
component = (_jsxs("select",
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
component = (_jsxs("select", { className: `${styles.input} ${styles.select}`, ...ortakProps, ...propsInput, children: [ilkSec === false && _jsx("option", { value: '' }), select.map((item) => {
|
|
167
|
+
const value = item[valueKey];
|
|
168
|
+
const label = item[labelKey];
|
|
168
169
|
return (_jsx("option", { value: value, children: label ? label : value }, value));
|
|
169
|
-
})] }))
|
|
170
|
+
})] }));
|
|
170
171
|
}
|
|
171
172
|
else if (multiline) {
|
|
172
|
-
component = _jsx("textarea",
|
|
173
|
+
component = _jsx("textarea", { className: `${styles.input} ${styles.textarea}`, rows: rows, ...ortakProps, ...propsInput });
|
|
173
174
|
}
|
|
174
175
|
else {
|
|
175
|
-
component = _jsx("input",
|
|
176
|
+
component = _jsx("input", { className: `${styles.input}`, type: type, ...ortakProps, ...propsInput });
|
|
176
177
|
}
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
const classList = () => {
|
|
179
|
+
const list = ['sInputComponent', styles.component];
|
|
179
180
|
if (className)
|
|
180
181
|
list.push(className);
|
|
181
182
|
if (label) {
|
|
@@ -184,13 +185,13 @@ export var Input = function (_a) {
|
|
|
184
185
|
// if (props.required && (value.length === 0 || !value)) list.push("error");
|
|
185
186
|
return list.join(' ');
|
|
186
187
|
};
|
|
187
|
-
useEffect(
|
|
188
|
+
useEffect(() => {
|
|
188
189
|
if (propsComponent && propsComponent.hasOwnProperty('style')) {
|
|
189
|
-
|
|
190
|
+
const background = propsComponent.style.background ? propsComponent.style.background : propsComponent.style.backgroundColor ? propsComponent.style.backgroundColor : null;
|
|
190
191
|
if (background && refLabel.current) {
|
|
191
192
|
refLabel.current.style.setProperty('--label-bg', background);
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
}, [propsComponent]);
|
|
195
|
-
return (_jsxs("div",
|
|
196
|
+
return (_jsxs("div", { ref: refMain, className: classList(), "data-disabled": disabled, ...propsComponent, children: [startAdornment && _jsx("div", { className: `adornment_start ${styles.adornment} ${styles.start}`, children: startAdornment }), _jsxs("div", { className: `${styles.inputBase} ${inputFilled || focus || type == 'date' ? styles.open : ''}`, children: [component, label && (_jsxs("div", { ref: refLabel, className: `label ${styles.label}`, children: [label, required && _jsx("span", { className: styles.required, children: "*" })] }))] }), (endAdornment || loading) && (_jsxs("div", { className: `adornment_end ${styles.adornment} ${styles.end}`, children: [endAdornment, loading && _jsx("div", { className: styles.loading })] }))] }));
|
|
196
197
|
};
|
package/dist/esm/form/Label.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { memo } from 'react';
|
|
4
3
|
import { Tooltip } from '../tooltip';
|
|
5
4
|
import styles from './styles/Label.module.css';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
return (_jsxs("label", __assign({ className: styles.label }, other, { children: [children, _jsx(Tooltip, { title: 'Zorunlu Alan', children: _jsx("span", { className: styles.required, children: required && '*' }) })] })));
|
|
5
|
+
export const Label = memo(function FMemo({ required = false, children, ...other }) {
|
|
6
|
+
return (_jsxs("label", { className: styles.label, ...other, children: [children, _jsx(Tooltip, { title: 'Zorunlu Alan', children: _jsx("span", { className: styles.required, children: required && '*' }) })] }));
|
|
9
7
|
});
|