@sydsoft/base 1.56.0 → 1.58.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/package.json +7 -7
- package/dist/esm/_lib/baseFunctions.d.ts +0 -11
- package/dist/esm/_lib/baseFunctions.js +0 -97
- package/dist/esm/_lib/inputMask.d.ts +0 -7
- package/dist/esm/_lib/inputMask.js +0 -229
- package/dist/esm/_lib/listFunctions.d.ts +0 -2
- package/dist/esm/_lib/listFunctions.js +0 -114
- package/dist/esm/_lib/storage/cookies.d.ts +0 -4
- package/dist/esm/_lib/storage/cookies.js +0 -34
- package/dist/esm/_lib/storage/encData.d.ts +0 -2
- package/dist/esm/_lib/storage/encData.js +0 -43
- package/dist/esm/_lib/storage/localStorage.d.ts +0 -6
- package/dist/esm/_lib/storage/localStorage.js +0 -69
- package/dist/esm/_lib/storage/sessionStorage.d.ts +0 -6
- package/dist/esm/_lib/storage/sessionStorage.js +0 -69
- package/dist/esm/_lib/useInterval.d.ts +0 -6
- package/dist/esm/_lib/useInterval.js +0 -24
- package/dist/esm/alert/index.d.ts +0 -18
- package/dist/esm/alert/index.js +0 -107
- package/dist/esm/alert/index.module.css +0 -119
- package/dist/esm/box/Box.d.ts +0 -9
- package/dist/esm/box/Box.js +0 -15
- package/dist/esm/box/Box.module.css +0 -153
- package/dist/esm/box/BoxContent.d.ts +0 -9
- package/dist/esm/box/BoxContent.js +0 -7
- package/dist/esm/box/BoxFooter.d.ts +0 -10
- package/dist/esm/box/BoxFooter.js +0 -8
- package/dist/esm/box/BoxHeader.d.ts +0 -16
- package/dist/esm/box/BoxHeader.js +0 -9
- package/dist/esm/box/index.d.ts +0 -9
- package/dist/esm/box/index.js +0 -9
- package/dist/esm/countDown/index.d.ts +0 -22
- package/dist/esm/countDown/index.js +0 -97
- package/dist/esm/dateTime/index.d.ts +0 -12
- package/dist/esm/dateTime/index.js +0 -76
- package/dist/esm/form/Button.d.ts +0 -27
- package/dist/esm/form/Button.js +0 -76
- package/dist/esm/form/Checkbox.d.ts +0 -23
- package/dist/esm/form/Checkbox.js +0 -23
- package/dist/esm/form/Dialog.d.ts +0 -20
- package/dist/esm/form/Dialog.js +0 -40
- package/dist/esm/form/Form.d.ts +0 -10
- package/dist/esm/form/Form.js +0 -12
- package/dist/esm/form/FormOlustur.d.ts +0 -39
- package/dist/esm/form/FormOlustur.js +0 -52
- package/dist/esm/form/Input.d.ts +0 -66
- package/dist/esm/form/Input.js +0 -196
- package/dist/esm/form/Label.d.ts +0 -7
- package/dist/esm/form/Label.js +0 -9
- package/dist/esm/form/SearchableInput.d.ts +0 -37
- package/dist/esm/form/SearchableInput.js +0 -272
- package/dist/esm/form/UploadBase.d.ts +0 -25
- package/dist/esm/form/UploadBase.js +0 -86
- package/dist/esm/form/index.d.ts +0 -9
- package/dist/esm/form/index.js +0 -9
- package/dist/esm/form/styles/Button.module.css +0 -145
- package/dist/esm/form/styles/Input.module.css +0 -221
- package/dist/esm/form/styles/Label.module.css +0 -31
- package/dist/esm/form/styles/SearchableInput.module.css +0 -80
- package/dist/esm/grid/index.d.ts +0 -38
- package/dist/esm/grid/index.js +0 -97
- package/dist/esm/grid/index.module.css +0 -805
- package/dist/esm/icon/icons.d.ts +0 -22
- package/dist/esm/icon/icons.js +0 -23
- package/dist/esm/icon/index.d.ts +0 -34
- package/dist/esm/icon/index.js +0 -26
- package/dist/esm/icon/mui.d.ts +0 -1
- package/dist/esm/icon/mui.js +0 -1
- package/dist/esm/index.d.ts +0 -19
- package/dist/esm/index.js +0 -19
- package/dist/esm/menu/index.d.ts +0 -69
- package/dist/esm/menu/index.js +0 -52
- package/dist/esm/menu/index.module.css +0 -92
- package/dist/esm/modal/index.d.ts +0 -23
- package/dist/esm/modal/index.js +0 -66
- package/dist/esm/modal/index.module.css +0 -77
- package/dist/esm/popover/index.d.ts +0 -26
- package/dist/esm/popover/index.js +0 -343
- package/dist/esm/popover/index.module.css +0 -89
- package/dist/esm/tooltip/index.d.ts +0 -11
- package/dist/esm/tooltip/index.js +0 -119
package/dist/esm/form/Input.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* @author : izzetseydaoglu
|
|
5
|
-
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
6
|
-
* @version : 2026-01-21 21:35:48
|
|
7
|
-
*/
|
|
8
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
9
|
-
import { convertForSEO, inputTumuBuyukCevir, inputTumuKucukCevir } from '../_lib/baseFunctions';
|
|
10
|
-
import { applyInputMask } from '../_lib/inputMask';
|
|
11
|
-
import { alert_add } from '../alert';
|
|
12
|
-
import { Dialog } from './Dialog';
|
|
13
|
-
import styles from './styles/Input.module.css';
|
|
14
|
-
export var Input = function (_a) {
|
|
15
|
-
var componentRef = _a.componentRef, inputRef = _a.inputRef, className = _a.className, propsComponent = _a.propsComponent, propsInput = _a.propsInput, id = _a.id, name = _a.name, _b = _a.value, value = _b === void 0 ? '' : _b, type = _a.type, label = _a.label, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, placeholder = _a.placeholder, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, onClick = _a.onClick, onKeyPress = _a.onKeyPress, onKeyUp = _a.onKeyUp, onKeyDown = _a.onKeyDown, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.required, required = _d === void 0 ? false : _d, _e = _a.loading, loading = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, select = _a.select, _g = _a.valueKey, valueKey = _g === void 0 ? 'value' : _g, _h = _a.labelKey, labelKey = _h === void 0 ? 'label' : _h, _j = _a.ilkSec, ilkSec = _j === void 0 ? false : _j, _k = _a.multiline, multiline = _k === void 0 ? false : _k, _l = _a.rows, rows = _l === void 0 ? 2 : _l, sadeceYazi = _a.sadeceYazi, sadeceSayi = _a.sadeceSayi, tumuBuyuk = _a.tumuBuyuk, tumuKucuk = _a.tumuKucuk, seoCevir = _a.seoCevir, dosyaNoGiris = _a.dosyaNoGiris, fileNameGiris = _a.fileNameGiris, dateGecmisKontrol = _a.dateGecmisKontrol, autoSelectText = _a.autoSelectText, _m = _a.mask, mask = _m === void 0 ? '' : _m, _o = _a.maskSettings, maskSettings = _o === void 0 ? {
|
|
16
|
-
clearIfNotMatch: true,
|
|
17
|
-
reverse: false, //Tersten doldurmaya başla, fiyatlar için geçerli
|
|
18
|
-
selectOnFocus: false
|
|
19
|
-
} : _o;
|
|
20
|
-
var refMain = useRef(null);
|
|
21
|
-
var refInput = useRef(null);
|
|
22
|
-
var refLabel = useRef(null);
|
|
23
|
-
var _p = useState(value && value.toString().length > 0), inputFilled = _p[0], setInputFilled = _p[1];
|
|
24
|
-
var _q = useState(false), focus = _q[0], setFocus = _q[1];
|
|
25
|
-
useEffect(function () {
|
|
26
|
-
if (inputRef)
|
|
27
|
-
inputRef.current = refInput.current;
|
|
28
|
-
if (componentRef)
|
|
29
|
-
componentRef.current = refMain.current;
|
|
30
|
-
}, [componentRef, inputRef]);
|
|
31
|
-
useEffect(function () {
|
|
32
|
-
autoSelectText && !select && (refInput === null || refInput === void 0 ? void 0 : refInput.current) && refInput.current.select();
|
|
33
|
-
}, [autoSelectText, select]);
|
|
34
|
-
useEffect(function () {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
var filled = String(value) && value.toString().length > 0 ? true : false;
|
|
37
|
-
setInputFilled(filled);
|
|
38
|
-
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
|
-
}, [value]);
|
|
40
|
-
useEffect(function () {
|
|
41
|
-
// if (type === "number") sadeceSayi = true; //TODO: sadeceSayi burada değiştirelemez ki!!!
|
|
42
|
-
if (select && ilkSec && (value === '' || value === null || value === undefined)) {
|
|
43
|
-
if (select.length) {
|
|
44
|
-
var ilkItem = select[0][valueKey] ? select[0][valueKey] : '';
|
|
45
|
-
onChange && onChange({ target: { name: name, value: ilkItem } });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, [select]);
|
|
49
|
-
useEffect(function () {
|
|
50
|
-
var _a;
|
|
51
|
-
if (typeof window !== 'undefined' && (mask === null || mask === void 0 ? void 0 : mask.length) > 0 && (refInput === null || refInput === void 0 ? void 0 : refInput.current)) {
|
|
52
|
-
(_a = refInput.current) === null || _a === void 0 ? void 0 : _a.setAttribute('autocomplete', 'off');
|
|
53
|
-
}
|
|
54
|
-
if ((mask === null || mask === void 0 ? void 0 : mask.length) > 0 && (refInput === null || refInput === void 0 ? void 0 : refInput.current)) {
|
|
55
|
-
var maskInstance_1 = applyInputMask(refInput.current, mask, __assign(__assign({}, maskSettings), { onChange: function (masked, clean, e) {
|
|
56
|
-
if (onChange) {
|
|
57
|
-
onChange({ target: { name: name, value: masked } });
|
|
58
|
-
}
|
|
59
|
-
if (maskSettings && maskSettings.onChange) {
|
|
60
|
-
maskSettings.onChange(masked, clean, e);
|
|
61
|
-
}
|
|
62
|
-
} }));
|
|
63
|
-
maskInstance_1 === null || maskInstance_1 === void 0 ? void 0 : maskInstance_1.setValue(value ? value : null);
|
|
64
|
-
return function () { return maskInstance_1 === null || maskInstance_1 === void 0 ? void 0 : maskInstance_1.destroy(); };
|
|
65
|
-
}
|
|
66
|
-
}, [mask]);
|
|
67
|
-
var Change = useCallback(function (e) {
|
|
68
|
-
if (tumuBuyuk)
|
|
69
|
-
inputTumuBuyukCevir(e);
|
|
70
|
-
if (tumuKucuk)
|
|
71
|
-
inputTumuKucukCevir(e);
|
|
72
|
-
if (seoCevir)
|
|
73
|
-
convertForSEO(e);
|
|
74
|
-
setInputFilled(e.target.value.length > 0);
|
|
75
|
-
onChange ? onChange(e) : null;
|
|
76
|
-
}, [onChange, seoCevir, tumuBuyuk, tumuKucuk]);
|
|
77
|
-
var Focus = useCallback(function (e) {
|
|
78
|
-
var _a, _b;
|
|
79
|
-
onFocus ? onFocus(e) : null;
|
|
80
|
-
setFocus(true);
|
|
81
|
-
(_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
|
-
}, [onFocus]);
|
|
83
|
-
var Blur = useCallback(function (e) {
|
|
84
|
-
var _a, _b, _c, _d;
|
|
85
|
-
if (fileNameGiris && e.target.value !== '' && /[/\\?%*:|"'<>]/g.test(e.target.value)) {
|
|
86
|
-
e.target.value = e.target.value.replace(/[/\\?%*:|"'<>]/g, '-');
|
|
87
|
-
if (onChange)
|
|
88
|
-
onChange(e);
|
|
89
|
-
alert_add({ type: 'warning', message: 'Lütfen dosya adındaki özel karakter değiştirildi.' });
|
|
90
|
-
}
|
|
91
|
-
if (dosyaNoGiris && e.target.value !== '' && !/^[1-2]\d{3}\/\d/.test(e.target.value)) {
|
|
92
|
-
e.target.value = '';
|
|
93
|
-
if (onChange)
|
|
94
|
-
onChange(e);
|
|
95
|
-
alert_add({ type: 'error', message: 'Lütfen doğru bir dosya numarası giriniz. Örn: 2022/123' });
|
|
96
|
-
}
|
|
97
|
-
if (dateGecmisKontrol && e.target.value !== '') {
|
|
98
|
-
var today = new Date().toISOString().slice(0, 10);
|
|
99
|
-
if (e.target.value < today) {
|
|
100
|
-
Dialog({
|
|
101
|
-
message: 'Geçmiş bir tarihi seçtiniz. Devam etmek istiyor musunuz?'
|
|
102
|
-
}).then(function (r) {
|
|
103
|
-
if (!r) {
|
|
104
|
-
e.target.value = '';
|
|
105
|
-
if (onChange)
|
|
106
|
-
onChange(e);
|
|
107
|
-
e.target.focus();
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (required) {
|
|
113
|
-
if (e.target.value === '') {
|
|
114
|
-
(_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(styles.error);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
(_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(styles.error);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (value !== e.target.value) {
|
|
121
|
-
onChange && onChange({ target: { name: name, value: e.target.value } });
|
|
122
|
-
}
|
|
123
|
-
onBlur ? onBlur(e) : null;
|
|
124
|
-
setFocus(false);
|
|
125
|
-
}, [fileNameGiris, dosyaNoGiris, dateGecmisKontrol, required, value, onBlur, onChange, name]);
|
|
126
|
-
var Click = useCallback(function (e) { return (onClick ? onClick(e) : null); }, [onClick]);
|
|
127
|
-
var KeyPress = useCallback(function (e) {
|
|
128
|
-
if (sadeceYazi) {
|
|
129
|
-
var turkishLetters = /[ğüşıöçĞÜŞİÖÇ]/;
|
|
130
|
-
if (!(/[A-Za-z\s.]/.test(e.key) || turkishLetters.test(e.key))) {
|
|
131
|
-
e.preventDefault();
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if ((sadeceSayi || dosyaNoGiris) && (e.which < 48 || e.which > 57))
|
|
136
|
-
e.preventDefault();
|
|
137
|
-
if (dosyaNoGiris && e.which !== 8 && e.target.value.length === 4 && e.target.value.search('/') === -1) {
|
|
138
|
-
e.target.value = e.target.value + '/';
|
|
139
|
-
}
|
|
140
|
-
onKeyPress ? onKeyPress(e) : null;
|
|
141
|
-
}, [sadeceYazi, sadeceSayi, dosyaNoGiris, onKeyPress]);
|
|
142
|
-
var KeyUp = useCallback(function (e) { return (onKeyUp ? onKeyUp(e) : null); }, [onKeyUp]);
|
|
143
|
-
var KeyDown = useCallback(function (e) {
|
|
144
|
-
onKeyDown ? onKeyDown(e) : null;
|
|
145
|
-
}, [onKeyDown]);
|
|
146
|
-
var ortakProps = {
|
|
147
|
-
ref: refInput,
|
|
148
|
-
id: id,
|
|
149
|
-
name: name,
|
|
150
|
-
value: value,
|
|
151
|
-
autoFocus: autoFocus,
|
|
152
|
-
disabled: disabled,
|
|
153
|
-
required: required,
|
|
154
|
-
placeholder: placeholder,
|
|
155
|
-
onChange: Change,
|
|
156
|
-
onFocus: Focus,
|
|
157
|
-
onBlur: Blur,
|
|
158
|
-
onClick: Click,
|
|
159
|
-
onKeyPress: KeyPress,
|
|
160
|
-
onKeyUp: KeyUp,
|
|
161
|
-
onKeyDown: KeyDown
|
|
162
|
-
};
|
|
163
|
-
var component;
|
|
164
|
-
if (select) {
|
|
165
|
-
component = (_jsxs("select", __assign({ className: "".concat(styles.input, " ").concat(styles.select) }, ortakProps, propsInput, { children: [ilkSec === false && _jsx("option", { value: '' }), select.map(function (item) {
|
|
166
|
-
var value = item[valueKey];
|
|
167
|
-
var label = item[labelKey];
|
|
168
|
-
return (_jsx("option", { value: value, children: label ? label : value }, value));
|
|
169
|
-
})] })));
|
|
170
|
-
}
|
|
171
|
-
else if (multiline) {
|
|
172
|
-
component = _jsx("textarea", __assign({ className: "".concat(styles.input, " ").concat(styles.textarea), rows: rows }, ortakProps, propsInput));
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
component = _jsx("input", __assign({ className: "".concat(styles.input), type: type }, ortakProps, propsInput));
|
|
176
|
-
}
|
|
177
|
-
var classList = function () {
|
|
178
|
-
var list = ['sInputComponent', styles.component];
|
|
179
|
-
if (className)
|
|
180
|
-
list.push(className);
|
|
181
|
-
if (label) {
|
|
182
|
-
list.push(styles.hidePlaceHolder);
|
|
183
|
-
}
|
|
184
|
-
// if (props.required && (value.length === 0 || !value)) list.push("error");
|
|
185
|
-
return list.join(' ');
|
|
186
|
-
};
|
|
187
|
-
useEffect(function () {
|
|
188
|
-
if (propsComponent && propsComponent.hasOwnProperty('style')) {
|
|
189
|
-
var background = propsComponent.style.background ? propsComponent.style.background : propsComponent.style.backgroundColor ? propsComponent.style.backgroundColor : null;
|
|
190
|
-
if (background && refLabel.current) {
|
|
191
|
-
refLabel.current.style.setProperty('--label-bg', background);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}, [propsComponent]);
|
|
195
|
-
return (_jsxs("div", __assign({ ref: refMain, className: classList(), "data-disabled": disabled }, propsComponent, { children: [startAdornment && _jsx("div", { className: "adornment_start ".concat(styles.adornment, " ").concat(styles.start), children: startAdornment }), _jsxs("div", { className: "".concat(styles.inputBase, " ").concat(inputFilled || focus || type == 'date' ? styles.open : ''), children: [component, label && (_jsxs("div", { ref: refLabel, className: "label ".concat(styles.label), children: [label, required && _jsx("span", { className: styles.required, children: "*" })] }))] }), (endAdornment || loading) && (_jsxs("div", { className: "adornment_end ".concat(styles.adornment, " ").concat(styles.end), children: [endAdornment, loading && _jsx("div", { className: styles.loading })] }))] })));
|
|
196
|
-
};
|
package/dist/esm/form/Label.d.ts
DELETED
package/dist/esm/form/Label.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { Tooltip } from '../tooltip';
|
|
5
|
-
import styles from './styles/Label.module.css';
|
|
6
|
-
export var Label = memo(function FMemo(_a) {
|
|
7
|
-
var _b = _a.required, required = _b === void 0 ? false : _b, children = _a.children, other = __rest(_a, ["required", "children"]);
|
|
8
|
-
return (_jsxs("label", __assign({ className: styles.label }, other, { children: [children, _jsx(Tooltip, { title: 'Zorunlu Alan', children: _jsx("span", { className: styles.required, children: required && '*' }) })] })));
|
|
9
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { PropsInput } from './index';
|
|
2
|
-
type typeList = {
|
|
3
|
-
value?: string;
|
|
4
|
-
label?: string;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
};
|
|
7
|
-
type typeValue = string | number | undefined;
|
|
8
|
-
interface Props extends PropsInput {
|
|
9
|
-
autoCompleteList?: typeList[];
|
|
10
|
-
isDataFromApi: boolean;
|
|
11
|
-
value: typeValue;
|
|
12
|
-
valueKey?: string;
|
|
13
|
-
labelKey?: string;
|
|
14
|
-
itemComponent?: (option: typeList) => React.ReactNode;
|
|
15
|
-
parentInputValue?: typeValue;
|
|
16
|
-
onChange?: (e: any) => void;
|
|
17
|
-
onText?: (text: string) => void;
|
|
18
|
-
onSelect?: (item: any) => void;
|
|
19
|
-
onLoad?: (value: typeValue) => void;
|
|
20
|
-
ilkSec?: boolean;
|
|
21
|
-
newCreate?: boolean;
|
|
22
|
-
style?: React.CSSProperties;
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
listPositionRelative?: boolean;
|
|
25
|
-
loadingMessage?: string;
|
|
26
|
-
notFoundMessage?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface SearchableInputRef {
|
|
29
|
-
setAutoCompleteList: (list: typeList[], value?: typeValue, callback?: () => void) => void;
|
|
30
|
-
clear: (openList?: boolean, focusInput?: boolean) => void;
|
|
31
|
-
open: () => void;
|
|
32
|
-
close: () => void;
|
|
33
|
-
checkByValue: (value: typeValue, openList?: boolean) => void;
|
|
34
|
-
setLoading: (loading: boolean) => void;
|
|
35
|
-
}
|
|
36
|
-
export declare const SearchableInput: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<SearchableInputRef>>;
|
|
37
|
-
export {};
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { __assign, __rest, __spreadArray } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button, Input } from './index';
|
|
4
|
-
import { convertForSearch, convertLowerCase } from '../_lib/baseFunctions';
|
|
5
|
-
import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
-
import { onKeyboardSelection, setScrollListPosition } from '../_lib/listFunctions';
|
|
7
|
-
import { Icon } from '../icon';
|
|
8
|
-
import styles from './styles/SearchableInput.module.css';
|
|
9
|
-
export var SearchableInput = forwardRef(function (_a, ref) {
|
|
10
|
-
var _b = _a.autoCompleteList, autoCompleteList = _b === void 0 ? [] : _b, isDataFromApi = _a.isDataFromApi, name = _a.name, value = _a.value, parentInputValue = _a.parentInputValue, disabled = _a.disabled, itemComponent = _a.itemComponent, _c = _a.valueKey, valueKey = _c === void 0 ? 'value' : _c, _d = _a.labelKey, labelKey = _d === void 0 ? 'label' : _d, onSelect = _a.onSelect, onChange = _a.onChange, onText = _a.onText, onLoad = _a.onLoad, style = _a.style, _e = _a.listPositionRelative, listPositionRelative = _e === void 0 ? false : _e, _f = _a.loadingMessage, loadingMessage = _f === void 0 ? 'Lütfen bekleyiniz...' : _f, _g = _a.notFoundMessage, notFoundMessage = _g === void 0 ? 'Kayıt bulunamadı...' : _g, placeholder = _a.placeholder, endAdornment = _a.endAdornment, _h = _a.ilkSec, ilkSec = _h === void 0 ? false : _h, _j = _a.newCreate, newCreate = _j === void 0 ? false : _j, inputRef = _a.inputRef, other = __rest(_a, ["autoCompleteList", "isDataFromApi", "name", "value", "parentInputValue", "disabled", "itemComponent", "valueKey", "labelKey", "onSelect", "onChange", "onText", "onLoad", "style", "listPositionRelative", "loadingMessage", "notFoundMessage", "placeholder", "endAdornment", "ilkSec", "newCreate", "inputRef"]);
|
|
11
|
-
var refMain = useRef(null);
|
|
12
|
-
var refInput = useRef(null);
|
|
13
|
-
var refList = useRef(null);
|
|
14
|
-
var _k = useState(autoCompleteList !== null && autoCompleteList !== void 0 ? autoCompleteList : []), data = _k[0], setData = _k[1];
|
|
15
|
-
var _l = useState(value !== null && value !== void 0 ? value : undefined), selectedValue = _l[0], setSelectedValue = _l[1];
|
|
16
|
-
var _m = useState(parentInputValue !== null && parentInputValue !== void 0 ? parentInputValue : undefined), parentValue = _m[0], setParentValue = _m[1];
|
|
17
|
-
var _o = useState(''), text = _o[0], setText = _o[1]; //Inputta görünen
|
|
18
|
-
var _p = useState(''), filter = _p[0], setFilter = _p[1]; // Filtrelemeye tabi tutulan
|
|
19
|
-
var _q = useState({ created: false }), newItemCreate = _q[0], setNewItemCreate = _q[1];
|
|
20
|
-
var _r = useState(false), open = _r[0], setOpen = _r[1];
|
|
21
|
-
var _s = useState(isDataFromApi && (!autoCompleteList || (autoCompleteList === null || autoCompleteList === void 0 ? void 0 : autoCompleteList.length) == 0)), loading = _s[0], setLoading = _s[1];
|
|
22
|
-
useImperativeHandle(ref, function () { return ({
|
|
23
|
-
setAutoCompleteList: function (list, value, callback) {
|
|
24
|
-
if (value === void 0) { value = undefined; }
|
|
25
|
-
if (autoCompleteList && (autoCompleteList === null || autoCompleteList === void 0 ? void 0 : autoCompleteList.length) > 0) {
|
|
26
|
-
alert('AutoCompleteList zaten tanımlı olduğundan dışardan data seti değiştirilemez.');
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
setData(list);
|
|
30
|
-
value && sendChange(value);
|
|
31
|
-
setLoading(false);
|
|
32
|
-
if (!Array.isArray(list) || list.length == 0) {
|
|
33
|
-
clear(false);
|
|
34
|
-
}
|
|
35
|
-
callback && callback();
|
|
36
|
-
// isDev && console.log("setAutoCompleteList =>", name, value, list);
|
|
37
|
-
},
|
|
38
|
-
clear: function (openList, focusInput) {
|
|
39
|
-
if (openList === void 0) { openList = false; }
|
|
40
|
-
if (focusInput === void 0) { focusInput = false; }
|
|
41
|
-
return clear(openList, focusInput);
|
|
42
|
-
},
|
|
43
|
-
open: function () {
|
|
44
|
-
setOpen(true);
|
|
45
|
-
refInput.current && refInput.current.focus();
|
|
46
|
-
},
|
|
47
|
-
close: function () { return setOpen(false); },
|
|
48
|
-
checkByValue: function (value, openList) {
|
|
49
|
-
if (openList === void 0) { openList = false; }
|
|
50
|
-
return checkByValue(value, openList);
|
|
51
|
-
},
|
|
52
|
-
setLoading: function (value) { return setLoading(value); }
|
|
53
|
-
}); }, [autoCompleteList, data, value]);
|
|
54
|
-
useEffect(function () {
|
|
55
|
-
if (inputRef)
|
|
56
|
-
inputRef.current = refInput.current;
|
|
57
|
-
}, [refInput.current]);
|
|
58
|
-
useEffect(function () { return onLoad && onLoad(value); }, []);
|
|
59
|
-
useEffect(function () {
|
|
60
|
-
if (autoCompleteList && Array.isArray(autoCompleteList)) {
|
|
61
|
-
if (autoCompleteList.length > 0) {
|
|
62
|
-
// Sadece gerçekten farklıysa set et
|
|
63
|
-
if (JSON.stringify(autoCompleteList) !== JSON.stringify(data)) {
|
|
64
|
-
setData(autoCompleteList);
|
|
65
|
-
// isDev && console.log("autoCompleteList dolu =>", name, autoCompleteList);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
// Boş array geldi VE data zaten boş değilse
|
|
70
|
-
if (data.length > 0) {
|
|
71
|
-
setData([]);
|
|
72
|
-
// isDev && console.log("autoCompleteList boşaltıldı =>", name);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}, [autoCompleteList]);
|
|
77
|
-
useEffect(function () {
|
|
78
|
-
// isDev && console.log('data =>', name, data, 'selectedValue =>', selectedValue, 'value =>', value);
|
|
79
|
-
if (!Array.isArray(data)) {
|
|
80
|
-
setData([]);
|
|
81
|
-
}
|
|
82
|
-
if (data.length > 0) {
|
|
83
|
-
setLoading(false);
|
|
84
|
-
checkByValue(selectedValue, open);
|
|
85
|
-
if (!value && ilkSec) {
|
|
86
|
-
checkByValue(data[0][valueKey], false);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
!isDataFromApi && clear(false);
|
|
91
|
-
}
|
|
92
|
-
}, [data]);
|
|
93
|
-
// Seçim değişikliğinde parent'ı bilgilendir
|
|
94
|
-
useEffect(function () {
|
|
95
|
-
// isDev && console.log('selectedValue =>', name, selectedValue, 'value =>', value);
|
|
96
|
-
if ((value === null || value === void 0 ? void 0 : value.toString()) != (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.toString())) {
|
|
97
|
-
checkByValue(value, open);
|
|
98
|
-
// isDev && console.log('value Kontrol ediliyor', value, selectedValue);
|
|
99
|
-
}
|
|
100
|
-
}, [value]);
|
|
101
|
-
useEffect(function () {
|
|
102
|
-
if (parentInputValue !== parentValue) {
|
|
103
|
-
setParentValue(parentInputValue);
|
|
104
|
-
clear(false);
|
|
105
|
-
// isDev && console.log(name, "parentInputValueDeğişti =>", parentInputValue);
|
|
106
|
-
}
|
|
107
|
-
}, [parentInputValue]);
|
|
108
|
-
useEffect(function () {
|
|
109
|
-
var checkHideBackDrop = function (e) {
|
|
110
|
-
if (open && refMain.current && !refMain.current.contains(e.target)) {
|
|
111
|
-
checkByInput();
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
var checkESC = function (e) {
|
|
115
|
-
if (e.keyCode === 27 || e.key === 'Escape' || e.code === 'Escape')
|
|
116
|
-
checkByInput();
|
|
117
|
-
};
|
|
118
|
-
window.addEventListener('mousedown', checkHideBackDrop);
|
|
119
|
-
if (refMain.current)
|
|
120
|
-
refMain.current.addEventListener('keydown', checkESC);
|
|
121
|
-
if (open) {
|
|
122
|
-
setScrollListPosition(refList);
|
|
123
|
-
if (!listPositionRelative) {
|
|
124
|
-
window.addEventListener('scroll', handleUpdatePosition, true);
|
|
125
|
-
window.addEventListener('resize', handleUpdatePosition);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return function () {
|
|
129
|
-
window.removeEventListener('mousedown', checkHideBackDrop);
|
|
130
|
-
if (refMain.current)
|
|
131
|
-
refMain.current.removeEventListener('keydown', checkESC);
|
|
132
|
-
window.removeEventListener('scroll', handleUpdatePosition, true);
|
|
133
|
-
window.removeEventListener('resize', handleUpdatePosition);
|
|
134
|
-
};
|
|
135
|
-
}, [open]);
|
|
136
|
-
useLayoutEffect(function () { return handleUpdatePosition(); }, [open]);
|
|
137
|
-
var setValue = useCallback(function (item, openList) {
|
|
138
|
-
var _a, _b;
|
|
139
|
-
var newValue = (_a = item === null || item === void 0 ? void 0 : item[valueKey]) !== null && _a !== void 0 ? _a : '';
|
|
140
|
-
var newLabel = (_b = item === null || item === void 0 ? void 0 : item[labelKey]) !== null && _b !== void 0 ? _b : '';
|
|
141
|
-
setOpen(openList);
|
|
142
|
-
setText(newLabel);
|
|
143
|
-
// isDev && console.log(name, "setValue", newValue, "item", item, "value", value);
|
|
144
|
-
if (newValue === selectedValue)
|
|
145
|
-
return;
|
|
146
|
-
setFilter('');
|
|
147
|
-
setSelectedValue(newValue);
|
|
148
|
-
onChange && sendChange(newValue);
|
|
149
|
-
onSelect && onSelect(item);
|
|
150
|
-
}, [onChange, onSelect, name, selectedValue, valueKey, labelKey]);
|
|
151
|
-
var textInputOnChange = useCallback(function (e) {
|
|
152
|
-
setSelectedValue(undefined);
|
|
153
|
-
setText(e.target.value);
|
|
154
|
-
setFilter(e.target.value.trim());
|
|
155
|
-
setOpen(true);
|
|
156
|
-
onText && onText(e.target.value);
|
|
157
|
-
}, [setValue, onText]);
|
|
158
|
-
var checkByValue = useCallback(function (value, openList, list) {
|
|
159
|
-
if (openList === void 0) { openList = false; }
|
|
160
|
-
if (list === void 0) { list = []; }
|
|
161
|
-
var targetList = list.length > 0 ? list : data;
|
|
162
|
-
var find = Object.values(targetList).find(function (item) { return convertLowerCase(item[valueKey]) === convertLowerCase(value); });
|
|
163
|
-
if (!find && newCreate && newItemCreate.create) {
|
|
164
|
-
find = newItemCreate;
|
|
165
|
-
}
|
|
166
|
-
// isDev && console.log('find', find, 'value', value, data);
|
|
167
|
-
setValue(find, openList);
|
|
168
|
-
}, [data, valueKey, newCreate, newItemCreate, setValue]);
|
|
169
|
-
var checkByInput = useCallback(function () {
|
|
170
|
-
var findByLabel = data.find(function (item) { var _a; return convertLowerCase(item[labelKey]) === convertLowerCase((_a = refInput.current) === null || _a === void 0 ? void 0 : _a.value); });
|
|
171
|
-
if (findByLabel && value == findByLabel[valueKey]) {
|
|
172
|
-
setOpen(false);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
setValue(findByLabel, false);
|
|
176
|
-
if (!findByLabel)
|
|
177
|
-
setText('');
|
|
178
|
-
if (isDataFromApi && !findByLabel && data.length === 0) {
|
|
179
|
-
if (onText)
|
|
180
|
-
onText('');
|
|
181
|
-
}
|
|
182
|
-
}, [data, labelKey, value, valueKey, isDataFromApi, onText, setValue, refInput.current]);
|
|
183
|
-
var clear = useCallback(function (openList, focusInput) {
|
|
184
|
-
var _a;
|
|
185
|
-
if (openList === void 0) { openList = true; }
|
|
186
|
-
if (focusInput === void 0) { focusInput = false; }
|
|
187
|
-
setFilter('');
|
|
188
|
-
setText('');
|
|
189
|
-
setValue(undefined, openList);
|
|
190
|
-
onText && onText('');
|
|
191
|
-
focusInput && ((_a = refInput === null || refInput === void 0 ? void 0 : refInput.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
192
|
-
}, [setValue, onText]);
|
|
193
|
-
var sendChange = useCallback(function (value) {
|
|
194
|
-
// isDev && console.log(name, "sendChange", value, "selectedValue", selectedValue);
|
|
195
|
-
if (onChange && value !== selectedValue) {
|
|
196
|
-
onChange({ target: { name: name, value: value } });
|
|
197
|
-
}
|
|
198
|
-
}, [onChange, name]);
|
|
199
|
-
var filteredData = useMemo(function () {
|
|
200
|
-
var _a;
|
|
201
|
-
var list;
|
|
202
|
-
if (filter.length > 0) {
|
|
203
|
-
list = data.filter(function (item) { return convertForSearch(item[labelKey]).includes(convertForSearch(filter)) || item[labelKey] == filter; });
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
list = data;
|
|
207
|
-
}
|
|
208
|
-
if (newCreate && text.length > 0) {
|
|
209
|
-
var filterText = data.find(function (item) { return item[labelKey].toString().toLowerCase() === text.toString().toLowerCase(); });
|
|
210
|
-
if (!filterText) {
|
|
211
|
-
var newItem = (_a = {}, _a[labelKey] = text, _a[valueKey] = text, _a.create = true, _a);
|
|
212
|
-
list = __spreadArray([newItem], list, true);
|
|
213
|
-
setNewItemCreate(newItem);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
if (newItemCreate.create)
|
|
217
|
-
setNewItemCreate({ create: false });
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return list;
|
|
221
|
-
}, [data, filter, newCreate, text, valueKey, labelKey]);
|
|
222
|
-
var handleUpdatePosition = function () {
|
|
223
|
-
if (open && !listPositionRelative && refMain) {
|
|
224
|
-
setFixedPosition(refMain);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
var onKeyDown = function (e) {
|
|
228
|
-
if (!open || !refList.current)
|
|
229
|
-
return null;
|
|
230
|
-
onKeyboardSelection({
|
|
231
|
-
e: e,
|
|
232
|
-
targetElement: refList,
|
|
233
|
-
checkByInput: checkByInput,
|
|
234
|
-
checkByValue: checkByValue,
|
|
235
|
-
clear: clear,
|
|
236
|
-
itemClass: 'li.item',
|
|
237
|
-
selectedClass: 'selected'
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
return (_jsxs("div", { ref: refMain, className: styles.searchableInputComponent, onKeyDown: onKeyDown, style: style, children: [_jsx(Input, __assign({}, other, { inputRef: refInput, name: name, value: text, onFocus: function () { return !disabled && setOpen(true); }, onChange: textInputOnChange, endAdornment: !disabled && (_jsxs("div", { style: { marginRight: 5 }, tabIndex: -1, children: [_jsx(Button, { title: 'Temizle', tabIndex: -1, hidden: !(text && text.length > 0), onClick: function () { return clear(true, true); }, onlyIcon: _jsx(Icon, { name: 'close', style: { color: '#444' } }) }), endAdornment, _jsx(Button, { tabIndex: -1, hidden: !data || !(data.length > 0), onClick: function () { return !disabled && setOpen(!open); }, onlyIcon: _jsx(Icon, { name: open ? 'keyboard_arrow_up' : 'keyboard_arrow_down', style: { color: '#444' } }) })] })), placeholder: loading ? 'Lütfen bekleyiniz...' : placeholder, loading: loading, disabled: disabled, propsInput: __assign(__assign({}, other === null || other === void 0 ? void 0 : other.propsInput), { autoComplete: 'off' }) })), open && (_jsx("div", { className: 'listDiv', "data-relative": listPositionRelative, children: _jsxs("ul", { ref: refList, className: "list ".concat(open ? 'open' : ''), children: [(filteredData.length === 0 || loading) && _jsx("div", { className: "message ".concat(loading ? 'loading' : ''), children: loading ? loadingMessage : notFoundMessage }), filteredData.map(function (item, key) {
|
|
241
|
-
var itemValue = item[valueKey];
|
|
242
|
-
var itemLabel = item[labelKey];
|
|
243
|
-
return (_jsxs("li", { className: "item ".concat(itemValue === selectedValue ? 'active' : ''), "data-value": itemValue, "data-label": itemLabel, onClick: function () { return setValue(item, false); }, children: [item.create && _jsx("span", { className: 'newCreate', children: "Yeni Olu\u015Ftur: " }), itemComponent ? itemComponent(item) : itemLabel] }, key));
|
|
244
|
-
})] }) }))] }));
|
|
245
|
-
});
|
|
246
|
-
var setFixedPosition = function (refMain) {
|
|
247
|
-
if (!refMain.current)
|
|
248
|
-
return;
|
|
249
|
-
var target = refMain.current;
|
|
250
|
-
var targetPosition = target.getBoundingClientRect();
|
|
251
|
-
var listDiv = target.querySelector('.listDiv');
|
|
252
|
-
if (listDiv) {
|
|
253
|
-
var listDivUL = target.querySelector('ul');
|
|
254
|
-
if (!listDiv)
|
|
255
|
-
return;
|
|
256
|
-
var listHeight = listDivUL.getBoundingClientRect().height;
|
|
257
|
-
var style = [];
|
|
258
|
-
style.push("position:fixed");
|
|
259
|
-
style.push("z-index:111111111111 !important");
|
|
260
|
-
style.push("width:".concat(targetPosition.width, "px"));
|
|
261
|
-
var spaceBelow = window.innerHeight - (targetPosition.top + targetPosition.height);
|
|
262
|
-
var spaceAbove = targetPosition.top;
|
|
263
|
-
if (spaceBelow < listHeight && spaceAbove > listHeight) {
|
|
264
|
-
style.push("top:".concat(targetPosition.top - listHeight, "px"));
|
|
265
|
-
style.push("margin-top:-1px");
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
style.push("top:".concat(targetPosition.top + targetPosition.height, "px"));
|
|
269
|
-
}
|
|
270
|
-
listDiv.setAttribute('style', style.join(';'));
|
|
271
|
-
}
|
|
272
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024
|
|
3
|
-
* @author: izzetseydaoglu
|
|
4
|
-
* @last-modified: 11.06.2024 02:39
|
|
5
|
-
*/
|
|
6
|
-
import React from "react";
|
|
7
|
-
interface Props {
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
refUploadInput?: any;
|
|
10
|
-
className?: string;
|
|
11
|
-
required?: boolean;
|
|
12
|
-
multiple?: boolean;
|
|
13
|
-
ext_ok?: string[];
|
|
14
|
-
maxSize?: number;
|
|
15
|
-
maxFile?: number;
|
|
16
|
-
style?: React.CSSProperties;
|
|
17
|
-
onChange?: Function;
|
|
18
|
-
targetForm?: Function;
|
|
19
|
-
name?: string;
|
|
20
|
-
label?: string;
|
|
21
|
-
component?: any;
|
|
22
|
-
}
|
|
23
|
-
export declare const UploadBase: ({ component, children, targetForm, onChange, name, required, multiple, maxSize, maxFile, ext_ok, style, className, refUploadInput, label }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export declare const uploadBase_CreateForm: (formData: any) => any;
|
|
25
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* Copyright (c) 2024
|
|
5
|
-
* @author: izzetseydaoglu
|
|
6
|
-
* @last-modified: 11.06.2024 02:39
|
|
7
|
-
*/
|
|
8
|
-
import { useEffect, useRef } from "react";
|
|
9
|
-
import { alert_add } from "../alert";
|
|
10
|
-
var upload_ext_ok = ["pdf", "doc", "docx", "xls", "xlsx", "jpg", "jpeg", "png", "bmp", "tiff", "tif", "udf", "txt", "rtf", "csv", "xml", "zip", "rar"];
|
|
11
|
-
var upload_maxsize = 30;
|
|
12
|
-
var upload_maxfile = 50;
|
|
13
|
-
export var UploadBase = function (_a) {
|
|
14
|
-
var _b = _a.component, component = _b === void 0 ? "div" : _b, children = _a.children, targetForm = _a.targetForm, onChange = _a.onChange, _c = _a.name, name = _c === void 0 ? "file__" : _c, _d = _a.required, required = _d === void 0 ? true : _d, _e = _a.multiple, multiple = _e === void 0 ? false : _e, _f = _a.maxSize, maxSize = _f === void 0 ? upload_maxsize : _f, _g = _a.maxFile, maxFile = _g === void 0 ? upload_maxfile : _g, _h = _a.ext_ok, ext_ok = _h === void 0 ? upload_ext_ok : _h, style = _a.style, className = _a.className, _j = _a.refUploadInput, refUploadInput = _j === void 0 ? null : _j, label = _a.label;
|
|
15
|
-
var ref = useRef(null);
|
|
16
|
-
useEffect(function () {
|
|
17
|
-
if (refUploadInput)
|
|
18
|
-
refUploadInput.current = ref.current;
|
|
19
|
-
}, [ref.current]);
|
|
20
|
-
var fileSelected = function (e) {
|
|
21
|
-
if (!(e.target.files.length > 0)) {
|
|
22
|
-
e.target.value = null;
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
if (e.target.files.length > maxFile) {
|
|
26
|
-
alert_add({ type: "error", message: "En fazla " + maxFile + " dosya seçebilirsiniz." });
|
|
27
|
-
e.target.value = null;
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
var fileList = [];
|
|
31
|
-
Object.values(e.target.files).map(function (file) {
|
|
32
|
-
var size = file.size;
|
|
33
|
-
var ext = file.name.replace(/^.*\./, "").toLowerCase();
|
|
34
|
-
if (ext_ok.indexOf(ext) === -1) {
|
|
35
|
-
alert_add({ type: "error", message: "Yüklemeye çalıştığınız dosya türü desteklenmiyor. Desteklenen dosya türleri: " + ext_ok.join(", ") });
|
|
36
|
-
}
|
|
37
|
-
else if (size > maxSize * 1000000) {
|
|
38
|
-
alert_add({ type: "error", message: "En fazla " + maxSize + "MB büyüklüğündeki dosyaları seçebilirsiniz." });
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
fileList.push(file);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
if (onChange)
|
|
45
|
-
onChange(fileList);
|
|
46
|
-
if (targetForm) {
|
|
47
|
-
var nameList_1 = [];
|
|
48
|
-
var newform_1 = {};
|
|
49
|
-
var uniqueID_1 = new Date().getTime();
|
|
50
|
-
fileList.map(function (file) {
|
|
51
|
-
var _a;
|
|
52
|
-
uniqueID_1 = uniqueID_1 + 1;
|
|
53
|
-
newform_1 = __assign(__assign({}, newform_1), (_a = {}, _a[name + uniqueID_1] = file, _a));
|
|
54
|
-
nameList_1.push(file.name);
|
|
55
|
-
});
|
|
56
|
-
targetForm(function (prev) { return (__assign(__assign({}, prev), { uploadBaseList: __assign({}, newform_1), uploadBaseListName: nameList_1.join(", ") })); });
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var defaultStyle = {
|
|
60
|
-
position: "relative",
|
|
61
|
-
cursor: "pointer"
|
|
62
|
-
};
|
|
63
|
-
var Component = component.toLowerCase();
|
|
64
|
-
return (_jsxs(Component, { className: className, style: __assign(__assign({}, defaultStyle), style), "data-label": label !== null && label !== void 0 ? label : "", children: [children, _jsx("input", { ref: ref, type: "file", required: required, onChange: fileSelected, multiple: multiple, accept: ext_ok.map(function (i) { return "." + i; }).join(","), style: {
|
|
65
|
-
position: "absolute",
|
|
66
|
-
top: 0,
|
|
67
|
-
left: 0,
|
|
68
|
-
opacity: 0,
|
|
69
|
-
width: "100%",
|
|
70
|
-
height: "100%",
|
|
71
|
-
cursor: "pointer",
|
|
72
|
-
zIndex: 1
|
|
73
|
-
} })] }));
|
|
74
|
-
};
|
|
75
|
-
export var uploadBase_CreateForm = function (formData) {
|
|
76
|
-
var _a;
|
|
77
|
-
var newform = __assign({}, formData);
|
|
78
|
-
var list = (_a = formData["uploadBaseList"]) !== null && _a !== void 0 ? _a : {};
|
|
79
|
-
Object.keys(list).map(function (fileKey) {
|
|
80
|
-
var _a;
|
|
81
|
-
return (newform = __assign(__assign({}, newform), (_a = {}, _a[fileKey] = list[fileKey], _a)));
|
|
82
|
-
});
|
|
83
|
-
delete newform["uploadBaseList"];
|
|
84
|
-
delete newform["uploadBaseListName"];
|
|
85
|
-
return newform;
|
|
86
|
-
};
|
package/dist/esm/form/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from "./Button";
|
|
2
|
-
export * from "./Checkbox";
|
|
3
|
-
export * from "./Dialog";
|
|
4
|
-
export * from "./Form";
|
|
5
|
-
export * from "./FormOlustur";
|
|
6
|
-
export * from "./Input";
|
|
7
|
-
export * from "./Label";
|
|
8
|
-
export * from "./SearchableInput";
|
|
9
|
-
export * from "./UploadBase";
|
package/dist/esm/form/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from "./Button";
|
|
2
|
-
export * from "./Checkbox";
|
|
3
|
-
export * from "./Dialog";
|
|
4
|
-
export * from "./Form";
|
|
5
|
-
export * from "./FormOlustur";
|
|
6
|
-
export * from "./Input";
|
|
7
|
-
export * from "./Label";
|
|
8
|
-
export * from "./SearchableInput";
|
|
9
|
-
export * from "./UploadBase";
|