@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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign, __rest, __spreadArray } from "tslib";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Button, Input } from './index';
|
|
4
3
|
import { convertForSearch, convertLowerCase } from '../_lib/baseFunctions';
|
|
@@ -6,22 +5,20 @@ import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffec
|
|
|
6
5
|
import { onKeyboardSelection, setScrollListPosition } from '../_lib/listFunctions';
|
|
7
6
|
import { Icon } from '../icon';
|
|
8
7
|
import styles from './styles/SearchableInput.module.css';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setAutoCompleteList: function (list, value, callback) {
|
|
24
|
-
if (value === void 0) { value = undefined; }
|
|
8
|
+
export const SearchableInput = forwardRef(({ autoCompleteList = [], isDataFromApi, name, value, parentInputValue, disabled, itemComponent, valueKey = 'value', labelKey = 'label', onSelect, onChange, onText, onLoad, style, listPositionRelative = false, loadingMessage = 'Lütfen bekleyiniz...', notFoundMessage = 'Kayıt bulunamadı...', placeholder, endAdornment, ilkSec = false, newCreate = false, inputRef, ...other }, ref) => {
|
|
9
|
+
const refMain = useRef(null);
|
|
10
|
+
const refInput = useRef(null);
|
|
11
|
+
const refList = useRef(null);
|
|
12
|
+
const [data, setData] = useState(autoCompleteList !== null && autoCompleteList !== void 0 ? autoCompleteList : []);
|
|
13
|
+
const [selectedValue, setSelectedValue] = useState(value !== null && value !== void 0 ? value : undefined);
|
|
14
|
+
const [parentValue, setParentValue] = useState(parentInputValue !== null && parentInputValue !== void 0 ? parentInputValue : undefined);
|
|
15
|
+
const [text, setText] = useState(''); //Inputta görünen
|
|
16
|
+
const [filter, setFilter] = useState(''); // Filtrelemeye tabi tutulan
|
|
17
|
+
const [newItemCreate, setNewItemCreate] = useState({ created: false });
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const [loading, setLoading] = useState(isDataFromApi && (!autoCompleteList || (autoCompleteList === null || autoCompleteList === void 0 ? void 0 : autoCompleteList.length) == 0));
|
|
20
|
+
useImperativeHandle(ref, () => ({
|
|
21
|
+
setAutoCompleteList: (list, value = undefined, callback) => {
|
|
25
22
|
if (autoCompleteList && (autoCompleteList === null || autoCompleteList === void 0 ? void 0 : autoCompleteList.length) > 0) {
|
|
26
23
|
alert('AutoCompleteList zaten tanımlı olduğundan dışardan data seti değiştirilemez.');
|
|
27
24
|
return;
|
|
@@ -35,28 +32,21 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
35
32
|
callback && callback();
|
|
36
33
|
// isDev && console.log("setAutoCompleteList =>", name, value, list);
|
|
37
34
|
},
|
|
38
|
-
clear:
|
|
39
|
-
|
|
40
|
-
if (focusInput === void 0) { focusInput = false; }
|
|
41
|
-
return clear(openList, focusInput);
|
|
42
|
-
},
|
|
43
|
-
open: function () {
|
|
35
|
+
clear: (openList = false, focusInput = false) => clear(openList, focusInput),
|
|
36
|
+
open: () => {
|
|
44
37
|
setOpen(true);
|
|
45
38
|
refInput.current && refInput.current.focus();
|
|
46
39
|
},
|
|
47
|
-
close:
|
|
48
|
-
checkByValue:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
setLoading: function (value) { return setLoading(value); }
|
|
53
|
-
}); }, [autoCompleteList, data, value]);
|
|
54
|
-
useEffect(function () {
|
|
40
|
+
close: () => setOpen(false),
|
|
41
|
+
checkByValue: (value, openList = false) => checkByValue(value, openList),
|
|
42
|
+
setLoading: (value) => setLoading(value)
|
|
43
|
+
}), [autoCompleteList, data, value]);
|
|
44
|
+
useEffect(() => {
|
|
55
45
|
if (inputRef)
|
|
56
46
|
inputRef.current = refInput.current;
|
|
57
47
|
}, [refInput.current]);
|
|
58
|
-
useEffect(
|
|
59
|
-
useEffect(
|
|
48
|
+
useEffect(() => onLoad && onLoad(value), []);
|
|
49
|
+
useEffect(() => {
|
|
60
50
|
if (autoCompleteList && Array.isArray(autoCompleteList)) {
|
|
61
51
|
if (autoCompleteList.length > 0) {
|
|
62
52
|
// Sadece gerçekten farklıysa set et
|
|
@@ -74,7 +64,7 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
74
64
|
}
|
|
75
65
|
}
|
|
76
66
|
}, [autoCompleteList]);
|
|
77
|
-
useEffect(
|
|
67
|
+
useEffect(() => {
|
|
78
68
|
// isDev && console.log('data =>', name, data, 'selectedValue =>', selectedValue, 'value =>', value);
|
|
79
69
|
if (!Array.isArray(data)) {
|
|
80
70
|
setData([]);
|
|
@@ -91,27 +81,27 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
91
81
|
}
|
|
92
82
|
}, [data]);
|
|
93
83
|
// Seçim değişikliğinde parent'ı bilgilendir
|
|
94
|
-
useEffect(
|
|
84
|
+
useEffect(() => {
|
|
95
85
|
// isDev && console.log('selectedValue =>', name, selectedValue, 'value =>', value);
|
|
96
86
|
if ((value === null || value === void 0 ? void 0 : value.toString()) != (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.toString())) {
|
|
97
87
|
checkByValue(value, open);
|
|
98
88
|
// isDev && console.log('value Kontrol ediliyor', value, selectedValue);
|
|
99
89
|
}
|
|
100
90
|
}, [value]);
|
|
101
|
-
useEffect(
|
|
91
|
+
useEffect(() => {
|
|
102
92
|
if (parentInputValue !== parentValue) {
|
|
103
93
|
setParentValue(parentInputValue);
|
|
104
94
|
clear(false);
|
|
105
95
|
// isDev && console.log(name, "parentInputValueDeğişti =>", parentInputValue);
|
|
106
96
|
}
|
|
107
97
|
}, [parentInputValue]);
|
|
108
|
-
useEffect(
|
|
109
|
-
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
const checkHideBackDrop = (e) => {
|
|
110
100
|
if (open && refMain.current && !refMain.current.contains(e.target)) {
|
|
111
101
|
checkByInput();
|
|
112
102
|
}
|
|
113
103
|
};
|
|
114
|
-
|
|
104
|
+
const checkESC = (e) => {
|
|
115
105
|
if (e.keyCode === 27 || e.key === 'Escape' || e.code === 'Escape')
|
|
116
106
|
checkByInput();
|
|
117
107
|
};
|
|
@@ -125,7 +115,7 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
125
115
|
window.addEventListener('resize', handleUpdatePosition);
|
|
126
116
|
}
|
|
127
117
|
}
|
|
128
|
-
return
|
|
118
|
+
return () => {
|
|
129
119
|
window.removeEventListener('mousedown', checkHideBackDrop);
|
|
130
120
|
if (refMain.current)
|
|
131
121
|
refMain.current.removeEventListener('keydown', checkESC);
|
|
@@ -133,11 +123,11 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
133
123
|
window.removeEventListener('resize', handleUpdatePosition);
|
|
134
124
|
};
|
|
135
125
|
}, [open]);
|
|
136
|
-
useLayoutEffect(
|
|
137
|
-
|
|
126
|
+
useLayoutEffect(() => handleUpdatePosition(), [open]);
|
|
127
|
+
const setValue = useCallback((item, openList) => {
|
|
138
128
|
var _a, _b;
|
|
139
|
-
|
|
140
|
-
|
|
129
|
+
const newValue = (_a = item === null || item === void 0 ? void 0 : item[valueKey]) !== null && _a !== void 0 ? _a : '';
|
|
130
|
+
const newLabel = (_b = item === null || item === void 0 ? void 0 : item[labelKey]) !== null && _b !== void 0 ? _b : '';
|
|
141
131
|
setOpen(openList);
|
|
142
132
|
setText(newLabel);
|
|
143
133
|
// isDev && console.log(name, "setValue", newValue, "item", item, "value", value);
|
|
@@ -148,26 +138,24 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
148
138
|
onChange && sendChange(newValue);
|
|
149
139
|
onSelect && onSelect(item);
|
|
150
140
|
}, [onChange, onSelect, name, selectedValue, valueKey, labelKey]);
|
|
151
|
-
|
|
141
|
+
const textInputOnChange = useCallback((e) => {
|
|
152
142
|
setSelectedValue(undefined);
|
|
153
143
|
setText(e.target.value);
|
|
154
144
|
setFilter(e.target.value.trim());
|
|
155
145
|
setOpen(true);
|
|
156
146
|
onText && onText(e.target.value);
|
|
157
147
|
}, [setValue, onText]);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
var targetList = list.length > 0 ? list : data;
|
|
162
|
-
var find = Object.values(targetList).find(function (item) { return convertLowerCase(item[valueKey]) === convertLowerCase(value); });
|
|
148
|
+
const checkByValue = useCallback((value, openList = false, list = []) => {
|
|
149
|
+
const targetList = list.length > 0 ? list : data;
|
|
150
|
+
let find = Object.values(targetList).find((item) => convertLowerCase(item[valueKey]) === convertLowerCase(value));
|
|
163
151
|
if (!find && newCreate && newItemCreate.create) {
|
|
164
152
|
find = newItemCreate;
|
|
165
153
|
}
|
|
166
154
|
// isDev && console.log('find', find, 'value', value, data);
|
|
167
155
|
setValue(find, openList);
|
|
168
156
|
}, [data, valueKey, newCreate, newItemCreate, setValue]);
|
|
169
|
-
|
|
170
|
-
|
|
157
|
+
const checkByInput = useCallback(() => {
|
|
158
|
+
const findByLabel = data.find((item) => { var _a; return convertLowerCase(item[labelKey]) === convertLowerCase((_a = refInput.current) === null || _a === void 0 ? void 0 : _a.value); });
|
|
171
159
|
if (findByLabel && value == findByLabel[valueKey]) {
|
|
172
160
|
setOpen(false);
|
|
173
161
|
return;
|
|
@@ -180,36 +168,33 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
180
168
|
onText('');
|
|
181
169
|
}
|
|
182
170
|
}, [data, labelKey, value, valueKey, isDataFromApi, onText, setValue, refInput.current]);
|
|
183
|
-
|
|
171
|
+
const clear = useCallback((openList = true, focusInput = false) => {
|
|
184
172
|
var _a;
|
|
185
|
-
if (openList === void 0) { openList = true; }
|
|
186
|
-
if (focusInput === void 0) { focusInput = false; }
|
|
187
173
|
setFilter('');
|
|
188
174
|
setText('');
|
|
189
175
|
setValue(undefined, openList);
|
|
190
176
|
onText && onText('');
|
|
191
177
|
focusInput && ((_a = refInput === null || refInput === void 0 ? void 0 : refInput.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
192
178
|
}, [setValue, onText]);
|
|
193
|
-
|
|
179
|
+
const sendChange = useCallback((value) => {
|
|
194
180
|
// isDev && console.log(name, "sendChange", value, "selectedValue", selectedValue);
|
|
195
181
|
if (onChange && value !== selectedValue) {
|
|
196
|
-
onChange({ target: { name
|
|
182
|
+
onChange({ target: { name, value } });
|
|
197
183
|
}
|
|
198
184
|
}, [onChange, name]);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var list;
|
|
185
|
+
const filteredData = useMemo(() => {
|
|
186
|
+
let list;
|
|
202
187
|
if (filter.length > 0) {
|
|
203
|
-
list = data.filter(
|
|
188
|
+
list = data.filter((item) => convertForSearch(item[labelKey]).includes(convertForSearch(filter)) || item[labelKey] == filter);
|
|
204
189
|
}
|
|
205
190
|
else {
|
|
206
191
|
list = data;
|
|
207
192
|
}
|
|
208
193
|
if (newCreate && text.length > 0) {
|
|
209
|
-
|
|
194
|
+
const filterText = data.find((item) => item[labelKey].toString().toLowerCase() === text.toString().toLowerCase());
|
|
210
195
|
if (!filterText) {
|
|
211
|
-
|
|
212
|
-
list =
|
|
196
|
+
const newItem = { [labelKey]: text, [valueKey]: text, create: true };
|
|
197
|
+
list = [newItem, ...list];
|
|
213
198
|
setNewItemCreate(newItem);
|
|
214
199
|
}
|
|
215
200
|
else {
|
|
@@ -219,53 +204,56 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
219
204
|
}
|
|
220
205
|
return list;
|
|
221
206
|
}, [data, filter, newCreate, text, valueKey, labelKey]);
|
|
222
|
-
|
|
207
|
+
const handleUpdatePosition = () => {
|
|
223
208
|
if (open && !listPositionRelative && refMain) {
|
|
224
209
|
setFixedPosition(refMain);
|
|
225
210
|
}
|
|
226
211
|
};
|
|
227
|
-
|
|
212
|
+
const onKeyDown = (e) => {
|
|
228
213
|
if (!open || !refList.current)
|
|
229
214
|
return null;
|
|
230
215
|
onKeyboardSelection({
|
|
231
|
-
e
|
|
216
|
+
e,
|
|
232
217
|
targetElement: refList,
|
|
233
|
-
checkByInput
|
|
234
|
-
checkByValue
|
|
235
|
-
clear
|
|
218
|
+
checkByInput,
|
|
219
|
+
checkByValue,
|
|
220
|
+
clear,
|
|
236
221
|
itemClass: 'li.item',
|
|
237
222
|
selectedClass: 'selected'
|
|
238
223
|
});
|
|
239
224
|
};
|
|
240
|
-
return (_jsxs("div", { ref: refMain, className: styles.searchableInputComponent, onKeyDown: onKeyDown, style: style, children: [_jsx(Input,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
225
|
+
return (_jsxs("div", { ref: refMain, className: styles.searchableInputComponent, onKeyDown: onKeyDown, style: style, children: [_jsx(Input, { ...other, inputRef: refInput, name: name, value: text, onFocus: () => !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: () => clear(true, true), onlyIcon: _jsx(Icon, { name: 'close', style: { color: '#444' } }) }), endAdornment, _jsx(Button, { tabIndex: -1, hidden: !data || !(data.length > 0), onClick: () => !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: {
|
|
226
|
+
...other === null || other === void 0 ? void 0 : other.propsInput,
|
|
227
|
+
autoComplete: 'off'
|
|
228
|
+
} }), open && (_jsx("div", { className: 'listDiv', "data-relative": listPositionRelative, children: _jsxs("ul", { ref: refList, className: `list ${open ? 'open' : ''}`, children: [(filteredData.length === 0 || loading) && _jsx("div", { className: `message ${loading ? 'loading' : ''}`, children: loading ? loadingMessage : notFoundMessage }), filteredData.map((item, key) => {
|
|
229
|
+
const itemValue = item[valueKey];
|
|
230
|
+
const itemLabel = item[labelKey];
|
|
231
|
+
return (_jsxs("li", { className: `item ${itemValue === selectedValue ? 'active' : ''}`, "data-value": itemValue, "data-label": itemLabel, onClick: () => setValue(item, false), children: [item.create && _jsx("span", { className: 'newCreate', children: "Yeni Olu\u015Ftur: " }), itemComponent ? itemComponent(item) : itemLabel] }, key));
|
|
244
232
|
})] }) }))] }));
|
|
245
233
|
});
|
|
246
|
-
|
|
234
|
+
const setFixedPosition = (refMain) => {
|
|
247
235
|
if (!refMain.current)
|
|
248
236
|
return;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
237
|
+
const target = refMain.current;
|
|
238
|
+
const targetPosition = target.getBoundingClientRect();
|
|
239
|
+
const listDiv = target.querySelector('.listDiv');
|
|
252
240
|
if (listDiv) {
|
|
253
|
-
|
|
241
|
+
const listDivUL = target.querySelector('ul');
|
|
254
242
|
if (!listDiv)
|
|
255
243
|
return;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
style.push(
|
|
259
|
-
style.push(
|
|
260
|
-
style.push(
|
|
261
|
-
|
|
262
|
-
|
|
244
|
+
const listHeight = listDivUL.getBoundingClientRect().height;
|
|
245
|
+
const style = [];
|
|
246
|
+
style.push(`position:fixed`);
|
|
247
|
+
style.push(`z-index:111111111111 !important`);
|
|
248
|
+
style.push(`width:${targetPosition.width}px`);
|
|
249
|
+
const spaceBelow = window.innerHeight - (targetPosition.top + targetPosition.height);
|
|
250
|
+
const spaceAbove = targetPosition.top;
|
|
263
251
|
if (spaceBelow < listHeight && spaceAbove > listHeight) {
|
|
264
|
-
style.push(
|
|
265
|
-
style.push(
|
|
252
|
+
style.push(`top:${targetPosition.top - listHeight}px`);
|
|
253
|
+
style.push(`margin-top:-1px`);
|
|
266
254
|
}
|
|
267
255
|
else {
|
|
268
|
-
style.push(
|
|
256
|
+
style.push(`top:${targetPosition.top + targetPosition.height}px`);
|
|
269
257
|
}
|
|
270
258
|
listDiv.setAttribute('style', style.join(';'));
|
|
271
259
|
}
|
|
@@ -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
|
* Copyright (c) 2024
|
|
@@ -7,17 +6,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
6
|
*/
|
|
8
7
|
import { useEffect, useRef } from "react";
|
|
9
8
|
import { alert_add } from "../alert";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
useEffect(function () {
|
|
9
|
+
const upload_ext_ok = ["pdf", "doc", "docx", "xls", "xlsx", "jpg", "jpeg", "png", "bmp", "tiff", "tif", "udf", "txt", "rtf", "csv", "xml", "zip", "rar"];
|
|
10
|
+
const upload_maxsize = 30;
|
|
11
|
+
const upload_maxfile = 50;
|
|
12
|
+
export const UploadBase = ({ component = "div", children, targetForm, onChange, name = "file__", required = true, multiple = false, maxSize = upload_maxsize, maxFile = upload_maxfile, ext_ok = upload_ext_ok, style, className, refUploadInput = null, label }) => {
|
|
13
|
+
const ref = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
17
15
|
if (refUploadInput)
|
|
18
16
|
refUploadInput.current = ref.current;
|
|
19
17
|
}, [ref.current]);
|
|
20
|
-
|
|
18
|
+
const fileSelected = (e) => {
|
|
21
19
|
if (!(e.target.files.length > 0)) {
|
|
22
20
|
e.target.value = null;
|
|
23
21
|
return null;
|
|
@@ -27,10 +25,10 @@ export var UploadBase = function (_a) {
|
|
|
27
25
|
e.target.value = null;
|
|
28
26
|
return null;
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
Object.values(e.target.files).map(
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const fileList = [];
|
|
29
|
+
Object.values(e.target.files).map((file) => {
|
|
30
|
+
const size = file.size;
|
|
31
|
+
const ext = file.name.replace(/^.*\./, "").toLowerCase();
|
|
34
32
|
if (ext_ok.indexOf(ext) === -1) {
|
|
35
33
|
alert_add({ type: "error", message: "Yüklemeye çalıştığınız dosya türü desteklenmiyor. Desteklenen dosya türleri: " + ext_ok.join(", ") });
|
|
36
34
|
}
|
|
@@ -44,24 +42,27 @@ export var UploadBase = function (_a) {
|
|
|
44
42
|
if (onChange)
|
|
45
43
|
onChange(fileList);
|
|
46
44
|
if (targetForm) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
fileList.map(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
nameList_1.push(file.name);
|
|
45
|
+
const nameList = [];
|
|
46
|
+
let newform = {};
|
|
47
|
+
let uniqueID = new Date().getTime();
|
|
48
|
+
fileList.map((file) => {
|
|
49
|
+
uniqueID = uniqueID + 1;
|
|
50
|
+
newform = { ...newform, [name + uniqueID]: file };
|
|
51
|
+
nameList.push(file.name);
|
|
55
52
|
});
|
|
56
|
-
targetForm(
|
|
53
|
+
targetForm((prev) => ({
|
|
54
|
+
...prev,
|
|
55
|
+
uploadBaseList: { ...newform },
|
|
56
|
+
uploadBaseListName: nameList.join(", ")
|
|
57
|
+
}));
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
+
const defaultStyle = {
|
|
60
61
|
position: "relative",
|
|
61
62
|
cursor: "pointer"
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
-
return (_jsxs(Component, { className: className, style:
|
|
64
|
+
const Component = component.toLowerCase();
|
|
65
|
+
return (_jsxs(Component, { className: className, style: { ...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((i) => "." + i).join(","), style: {
|
|
65
66
|
position: "absolute",
|
|
66
67
|
top: 0,
|
|
67
68
|
left: 0,
|
|
@@ -72,14 +73,11 @@ export var UploadBase = function (_a) {
|
|
|
72
73
|
zIndex: 1
|
|
73
74
|
} })] }));
|
|
74
75
|
};
|
|
75
|
-
export
|
|
76
|
+
export const uploadBase_CreateForm = (formData) => {
|
|
76
77
|
var _a;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Object.keys(list).map(
|
|
80
|
-
var _a;
|
|
81
|
-
return (newform = __assign(__assign({}, newform), (_a = {}, _a[fileKey] = list[fileKey], _a)));
|
|
82
|
-
});
|
|
78
|
+
let newform = { ...formData };
|
|
79
|
+
const list = (_a = formData["uploadBaseList"]) !== null && _a !== void 0 ? _a : {};
|
|
80
|
+
Object.keys(list).map((fileKey) => (newform = { ...newform, [fileKey]: list[fileKey] }));
|
|
83
81
|
delete newform["uploadBaseList"];
|
|
84
82
|
delete newform["uploadBaseListName"];
|
|
85
83
|
return newform;
|
package/dist/esm/grid/index.js
CHANGED
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import { __assign, __rest, __spreadArray } from "tslib";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import React, { useState } from 'react';
|
|
4
3
|
import styles from './index.module.css';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
var classes = [
|
|
4
|
+
export const Row = ({ children, className = '', style, flexDirection = 'row', flexWrap = 'wrap', justifyContent = 'flex-start', alignContent = 'center', alignItems = 'center', rowSpacing = 2, colSpacing = 2, ...other }) => {
|
|
5
|
+
const classes = [
|
|
8
6
|
styles.row,
|
|
9
|
-
rowSpacing !== undefined && styles[
|
|
10
|
-
colSpacing !== undefined && styles[
|
|
11
|
-
flexDirection !== 'row' && styles[
|
|
12
|
-
flexWrap !== 'wrap' && styles[
|
|
13
|
-
justifyContent !== 'flex-start' && styles[
|
|
14
|
-
alignItems !== 'center' && styles[
|
|
15
|
-
alignContent !== 'center' && styles[
|
|
7
|
+
rowSpacing !== undefined && styles[`row-spacing-${rowSpacing}`],
|
|
8
|
+
colSpacing !== undefined && styles[`col-spacing-${colSpacing}`],
|
|
9
|
+
flexDirection !== 'row' && styles[`flex-${flexDirection.replace('-', '-')}`],
|
|
10
|
+
flexWrap !== 'wrap' && styles[`flex-${flexWrap}`],
|
|
11
|
+
justifyContent !== 'flex-start' && styles[`justify-${justifyContent.replace('flex-', '').replace('space-', '')}`],
|
|
12
|
+
alignItems !== 'center' && styles[`align-items-${alignItems.replace('flex-', '')}`],
|
|
13
|
+
alignContent !== 'center' && styles[`align-content-${alignContent.replace('flex-', '')}`],
|
|
16
14
|
className
|
|
17
15
|
]
|
|
18
16
|
.filter(Boolean)
|
|
19
17
|
.join(' ');
|
|
20
|
-
return (_jsx("div",
|
|
18
|
+
return (_jsx("div", { className: classes, style: style, ...other, children: children }));
|
|
21
19
|
};
|
|
22
|
-
export
|
|
20
|
+
export const Col = ({ children, className = '', style, xs, sm, md, lg, xl, xxl, ...other }) => {
|
|
23
21
|
// Cascading logic - aynı sizin component'inizdeki gibi
|
|
24
|
-
|
|
25
|
-
var classes = [
|
|
22
|
+
const classes = [
|
|
26
23
|
styles.col,
|
|
27
24
|
// Sadece belirtilen breakpoint'ler için class ekle
|
|
28
|
-
xs && styles[
|
|
29
|
-
sm && styles[
|
|
30
|
-
md && styles[
|
|
31
|
-
lg && styles[
|
|
32
|
-
xl && styles[
|
|
33
|
-
xxl && styles[
|
|
25
|
+
xs && styles[`col-xs-${xs}`],
|
|
26
|
+
sm && styles[`col-sm-${sm}`],
|
|
27
|
+
md && styles[`col-md-${md}`],
|
|
28
|
+
lg && styles[`col-lg-${lg}`],
|
|
29
|
+
xl && styles[`col-xl-${xl}`],
|
|
30
|
+
xxl && styles[`col-xxl-${xxl}`],
|
|
34
31
|
className
|
|
35
32
|
]
|
|
36
33
|
.filter(Boolean)
|
|
37
34
|
.join(' ');
|
|
38
|
-
return (_jsx("div",
|
|
35
|
+
return (_jsx("div", { className: classes, style: style, ...other, children: children }));
|
|
39
36
|
};
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var hiddenClasses = [];
|
|
37
|
+
export const Hidden = ({ children, hidden, onlyHidden, ...other }) => {
|
|
38
|
+
const existingClassName = children.props.className || '';
|
|
39
|
+
const hiddenClasses = [];
|
|
44
40
|
if (onlyHidden) {
|
|
45
|
-
onlyHidden.forEach(
|
|
46
|
-
hiddenClasses.push(styles[
|
|
41
|
+
onlyHidden.forEach((breakpoint) => {
|
|
42
|
+
hiddenClasses.push(styles[`hidden-${breakpoint}`]);
|
|
47
43
|
});
|
|
48
44
|
}
|
|
49
45
|
else if (hidden) {
|
|
50
46
|
// Orijinal mantık: seçilen breakpoint ve altındaki tüm breakpoint'ler gizlenir
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
const breakpoints = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
48
|
+
const targetIndex = breakpoints.indexOf(hidden);
|
|
53
49
|
if (targetIndex !== -1) {
|
|
54
|
-
for (
|
|
55
|
-
hiddenClasses.push(styles[
|
|
50
|
+
for (let i = 0; i <= targetIndex; i++) {
|
|
51
|
+
hiddenClasses.push(styles[`hidden-${breakpoints[i]}`]);
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
|
-
|
|
60
|
-
return React.cloneElement(children,
|
|
55
|
+
const newClassName = [existingClassName, ...hiddenClasses].filter(Boolean).join(' ');
|
|
56
|
+
return React.cloneElement(children, {
|
|
57
|
+
className: newClassName,
|
|
58
|
+
...other
|
|
59
|
+
});
|
|
61
60
|
};
|
|
62
|
-
export
|
|
63
|
-
|
|
61
|
+
export const DevelopGridComponent = () => {
|
|
62
|
+
const [currentBreakpoint, setCurrentBreakpoint] = useState('');
|
|
64
63
|
// Breakpoint detector
|
|
65
|
-
React.useEffect(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
const updateBreakpoint = () => {
|
|
66
|
+
const width = window.innerWidth;
|
|
67
|
+
let breakpoint = '';
|
|
69
68
|
if (width <= 576)
|
|
70
69
|
breakpoint = 'XS (≤576px)';
|
|
71
70
|
else if (width <= 768)
|
|
@@ -82,7 +81,7 @@ export var DevelopGridComponent = function () {
|
|
|
82
81
|
};
|
|
83
82
|
updateBreakpoint();
|
|
84
83
|
window.addEventListener('resize', updateBreakpoint);
|
|
85
|
-
return
|
|
84
|
+
return () => window.removeEventListener('resize', updateBreakpoint);
|
|
86
85
|
}, []);
|
|
87
86
|
return (_jsxs("div", { style: {
|
|
88
87
|
position: 'fixed',
|
package/dist/esm/icon/icons.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export
|
|
2
|
+
export const iconMap = {
|
|
3
3
|
close: {
|
|
4
4
|
viewBox: '0 -960 960 960',
|
|
5
5
|
content: (_jsx(_Fragment, { children: _jsx("path", { d: "m336-280-56-56 144-144-144-143 56-56 144 144 143-144 56 56-144 143 144 144-56 56-143-144-144 144Z" }) }))
|
package/dist/esm/icon/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { iconMap } from './icons';
|
|
4
|
-
export
|
|
5
|
-
|
|
3
|
+
export const iconList = Object.keys(iconMap);
|
|
4
|
+
const defaultIconStyle = {
|
|
6
5
|
userSelect: 'none',
|
|
7
6
|
width: '1em',
|
|
8
7
|
height: '1em',
|
|
@@ -13,14 +12,23 @@ var defaultIconStyle = {
|
|
|
13
12
|
alignItems: 'center',
|
|
14
13
|
justifyContent: 'center'
|
|
15
14
|
};
|
|
16
|
-
export
|
|
17
|
-
var name = _a.name, iconMui = _a.iconMui, customIcon = _a.customIcon, fontSize = _a.fontSize, color = _a.color, className = _a.className, style = _a.style, other = __rest(_a, ["name", "iconMui", "customIcon", "fontSize", "color", "className", "style"]);
|
|
15
|
+
export const Icon = ({ name, iconMui, customIcon, fontSize, color, className, style, ...other }) => {
|
|
18
16
|
if (iconMui) {
|
|
19
|
-
return (_jsx("span",
|
|
17
|
+
return (_jsx("span", { className: `material-icons ${className || ''}`, style: {
|
|
18
|
+
...defaultIconStyle,
|
|
19
|
+
...style,
|
|
20
|
+
fontSize: fontSize || '1.3rem',
|
|
21
|
+
color: color || 'inherit'
|
|
22
|
+
}, "aria-hidden": "true", ...other, children: iconMui }));
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
const iconComponent = name ? iconMap[name] : customIcon;
|
|
22
25
|
if (!iconComponent) {
|
|
23
26
|
return _jsx("span", { children: "\u26A0\uFE0F" });
|
|
24
27
|
}
|
|
25
|
-
return (_jsx("span",
|
|
28
|
+
return (_jsx("span", { className: className, style: {
|
|
29
|
+
...defaultIconStyle,
|
|
30
|
+
...style,
|
|
31
|
+
fontSize: fontSize || '1.5rem',
|
|
32
|
+
color: color || 'inherit'
|
|
33
|
+
}, ...other, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: iconComponent.viewBox, fill: 'currentColor', width: "1em", height: "1em", style: { display: 'block', flexShrink: 0 }, children: iconComponent.content }) }));
|
|
26
34
|
};
|