@sydsoft/base 1.50.0 → 1.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_dist/{_lib → esm/_lib}/baseFunctions.js +38 -25
- package/_dist/{_lib → esm/_lib}/inputMask.js +69 -66
- package/_dist/{_lib → esm/_lib}/listFunctions.js +13 -12
- package/_dist/esm/_lib/storage/cookies.js +34 -0
- package/_dist/esm/_lib/storage/encData.js +43 -0
- package/_dist/{_lib → esm/_lib}/storage/localStorage.js +10 -10
- package/_dist/{_lib → esm/_lib}/storage/sessionStorage.js +10 -10
- package/_dist/{_lib → esm/_lib}/useInterval.js +5 -5
- package/_dist/{alert → esm/alert}/index.js +30 -28
- package/_dist/esm/box/Box.js +15 -0
- package/_dist/esm/box/BoxContent.js +7 -0
- package/_dist/esm/box/BoxFooter.js +8 -0
- package/_dist/esm/box/BoxHeader.js +9 -0
- package/_dist/esm/countDown/index.js +97 -0
- package/_dist/{dateTime → esm/dateTime}/index.js +31 -25
- package/_dist/esm/form/Button.js +76 -0
- package/_dist/esm/form/Checkbox.js +23 -0
- package/_dist/esm/form/Dialog.js +40 -0
- package/_dist/esm/form/Form.js +12 -0
- package/_dist/esm/form/FormOlustur.js +52 -0
- package/_dist/{form → esm/form}/Input.js +56 -57
- package/_dist/esm/form/Label.js +9 -0
- package/_dist/esm/form/SearchableInput.js +272 -0
- package/_dist/esm/form/UploadBase.js +86 -0
- package/_dist/esm/grid/index.js +97 -0
- package/_dist/{icon → esm/icon}/icons.js +1 -1
- package/_dist/esm/icon/index.js +26 -0
- package/_dist/esm/menu/index.js +52 -0
- package/_dist/esm/modal/index.js +66 -0
- package/_dist/{popover → esm/popover}/index.js +100 -100
- package/_dist/esm/tooltip/index.js +119 -0
- package/package.json +8 -9
- package/_dist/_lib/storage/cookies.js +0 -33
- package/_dist/_lib/storage/encData.js +0 -41
- package/_dist/box/Box.js +0 -14
- package/_dist/box/BoxContent.js +0 -5
- package/_dist/box/BoxFooter.js +0 -10
- package/_dist/box/BoxHeader.js +0 -10
- package/_dist/countDown/index.js +0 -92
- package/_dist/form/Button.js +0 -82
- package/_dist/form/Checkbox.js +0 -22
- package/_dist/form/Dialog.js +0 -53
- package/_dist/form/Form.js +0 -10
- package/_dist/form/FormOlustur.js +0 -50
- package/_dist/form/Label.js +0 -7
- package/_dist/form/SearchableInput.js +0 -260
- package/_dist/form/UploadBase.js +0 -84
- package/_dist/grid/index.js +0 -96
- package/_dist/icon/index.js +0 -34
- package/_dist/menu/index.js +0 -50
- package/_dist/modal/index.js +0 -64
- package/_dist/tooltip/index.js +0 -202
- /package/_dist/{_lib → esm/_lib}/baseFunctions.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/inputMask.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/listFunctions.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/cookies.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/encData.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/localStorage.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/storage/sessionStorage.d.ts +0 -0
- /package/_dist/{_lib → esm/_lib}/useInterval.d.ts +0 -0
- /package/_dist/{alert → esm/alert}/index.d.ts +0 -0
- /package/_dist/{alert → esm/alert}/index.module.css +0 -0
- /package/_dist/{box → esm/box}/Box.d.ts +0 -0
- /package/_dist/{box → esm/box}/Box.module.css +0 -0
- /package/_dist/{box → esm/box}/BoxContent.d.ts +0 -0
- /package/_dist/{box → esm/box}/BoxFooter.d.ts +0 -0
- /package/_dist/{box → esm/box}/BoxHeader.d.ts +0 -0
- /package/_dist/{box → esm/box}/index.d.ts +0 -0
- /package/_dist/{box → esm/box}/index.js +0 -0
- /package/_dist/{countDown → esm/countDown}/index.d.ts +0 -0
- /package/_dist/{dateTime → esm/dateTime}/index.d.ts +0 -0
- /package/_dist/{form → esm/form}/Button.d.ts +0 -0
- /package/_dist/{form → esm/form}/Checkbox.d.ts +0 -0
- /package/_dist/{form → esm/form}/Dialog.d.ts +0 -0
- /package/_dist/{form → esm/form}/Form.d.ts +0 -0
- /package/_dist/{form → esm/form}/FormOlustur.d.ts +0 -0
- /package/_dist/{form → esm/form}/Input.d.ts +0 -0
- /package/_dist/{form → esm/form}/Label.d.ts +0 -0
- /package/_dist/{form → esm/form}/SearchableInput.d.ts +0 -0
- /package/_dist/{form → esm/form}/UploadBase.d.ts +0 -0
- /package/_dist/{form → esm/form}/index.d.ts +0 -0
- /package/_dist/{form → esm/form}/index.js +0 -0
- /package/_dist/{form → esm/form}/styles/Button.module.css +0 -0
- /package/_dist/{form → esm/form}/styles/Input.module.css +0 -0
- /package/_dist/{form → esm/form}/styles/Label.module.css +0 -0
- /package/_dist/{form → esm/form}/styles/SearchableInput.module.css +0 -0
- /package/_dist/{grid → esm/grid}/index.d.ts +0 -0
- /package/_dist/{grid → esm/grid}/index.module.css +0 -0
- /package/_dist/{icon → esm/icon}/icons.d.ts +0 -0
- /package/_dist/{icon → esm/icon}/index.d.ts +0 -0
- /package/_dist/{icon → esm/icon}/mui.d.ts +0 -0
- /package/_dist/{icon → esm/icon}/mui.js +0 -0
- /package/_dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/_dist/{index.js → esm/index.js} +0 -0
- /package/_dist/{menu → esm/menu}/index.d.ts +0 -0
- /package/_dist/{menu → esm/menu}/index.module.css +0 -0
- /package/_dist/{modal → esm/modal}/index.d.ts +0 -0
- /package/_dist/{modal → esm/modal}/index.module.css +0 -0
- /package/_dist/{popover → esm/popover}/index.d.ts +0 -0
- /package/_dist/{popover → esm/popover}/index.module.css +0 -0
- /package/_dist/{tooltip → esm/tooltip}/index.d.ts +0 -0
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Input } from './index';
|
|
3
|
-
import { convertForSearch, convertLowerCase } from '../_lib/baseFunctions';
|
|
4
|
-
import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import { onKeyboardSelection, setScrollListPosition } from '../_lib/listFunctions';
|
|
6
|
-
import { Icon } from '../icon';
|
|
7
|
-
import styles from './styles/SearchableInput.module.css';
|
|
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) => {
|
|
22
|
-
if (autoCompleteList && (autoCompleteList === null || autoCompleteList === void 0 ? void 0 : autoCompleteList.length) > 0) {
|
|
23
|
-
alert('AutoCompleteList zaten tanımlı olduğundan dışardan data seti değiştirilemez.');
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
setData(list);
|
|
27
|
-
value && sendChange(value);
|
|
28
|
-
setLoading(false);
|
|
29
|
-
if (!Array.isArray(list) || list.length == 0) {
|
|
30
|
-
clear(false);
|
|
31
|
-
}
|
|
32
|
-
callback && callback();
|
|
33
|
-
// isDev && console.log("setAutoCompleteList =>", name, value, list);
|
|
34
|
-
},
|
|
35
|
-
clear: (openList = false, focusInput = false) => clear(openList, focusInput),
|
|
36
|
-
open: () => {
|
|
37
|
-
setOpen(true);
|
|
38
|
-
refInput.current && refInput.current.focus();
|
|
39
|
-
},
|
|
40
|
-
close: () => setOpen(false),
|
|
41
|
-
checkByValue: (value, openList = false) => checkByValue(value, openList),
|
|
42
|
-
setLoading: (value) => setLoading(value)
|
|
43
|
-
}), [autoCompleteList, data, value]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (inputRef)
|
|
46
|
-
inputRef.current = refInput.current;
|
|
47
|
-
}, [refInput.current]);
|
|
48
|
-
useEffect(() => onLoad && onLoad(value), []);
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (autoCompleteList && Array.isArray(autoCompleteList)) {
|
|
51
|
-
if (autoCompleteList.length > 0) {
|
|
52
|
-
// Sadece gerçekten farklıysa set et
|
|
53
|
-
if (JSON.stringify(autoCompleteList) !== JSON.stringify(data)) {
|
|
54
|
-
setData(autoCompleteList);
|
|
55
|
-
// isDev && console.log("autoCompleteList dolu =>", name, autoCompleteList);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
// Boş array geldi VE data zaten boş değilse
|
|
60
|
-
if (data.length > 0) {
|
|
61
|
-
setData([]);
|
|
62
|
-
// isDev && console.log("autoCompleteList boşaltıldı =>", name);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, [autoCompleteList]);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
// isDev && console.log('data =>', name, data, 'selectedValue =>', selectedValue, 'value =>', value);
|
|
69
|
-
if (!Array.isArray(data)) {
|
|
70
|
-
setData([]);
|
|
71
|
-
}
|
|
72
|
-
if (data.length > 0) {
|
|
73
|
-
setLoading(false);
|
|
74
|
-
checkByValue(selectedValue, open);
|
|
75
|
-
if (!value && ilkSec) {
|
|
76
|
-
checkByValue(data[0][valueKey], false);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
!isDataFromApi && clear(false);
|
|
81
|
-
}
|
|
82
|
-
}, [data]);
|
|
83
|
-
// Seçim değişikliğinde parent'ı bilgilendir
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
// isDev && console.log('selectedValue =>', name, selectedValue, 'value =>', value);
|
|
86
|
-
if ((value === null || value === void 0 ? void 0 : value.toString()) != (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.toString())) {
|
|
87
|
-
checkByValue(value, open);
|
|
88
|
-
// isDev && console.log('value Kontrol ediliyor', value, selectedValue);
|
|
89
|
-
}
|
|
90
|
-
}, [value]);
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (parentInputValue !== parentValue) {
|
|
93
|
-
setParentValue(parentInputValue);
|
|
94
|
-
clear(false);
|
|
95
|
-
// isDev && console.log(name, "parentInputValueDeğişti =>", parentInputValue);
|
|
96
|
-
}
|
|
97
|
-
}, [parentInputValue]);
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
const checkHideBackDrop = (e) => {
|
|
100
|
-
if (open && refMain.current && !refMain.current.contains(e.target)) {
|
|
101
|
-
checkByInput();
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const checkESC = (e) => {
|
|
105
|
-
if (e.keyCode === 27 || e.key === 'Escape' || e.code === 'Escape')
|
|
106
|
-
checkByInput();
|
|
107
|
-
};
|
|
108
|
-
window.addEventListener('mousedown', checkHideBackDrop);
|
|
109
|
-
if (refMain.current)
|
|
110
|
-
refMain.current.addEventListener('keydown', checkESC);
|
|
111
|
-
if (open) {
|
|
112
|
-
setScrollListPosition(refList);
|
|
113
|
-
if (!listPositionRelative) {
|
|
114
|
-
window.addEventListener('scroll', handleUpdatePosition, true);
|
|
115
|
-
window.addEventListener('resize', handleUpdatePosition);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return () => {
|
|
119
|
-
window.removeEventListener('mousedown', checkHideBackDrop);
|
|
120
|
-
if (refMain.current)
|
|
121
|
-
refMain.current.removeEventListener('keydown', checkESC);
|
|
122
|
-
window.removeEventListener('scroll', handleUpdatePosition, true);
|
|
123
|
-
window.removeEventListener('resize', handleUpdatePosition);
|
|
124
|
-
};
|
|
125
|
-
}, [open]);
|
|
126
|
-
useLayoutEffect(() => handleUpdatePosition(), [open]);
|
|
127
|
-
const setValue = useCallback((item, openList) => {
|
|
128
|
-
var _a, _b;
|
|
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 : '';
|
|
131
|
-
setOpen(openList);
|
|
132
|
-
setText(newLabel);
|
|
133
|
-
// isDev && console.log(name, "setValue", newValue, "item", item, "value", value);
|
|
134
|
-
if (newValue === selectedValue)
|
|
135
|
-
return;
|
|
136
|
-
setFilter('');
|
|
137
|
-
setSelectedValue(newValue);
|
|
138
|
-
onChange && sendChange(newValue);
|
|
139
|
-
onSelect && onSelect(item);
|
|
140
|
-
}, [onChange, onSelect, name, selectedValue, valueKey, labelKey]);
|
|
141
|
-
const textInputOnChange = useCallback((e) => {
|
|
142
|
-
setSelectedValue(undefined);
|
|
143
|
-
setText(e.target.value);
|
|
144
|
-
setFilter(e.target.value.trim());
|
|
145
|
-
setOpen(true);
|
|
146
|
-
onText && onText(e.target.value);
|
|
147
|
-
}, [setValue, onText]);
|
|
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));
|
|
151
|
-
if (!find && newCreate && newItemCreate.create) {
|
|
152
|
-
find = newItemCreate;
|
|
153
|
-
}
|
|
154
|
-
// isDev && console.log('find', find, 'value', value, data);
|
|
155
|
-
setValue(find, openList);
|
|
156
|
-
}, [data, valueKey, newCreate, newItemCreate, setValue]);
|
|
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); });
|
|
159
|
-
if (findByLabel && value == findByLabel[valueKey]) {
|
|
160
|
-
setOpen(false);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
setValue(findByLabel, false);
|
|
164
|
-
if (!findByLabel)
|
|
165
|
-
setText('');
|
|
166
|
-
if (isDataFromApi && !findByLabel && data.length === 0) {
|
|
167
|
-
if (onText)
|
|
168
|
-
onText('');
|
|
169
|
-
}
|
|
170
|
-
}, [data, labelKey, value, valueKey, isDataFromApi, onText, setValue, refInput.current]);
|
|
171
|
-
const clear = useCallback((openList = true, focusInput = false) => {
|
|
172
|
-
var _a;
|
|
173
|
-
setFilter('');
|
|
174
|
-
setText('');
|
|
175
|
-
setValue(undefined, openList);
|
|
176
|
-
onText && onText('');
|
|
177
|
-
focusInput && ((_a = refInput === null || refInput === void 0 ? void 0 : refInput.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
178
|
-
}, [setValue, onText]);
|
|
179
|
-
const sendChange = useCallback((value) => {
|
|
180
|
-
// isDev && console.log(name, "sendChange", value, "selectedValue", selectedValue);
|
|
181
|
-
if (onChange && value !== selectedValue) {
|
|
182
|
-
onChange({ target: { name, value } });
|
|
183
|
-
}
|
|
184
|
-
}, [onChange, name]);
|
|
185
|
-
const filteredData = useMemo(() => {
|
|
186
|
-
let list;
|
|
187
|
-
if (filter.length > 0) {
|
|
188
|
-
list = data.filter((item) => convertForSearch(item[labelKey]).includes(convertForSearch(filter)) || item[labelKey] == filter);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
list = data;
|
|
192
|
-
}
|
|
193
|
-
if (newCreate && text.length > 0) {
|
|
194
|
-
const filterText = data.find((item) => item[labelKey].toString().toLowerCase() === text.toString().toLowerCase());
|
|
195
|
-
if (!filterText) {
|
|
196
|
-
const newItem = { [labelKey]: text, [valueKey]: text, create: true };
|
|
197
|
-
list = [newItem, ...list];
|
|
198
|
-
setNewItemCreate(newItem);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
if (newItemCreate.create)
|
|
202
|
-
setNewItemCreate({ create: false });
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return list;
|
|
206
|
-
}, [data, filter, newCreate, text, valueKey, labelKey]);
|
|
207
|
-
const handleUpdatePosition = () => {
|
|
208
|
-
if (open && !listPositionRelative && refMain) {
|
|
209
|
-
setFixedPosition(refMain);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
const onKeyDown = (e) => {
|
|
213
|
-
if (!open || !refList.current)
|
|
214
|
-
return null;
|
|
215
|
-
onKeyboardSelection({
|
|
216
|
-
e,
|
|
217
|
-
targetElement: refList,
|
|
218
|
-
checkByInput,
|
|
219
|
-
checkByValue,
|
|
220
|
-
clear,
|
|
221
|
-
itemClass: 'li.item',
|
|
222
|
-
selectedClass: 'selected'
|
|
223
|
-
});
|
|
224
|
-
};
|
|
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));
|
|
232
|
-
})] }) }))] }));
|
|
233
|
-
});
|
|
234
|
-
const setFixedPosition = (refMain) => {
|
|
235
|
-
if (!refMain.current)
|
|
236
|
-
return;
|
|
237
|
-
const target = refMain.current;
|
|
238
|
-
const targetPosition = target.getBoundingClientRect();
|
|
239
|
-
const listDiv = target.querySelector('.listDiv');
|
|
240
|
-
if (listDiv) {
|
|
241
|
-
const listDivUL = target.querySelector('ul');
|
|
242
|
-
if (!listDiv)
|
|
243
|
-
return;
|
|
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;
|
|
251
|
-
if (spaceBelow < listHeight && spaceAbove > listHeight) {
|
|
252
|
-
style.push(`top:${targetPosition.top - listHeight}px`);
|
|
253
|
-
style.push(`margin-top:-1px`);
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
style.push(`top:${targetPosition.top + targetPosition.height}px`);
|
|
257
|
-
}
|
|
258
|
-
listDiv.setAttribute('style', style.join(';'));
|
|
259
|
-
}
|
|
260
|
-
};
|
package/_dist/form/UploadBase.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024
|
|
4
|
-
* @author: izzetseydaoglu
|
|
5
|
-
* @last-modified: 11.06.2024 02:39
|
|
6
|
-
*/
|
|
7
|
-
import { useEffect, useRef } from "react";
|
|
8
|
-
import { alert_add } from "../alert";
|
|
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(() => {
|
|
15
|
-
if (refUploadInput)
|
|
16
|
-
refUploadInput.current = ref.current;
|
|
17
|
-
}, [ref.current]);
|
|
18
|
-
const fileSelected = (e) => {
|
|
19
|
-
if (!(e.target.files.length > 0)) {
|
|
20
|
-
e.target.value = null;
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
if (e.target.files.length > maxFile) {
|
|
24
|
-
alert_add({ type: "error", message: "En fazla " + maxFile + " dosya seçebilirsiniz." });
|
|
25
|
-
e.target.value = null;
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const fileList = [];
|
|
29
|
-
Object.values(e.target.files).map((file) => {
|
|
30
|
-
const size = file.size;
|
|
31
|
-
const ext = file.name.replace(/^.*\./, "").toLowerCase();
|
|
32
|
-
if (ext_ok.indexOf(ext) === -1) {
|
|
33
|
-
alert_add({ type: "error", message: "Yüklemeye çalıştığınız dosya türü desteklenmiyor. Desteklenen dosya türleri: " + ext_ok.join(", ") });
|
|
34
|
-
}
|
|
35
|
-
else if (size > maxSize * 1000000) {
|
|
36
|
-
alert_add({ type: "error", message: "En fazla " + maxSize + "MB büyüklüğündeki dosyaları seçebilirsiniz." });
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
fileList.push(file);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
if (onChange)
|
|
43
|
-
onChange(fileList);
|
|
44
|
-
if (targetForm) {
|
|
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);
|
|
52
|
-
});
|
|
53
|
-
targetForm((prev) => ({
|
|
54
|
-
...prev,
|
|
55
|
-
uploadBaseList: { ...newform },
|
|
56
|
-
uploadBaseListName: nameList.join(", ")
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const defaultStyle = {
|
|
61
|
-
position: "relative",
|
|
62
|
-
cursor: "pointer"
|
|
63
|
-
};
|
|
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: {
|
|
66
|
-
position: "absolute",
|
|
67
|
-
top: 0,
|
|
68
|
-
left: 0,
|
|
69
|
-
opacity: 0,
|
|
70
|
-
width: "100%",
|
|
71
|
-
height: "100%",
|
|
72
|
-
cursor: "pointer",
|
|
73
|
-
zIndex: 1
|
|
74
|
-
} })] }));
|
|
75
|
-
};
|
|
76
|
-
export const uploadBase_CreateForm = (formData) => {
|
|
77
|
-
var _a;
|
|
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] }));
|
|
81
|
-
delete newform["uploadBaseList"];
|
|
82
|
-
delete newform["uploadBaseListName"];
|
|
83
|
-
return newform;
|
|
84
|
-
};
|
package/_dist/grid/index.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import styles from './index.module.css';
|
|
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 = [
|
|
6
|
-
styles.row,
|
|
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-', '')}`],
|
|
14
|
-
className
|
|
15
|
-
]
|
|
16
|
-
.filter(Boolean)
|
|
17
|
-
.join(' ');
|
|
18
|
-
return (_jsx("div", { className: classes, style: style, ...other, children: children }));
|
|
19
|
-
};
|
|
20
|
-
export const Col = ({ children, className = '', style, xs, sm, md, lg, xl, xxl, ...other }) => {
|
|
21
|
-
// Cascading logic - aynı sizin component'inizdeki gibi
|
|
22
|
-
const classes = [
|
|
23
|
-
styles.col,
|
|
24
|
-
// Sadece belirtilen breakpoint'ler için class ekle
|
|
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}`],
|
|
31
|
-
className
|
|
32
|
-
]
|
|
33
|
-
.filter(Boolean)
|
|
34
|
-
.join(' ');
|
|
35
|
-
return (_jsx("div", { className: classes, style: style, ...other, children: children }));
|
|
36
|
-
};
|
|
37
|
-
export const Hidden = ({ children, hidden, onlyHidden, ...other }) => {
|
|
38
|
-
const existingClassName = children.props.className || '';
|
|
39
|
-
const hiddenClasses = [];
|
|
40
|
-
if (onlyHidden) {
|
|
41
|
-
onlyHidden.forEach((breakpoint) => {
|
|
42
|
-
hiddenClasses.push(styles[`hidden-${breakpoint}`]);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
else if (hidden) {
|
|
46
|
-
// Orijinal mantık: seçilen breakpoint ve altındaki tüm breakpoint'ler gizlenir
|
|
47
|
-
const breakpoints = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
48
|
-
const targetIndex = breakpoints.indexOf(hidden);
|
|
49
|
-
if (targetIndex !== -1) {
|
|
50
|
-
for (let i = 0; i <= targetIndex; i++) {
|
|
51
|
-
hiddenClasses.push(styles[`hidden-${breakpoints[i]}`]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const newClassName = [existingClassName, ...hiddenClasses].filter(Boolean).join(' ');
|
|
56
|
-
return React.cloneElement(children, {
|
|
57
|
-
className: newClassName,
|
|
58
|
-
...other
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
export const DevelopGridComponent = () => {
|
|
62
|
-
const [currentBreakpoint, setCurrentBreakpoint] = useState('');
|
|
63
|
-
// Breakpoint detector
|
|
64
|
-
React.useEffect(() => {
|
|
65
|
-
const updateBreakpoint = () => {
|
|
66
|
-
const width = window.innerWidth;
|
|
67
|
-
let breakpoint = '';
|
|
68
|
-
if (width <= 576)
|
|
69
|
-
breakpoint = 'XS (≤576px)';
|
|
70
|
-
else if (width <= 768)
|
|
71
|
-
breakpoint = 'SM (577-768px)';
|
|
72
|
-
else if (width <= 992)
|
|
73
|
-
breakpoint = 'MD (769-992px)';
|
|
74
|
-
else if (width <= 1200)
|
|
75
|
-
breakpoint = 'LG (993-1200px)';
|
|
76
|
-
else if (width <= 1400)
|
|
77
|
-
breakpoint = 'XL (1201-1400px)';
|
|
78
|
-
else
|
|
79
|
-
breakpoint = 'XXL (≥1401px)';
|
|
80
|
-
setCurrentBreakpoint(breakpoint);
|
|
81
|
-
};
|
|
82
|
-
updateBreakpoint();
|
|
83
|
-
window.addEventListener('resize', updateBreakpoint);
|
|
84
|
-
return () => window.removeEventListener('resize', updateBreakpoint);
|
|
85
|
-
}, []);
|
|
86
|
-
return (_jsxs("div", { style: {
|
|
87
|
-
position: 'fixed',
|
|
88
|
-
bottom: '10px',
|
|
89
|
-
right: '10px',
|
|
90
|
-
background: '#333',
|
|
91
|
-
color: 'white',
|
|
92
|
-
padding: '10px',
|
|
93
|
-
borderRadius: '4px',
|
|
94
|
-
zIndex: 9999999
|
|
95
|
-
}, children: ["Current: ", currentBreakpoint] }));
|
|
96
|
-
};
|
package/_dist/icon/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { iconMap } from './icons';
|
|
3
|
-
export const iconList = Object.keys(iconMap);
|
|
4
|
-
const defaultIconStyle = {
|
|
5
|
-
userSelect: 'none',
|
|
6
|
-
width: '1em',
|
|
7
|
-
height: '1em',
|
|
8
|
-
// display: 'inline-block',
|
|
9
|
-
verticalAlign: 'middle',
|
|
10
|
-
flexShrink: 0,
|
|
11
|
-
display: 'flex',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
justifyContent: 'center'
|
|
14
|
-
};
|
|
15
|
-
export const Icon = ({ name, iconMui, customIcon, fontSize, color, className, style, ...other }) => {
|
|
16
|
-
if (iconMui) {
|
|
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 }));
|
|
23
|
-
}
|
|
24
|
-
const iconComponent = name ? iconMap[name] : customIcon;
|
|
25
|
-
if (!iconComponent) {
|
|
26
|
-
return _jsx("span", { children: "\u26A0\uFE0F" });
|
|
27
|
-
}
|
|
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 }) }));
|
|
34
|
-
};
|
package/_dist/menu/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @author : izzetseydaoglu
|
|
4
|
-
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
5
|
-
* @version : 2026-02-07 19:31:01
|
|
6
|
-
*/
|
|
7
|
-
import React, { memo, useMemo } from 'react';
|
|
8
|
-
import { Dialog } from '../form';
|
|
9
|
-
import { Popover } from '../popover';
|
|
10
|
-
import Link from 'next/link';
|
|
11
|
-
import styles from './index.module.css';
|
|
12
|
-
export const Menu = memo(function MemoFunction({ menu, className, style, withIcon = 'auto' }) {
|
|
13
|
-
const withIconComponent = useMemo(() => {
|
|
14
|
-
if (withIcon === true)
|
|
15
|
-
return true;
|
|
16
|
-
if (withIcon === false)
|
|
17
|
-
return false;
|
|
18
|
-
return Object.values(menu).some((item) => 'icon' in item && !!item.icon);
|
|
19
|
-
}, [menu, withIcon]);
|
|
20
|
-
const withRightComponent = useMemo(() => {
|
|
21
|
-
return Object.values(menu).some((item) => 'rightComponent' in item && !!item.rightComponent);
|
|
22
|
-
}, [menu]);
|
|
23
|
-
const handleClick = (item, e) => {
|
|
24
|
-
if (!item.onClick)
|
|
25
|
-
return;
|
|
26
|
-
if (item.dialog) {
|
|
27
|
-
Dialog({ ...item.dialog }).then((result) => {
|
|
28
|
-
if (result && item.onClick) {
|
|
29
|
-
item.onClick(e);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
item.onClick(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
return (_jsx("ul", { className: `smenu ${styles.ul} ${className || ''}`, style: style, children: Object.values(menu).map((item, key) => {
|
|
38
|
-
const { fullComponent, icon, title, rightComponent, seperator, href, style, itemProps, type, items, menuProps, subMenuPopoverProps, ...other } = item;
|
|
39
|
-
const hasSubmenu = type === 'submenu' && Array.isArray(items) && items.length > 0;
|
|
40
|
-
if (fullComponent)
|
|
41
|
-
return React.cloneElement(fullComponent, { key: key });
|
|
42
|
-
if (seperator)
|
|
43
|
-
return _jsx("li", { className: styles.seperator, style: style, ...itemProps, ...other }, key);
|
|
44
|
-
const Component = (_jsxs(_Fragment, { children: [withIconComponent && _jsx("div", { className: styles.menuicon, children: icon }), _jsx("div", { className: styles.menutitle, children: title }), withRightComponent && _jsx("div", { className: styles.rightmenu, children: rightComponent })] }));
|
|
45
|
-
if (hasSubmenu) {
|
|
46
|
-
return (_jsx(Popover, { component: _jsx("li", { style: style, ...itemProps, ...other, children: Component }), position: "right-top", ...(subMenuPopoverProps || {}), children: _jsx(Menu, { menu: items, ...(menuProps || {}) }) }, key));
|
|
47
|
-
}
|
|
48
|
-
return (_jsx("li", { style: style, onClick: (e) => handleClick(item, e), ...itemProps, ...other, children: href ? _jsx(Link, { href: href, children: Component }) : Component }, key));
|
|
49
|
-
}) }));
|
|
50
|
-
});
|
package/_dist/modal/index.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2023
|
|
4
|
-
* @author: izzetseydaoglu
|
|
5
|
-
* @last-modified: 9.02.2024 06:07
|
|
6
|
-
*/
|
|
7
|
-
import { memo, useEffect, useRef, useState } from "react";
|
|
8
|
-
import ReactDOM from "react-dom";
|
|
9
|
-
import styles from "./index.module.css";
|
|
10
|
-
export const Modal = memo(function MemoFunction({ refModal = null, children, open = false, close, keepMounted = false, fullScreen = false, hideBackdrop = true, hideEsc = false, hideCloseButton = false, modalStyle, backdropStyle, vertialAlign = "center", horizontalAlign = "center" }) {
|
|
11
|
-
const [modalDiv, setModalDiv] = useState(null);
|
|
12
|
-
const ref = useRef(null);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (refModal)
|
|
15
|
-
refModal.current = ref.current;
|
|
16
|
-
}, [ref.current]);
|
|
17
|
-
const onClose = () => {
|
|
18
|
-
if (close)
|
|
19
|
-
close();
|
|
20
|
-
};
|
|
21
|
-
const checkHideBackDrop = (e) => {
|
|
22
|
-
if (open && ref.current && !ref.current.contains(e.target))
|
|
23
|
-
onClose();
|
|
24
|
-
};
|
|
25
|
-
const checkESC = (e) => {
|
|
26
|
-
if (e.keyCode === 27 || e.key === "Escape" || e.code === "Escape")
|
|
27
|
-
onClose();
|
|
28
|
-
};
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (open) {
|
|
31
|
-
if (hideBackdrop)
|
|
32
|
-
window.addEventListener("mousedown", checkHideBackDrop);
|
|
33
|
-
if (hideEsc)
|
|
34
|
-
window.addEventListener("keydown", checkESC);
|
|
35
|
-
}
|
|
36
|
-
return () => {
|
|
37
|
-
if (hideBackdrop)
|
|
38
|
-
window.removeEventListener("mousedown", checkHideBackDrop);
|
|
39
|
-
if (hideEsc)
|
|
40
|
-
window.removeEventListener("keydown", checkESC);
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (!modalDiv) {
|
|
45
|
-
const modalDivCheck = document.getElementById("smodal");
|
|
46
|
-
if (modalDivCheck) {
|
|
47
|
-
setModalDiv(modalDivCheck);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const div = document.createElement("div");
|
|
51
|
-
div.setAttribute("id", "smodal");
|
|
52
|
-
document.body.appendChild(div);
|
|
53
|
-
setModalDiv(div);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return () => {
|
|
57
|
-
onClose();
|
|
58
|
-
};
|
|
59
|
-
}, []);
|
|
60
|
-
if ((!keepMounted && !open) || typeof window === "undefined")
|
|
61
|
-
return null;
|
|
62
|
-
const Component = (_jsx("div", { className: `${styles.backdrop} ${open ? styles.backdrop_open : ""}`, style: { alignItems: vertialAlign, justifyContent: horizontalAlign, ...backdropStyle }, children: _jsxs("div", { ref: ref, className: `smodal ${styles.modal} ${fullScreen ? styles.fullscreen : ""}`, style: modalStyle, children: [!hideCloseButton && (_jsx("div", { className: `close ${styles.close_fixed}`, children: _jsx("div", { className: styles.close, onClick: onClose, children: "\u2715" }) })), children] }) }));
|
|
63
|
-
return modalDiv ? ReactDOM.createPortal(Component, modalDiv) : null;
|
|
64
|
-
});
|