@sydsoft/base 1.47.0 → 1.49.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 → _dist}/_lib/baseFunctions.d.ts +0 -1
- package/{dist/esm → _dist}/_lib/baseFunctions.js +25 -38
- package/{dist/esm → _dist}/_lib/inputMask.js +66 -69
- package/{dist/esm → _dist}/_lib/listFunctions.js +12 -13
- package/_dist/_lib/storage/cookies.d.ts +4 -0
- package/_dist/_lib/storage/cookies.js +33 -0
- package/_dist/_lib/storage/encData.js +41 -0
- package/{dist/esm → _dist}/_lib/storage/localStorage.js +10 -10
- package/{dist/esm → _dist}/_lib/storage/sessionStorage.js +10 -10
- package/{dist/esm → _dist}/_lib/useInterval.js +5 -5
- package/{dist/esm → _dist}/alert/index.js +28 -30
- package/_dist/box/Box.js +14 -0
- package/_dist/box/BoxContent.js +5 -0
- package/_dist/box/BoxFooter.js +10 -0
- package/_dist/box/BoxHeader.js +10 -0
- package/_dist/countDown/index.js +92 -0
- package/{dist/esm → _dist}/dateTime/index.js +25 -31
- package/_dist/form/Button.js +82 -0
- package/_dist/form/Checkbox.js +22 -0
- package/_dist/form/Dialog.js +53 -0
- package/_dist/form/Form.js +10 -0
- package/_dist/form/FormOlustur.js +50 -0
- package/{dist/esm → _dist}/form/Input.js +57 -56
- package/_dist/form/Label.js +7 -0
- package/{dist/esm → _dist}/form/SearchableInput.d.ts +0 -1
- package/_dist/form/SearchableInput.js +260 -0
- package/_dist/form/UploadBase.js +84 -0
- package/_dist/grid/index.js +96 -0
- package/{dist/esm → _dist}/icon/icons.js +1 -1
- package/{dist/esm → _dist}/icon/index.d.ts +1 -1
- package/_dist/icon/index.js +34 -0
- package/_dist/menu/index.js +50 -0
- package/_dist/modal/index.js +64 -0
- package/{dist/esm → _dist}/popover/index.js +100 -100
- package/_dist/tooltip/index.js +202 -0
- package/_lib/baseFunctions.ts +94 -0
- package/_lib/inputMask.ts +257 -0
- package/_lib/listFunctions.ts +106 -0
- package/_lib/storage/cookies.ts +39 -0
- package/_lib/storage/encData.ts +41 -0
- package/_lib/storage/localStorage.ts +67 -0
- package/_lib/storage/sessionStorage.ts +67 -0
- package/_lib/useInterval.ts +30 -0
- package/alert/index.module.css +119 -0
- package/alert/index.tsx +131 -0
- package/box/Box.module.css +153 -0
- package/box/Box.tsx +33 -0
- package/box/BoxContent.tsx +18 -0
- package/box/BoxFooter.tsx +25 -0
- package/box/BoxHeader.tsx +46 -0
- package/box/index.ts +10 -0
- package/countDown/index.tsx +116 -0
- package/dateTime/index.ts +79 -0
- package/form/Button.tsx +143 -0
- package/form/Checkbox.tsx +48 -0
- package/form/Dialog.tsx +109 -0
- package/form/Form.tsx +19 -0
- package/form/FormOlustur.tsx +105 -0
- package/form/Input.tsx +364 -0
- package/form/Label.tsx +20 -0
- package/form/SearchableInput.tsx +406 -0
- package/form/UploadBase.tsx +133 -0
- package/form/index.ts +10 -0
- package/form/styles/Button.module.css +145 -0
- package/form/styles/Input.module.css +221 -0
- package/form/styles/Label.module.css +31 -0
- package/form/styles/SearchableInput.module.css +80 -0
- package/global.d.ts +9 -0
- package/grid/index.module.css +805 -0
- package/grid/index.tsx +171 -0
- package/icon/icons.tsx +33 -0
- package/icon/index.tsx +95 -0
- package/icon/mui.tsx +5932 -0
- package/index.ts +21 -0
- package/menu/index.module.css +92 -0
- package/menu/index.tsx +143 -0
- package/modal/index.module.css +77 -0
- package/modal/index.tsx +106 -0
- package/npm_recovery_codes.txt +5 -0
- package/package.json +18 -11
- package/popover/index.module.css +89 -0
- package/popover/index.tsx +392 -0
- package/tooltip/index.tsx +216 -0
- package/tsconfig.json +24 -0
- 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.js +0 -43
- package/dist/esm/box/Box.js +0 -15
- package/dist/esm/box/BoxContent.js +0 -7
- package/dist/esm/box/BoxFooter.js +0 -8
- package/dist/esm/box/BoxHeader.js +0 -9
- package/dist/esm/countDown/index.js +0 -97
- package/dist/esm/form/Button.js +0 -76
- package/dist/esm/form/Checkbox.js +0 -23
- package/dist/esm/form/Dialog.js +0 -40
- package/dist/esm/form/Form.js +0 -12
- package/dist/esm/form/FormOlustur.js +0 -52
- package/dist/esm/form/Label.js +0 -9
- package/dist/esm/form/SearchableInput.js +0 -272
- package/dist/esm/form/UploadBase.js +0 -86
- package/dist/esm/grid/index.js +0 -97
- package/dist/esm/icon/index.js +0 -26
- package/dist/esm/menu/index.js +0 -52
- package/dist/esm/modal/index.js +0 -66
- package/dist/esm/tooltip/index.js +0 -119
- /package/{dist/esm → _dist}/_lib/inputMask.d.ts +0 -0
- /package/{dist/esm → _dist}/_lib/listFunctions.d.ts +0 -0
- /package/{dist/esm → _dist}/_lib/storage/encData.d.ts +0 -0
- /package/{dist/esm → _dist}/_lib/storage/localStorage.d.ts +0 -0
- /package/{dist/esm → _dist}/_lib/storage/sessionStorage.d.ts +0 -0
- /package/{dist/esm → _dist}/_lib/useInterval.d.ts +0 -0
- /package/{dist/esm → _dist}/alert/index.d.ts +0 -0
- /package/{dist/esm → _dist}/alert/index.module.css +0 -0
- /package/{dist/esm → _dist}/box/Box.d.ts +0 -0
- /package/{dist/esm → _dist}/box/Box.module.css +0 -0
- /package/{dist/esm → _dist}/box/BoxContent.d.ts +0 -0
- /package/{dist/esm → _dist}/box/BoxFooter.d.ts +0 -0
- /package/{dist/esm → _dist}/box/BoxHeader.d.ts +0 -0
- /package/{dist/esm → _dist}/box/index.d.ts +0 -0
- /package/{dist/esm → _dist}/box/index.js +0 -0
- /package/{dist/esm → _dist}/countDown/index.d.ts +0 -0
- /package/{dist/esm → _dist}/dateTime/index.d.ts +0 -0
- /package/{dist/esm → _dist}/form/Button.d.ts +0 -0
- /package/{dist/esm → _dist}/form/Checkbox.d.ts +0 -0
- /package/{dist/esm → _dist}/form/Dialog.d.ts +0 -0
- /package/{dist/esm → _dist}/form/Form.d.ts +0 -0
- /package/{dist/esm → _dist}/form/FormOlustur.d.ts +0 -0
- /package/{dist/esm → _dist}/form/Input.d.ts +0 -0
- /package/{dist/esm → _dist}/form/Label.d.ts +0 -0
- /package/{dist/esm → _dist}/form/UploadBase.d.ts +0 -0
- /package/{dist/esm → _dist}/form/index.d.ts +0 -0
- /package/{dist/esm → _dist}/form/index.js +0 -0
- /package/{dist/esm → _dist}/form/styles/Button.module.css +0 -0
- /package/{dist/esm → _dist}/form/styles/Input.module.css +0 -0
- /package/{dist/esm → _dist}/form/styles/Label.module.css +0 -0
- /package/{dist/esm → _dist}/form/styles/SearchableInput.module.css +0 -0
- /package/{dist/esm → _dist}/grid/index.d.ts +0 -0
- /package/{dist/esm → _dist}/grid/index.module.css +0 -0
- /package/{dist/esm → _dist}/icon/icons.d.ts +0 -0
- /package/{dist/esm → _dist}/icon/mui.d.ts +0 -0
- /package/{dist/esm → _dist}/icon/mui.js +0 -0
- /package/{dist/esm → _dist}/index.d.ts +0 -0
- /package/{dist/esm → _dist}/index.js +0 -0
- /package/{dist/esm → _dist}/menu/index.d.ts +0 -0
- /package/{dist/esm → _dist}/menu/index.module.css +0 -0
- /package/{dist/esm → _dist}/modal/index.d.ts +0 -0
- /package/{dist/esm → _dist}/modal/index.module.css +0 -0
- /package/{dist/esm → _dist}/popover/index.d.ts +0 -0
- /package/{dist/esm → _dist}/popover/index.module.css +0 -0
- /package/{dist/esm → _dist}/tooltip/index.d.ts +0 -0
|
@@ -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,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/grid/index.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { __assign, __rest, __spreadArray } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import styles from './index.module.css';
|
|
5
|
-
export var Row = function (_a) {
|
|
6
|
-
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, style = _a.style, _c = _a.flexDirection, flexDirection = _c === void 0 ? 'row' : _c, _d = _a.flexWrap, flexWrap = _d === void 0 ? 'wrap' : _d, _e = _a.justifyContent, justifyContent = _e === void 0 ? 'flex-start' : _e, _f = _a.alignContent, alignContent = _f === void 0 ? 'center' : _f, _g = _a.alignItems, alignItems = _g === void 0 ? 'center' : _g, _h = _a.rowSpacing, rowSpacing = _h === void 0 ? 2 : _h, _j = _a.colSpacing, colSpacing = _j === void 0 ? 2 : _j, other = __rest(_a, ["children", "className", "style", "flexDirection", "flexWrap", "justifyContent", "alignContent", "alignItems", "rowSpacing", "colSpacing"]);
|
|
7
|
-
var classes = [
|
|
8
|
-
styles.row,
|
|
9
|
-
rowSpacing !== undefined && styles["row-spacing-".concat(rowSpacing)],
|
|
10
|
-
colSpacing !== undefined && styles["col-spacing-".concat(colSpacing)],
|
|
11
|
-
flexDirection !== 'row' && styles["flex-".concat(flexDirection.replace('-', '-'))],
|
|
12
|
-
flexWrap !== 'wrap' && styles["flex-".concat(flexWrap)],
|
|
13
|
-
justifyContent !== 'flex-start' && styles["justify-".concat(justifyContent.replace('flex-', '').replace('space-', ''))],
|
|
14
|
-
alignItems !== 'center' && styles["align-items-".concat(alignItems.replace('flex-', ''))],
|
|
15
|
-
alignContent !== 'center' && styles["align-content-".concat(alignContent.replace('flex-', ''))],
|
|
16
|
-
className
|
|
17
|
-
]
|
|
18
|
-
.filter(Boolean)
|
|
19
|
-
.join(' ');
|
|
20
|
-
return (_jsx("div", __assign({ className: classes, style: style }, other, { children: children })));
|
|
21
|
-
};
|
|
22
|
-
export var Col = function (_a) {
|
|
23
|
-
// Cascading logic - aynı sizin component'inizdeki gibi
|
|
24
|
-
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, style = _a.style, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, xxl = _a.xxl, other = __rest(_a, ["children", "className", "style", "xs", "sm", "md", "lg", "xl", "xxl"]);
|
|
25
|
-
var classes = [
|
|
26
|
-
styles.col,
|
|
27
|
-
// Sadece belirtilen breakpoint'ler için class ekle
|
|
28
|
-
xs && styles["col-xs-".concat(xs)],
|
|
29
|
-
sm && styles["col-sm-".concat(sm)],
|
|
30
|
-
md && styles["col-md-".concat(md)],
|
|
31
|
-
lg && styles["col-lg-".concat(lg)],
|
|
32
|
-
xl && styles["col-xl-".concat(xl)],
|
|
33
|
-
xxl && styles["col-xxl-".concat(xxl)],
|
|
34
|
-
className
|
|
35
|
-
]
|
|
36
|
-
.filter(Boolean)
|
|
37
|
-
.join(' ');
|
|
38
|
-
return (_jsx("div", __assign({ className: classes, style: style }, other, { children: children })));
|
|
39
|
-
};
|
|
40
|
-
export var Hidden = function (_a) {
|
|
41
|
-
var children = _a.children, hidden = _a.hidden, onlyHidden = _a.onlyHidden, other = __rest(_a, ["children", "hidden", "onlyHidden"]);
|
|
42
|
-
var existingClassName = children.props.className || '';
|
|
43
|
-
var hiddenClasses = [];
|
|
44
|
-
if (onlyHidden) {
|
|
45
|
-
onlyHidden.forEach(function (breakpoint) {
|
|
46
|
-
hiddenClasses.push(styles["hidden-".concat(breakpoint)]);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
else if (hidden) {
|
|
50
|
-
// Orijinal mantık: seçilen breakpoint ve altındaki tüm breakpoint'ler gizlenir
|
|
51
|
-
var breakpoints = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
52
|
-
var targetIndex = breakpoints.indexOf(hidden);
|
|
53
|
-
if (targetIndex !== -1) {
|
|
54
|
-
for (var i = 0; i <= targetIndex; i++) {
|
|
55
|
-
hiddenClasses.push(styles["hidden-".concat(breakpoints[i])]);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
var newClassName = __spreadArray([existingClassName], hiddenClasses, true).filter(Boolean).join(' ');
|
|
60
|
-
return React.cloneElement(children, __assign({ className: newClassName }, other));
|
|
61
|
-
};
|
|
62
|
-
export var DevelopGridComponent = function () {
|
|
63
|
-
var _a = useState(''), currentBreakpoint = _a[0], setCurrentBreakpoint = _a[1];
|
|
64
|
-
// Breakpoint detector
|
|
65
|
-
React.useEffect(function () {
|
|
66
|
-
var updateBreakpoint = function () {
|
|
67
|
-
var width = window.innerWidth;
|
|
68
|
-
var breakpoint = '';
|
|
69
|
-
if (width <= 576)
|
|
70
|
-
breakpoint = 'XS (≤576px)';
|
|
71
|
-
else if (width <= 768)
|
|
72
|
-
breakpoint = 'SM (577-768px)';
|
|
73
|
-
else if (width <= 992)
|
|
74
|
-
breakpoint = 'MD (769-992px)';
|
|
75
|
-
else if (width <= 1200)
|
|
76
|
-
breakpoint = 'LG (993-1200px)';
|
|
77
|
-
else if (width <= 1400)
|
|
78
|
-
breakpoint = 'XL (1201-1400px)';
|
|
79
|
-
else
|
|
80
|
-
breakpoint = 'XXL (≥1401px)';
|
|
81
|
-
setCurrentBreakpoint(breakpoint);
|
|
82
|
-
};
|
|
83
|
-
updateBreakpoint();
|
|
84
|
-
window.addEventListener('resize', updateBreakpoint);
|
|
85
|
-
return function () { return window.removeEventListener('resize', updateBreakpoint); };
|
|
86
|
-
}, []);
|
|
87
|
-
return (_jsxs("div", { style: {
|
|
88
|
-
position: 'fixed',
|
|
89
|
-
bottom: '10px',
|
|
90
|
-
right: '10px',
|
|
91
|
-
background: '#333',
|
|
92
|
-
color: 'white',
|
|
93
|
-
padding: '10px',
|
|
94
|
-
borderRadius: '4px',
|
|
95
|
-
zIndex: 9999999
|
|
96
|
-
}, children: ["Current: ", currentBreakpoint] }));
|
|
97
|
-
};
|
package/dist/esm/icon/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { iconMap } from './icons';
|
|
4
|
-
export var iconList = Object.keys(iconMap);
|
|
5
|
-
var defaultIconStyle = {
|
|
6
|
-
userSelect: 'none',
|
|
7
|
-
width: '1em',
|
|
8
|
-
height: '1em',
|
|
9
|
-
// display: 'inline-block',
|
|
10
|
-
verticalAlign: 'middle',
|
|
11
|
-
flexShrink: 0,
|
|
12
|
-
display: 'flex',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
justifyContent: 'center'
|
|
15
|
-
};
|
|
16
|
-
export var Icon = function (_a) {
|
|
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"]);
|
|
18
|
-
if (iconMui) {
|
|
19
|
-
return (_jsx("span", __assign({ className: "material-icons ".concat(className || ''), style: __assign(__assign(__assign({}, defaultIconStyle), style), { fontSize: fontSize || '1.3rem', color: color || 'inherit' }), "aria-hidden": "true" }, other, { children: iconMui })));
|
|
20
|
-
}
|
|
21
|
-
var iconComponent = name ? iconMap[name] : customIcon;
|
|
22
|
-
if (!iconComponent) {
|
|
23
|
-
return _jsx("span", { children: "\u26A0\uFE0F" });
|
|
24
|
-
}
|
|
25
|
-
return (_jsx("span", __assign({ className: className, style: __assign(__assign(__assign({}, defaultIconStyle), style), { fontSize: fontSize || '1.5rem', color: color || 'inherit' }) }, 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
|
-
};
|
package/dist/esm/menu/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* @author : izzetseydaoglu
|
|
5
|
-
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
6
|
-
* @version : 2026-02-07 19:31:01
|
|
7
|
-
*/
|
|
8
|
-
import React, { memo, useMemo } from 'react';
|
|
9
|
-
import { Dialog } from '../form';
|
|
10
|
-
import { Popover } from '../popover';
|
|
11
|
-
import Link from 'next/link';
|
|
12
|
-
import styles from './index.module.css';
|
|
13
|
-
export var Menu = memo(function MemoFunction(_a) {
|
|
14
|
-
var menu = _a.menu, className = _a.className, style = _a.style, _b = _a.withIcon, withIcon = _b === void 0 ? 'auto' : _b;
|
|
15
|
-
var withIconComponent = useMemo(function () {
|
|
16
|
-
if (withIcon === true)
|
|
17
|
-
return true;
|
|
18
|
-
if (withIcon === false)
|
|
19
|
-
return false;
|
|
20
|
-
return Object.values(menu).some(function (item) { return 'icon' in item && !!item.icon; });
|
|
21
|
-
}, [menu, withIcon]);
|
|
22
|
-
var withRightComponent = useMemo(function () {
|
|
23
|
-
return Object.values(menu).some(function (item) { return 'rightComponent' in item && !!item.rightComponent; });
|
|
24
|
-
}, [menu]);
|
|
25
|
-
var handleClick = function (item, e) {
|
|
26
|
-
if (!item.onClick)
|
|
27
|
-
return;
|
|
28
|
-
if (item.dialog) {
|
|
29
|
-
Dialog(__assign({}, item.dialog)).then(function (result) {
|
|
30
|
-
if (result && item.onClick) {
|
|
31
|
-
item.onClick(e);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
item.onClick(e);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return (_jsx("ul", { className: "smenu ".concat(styles.ul, " ").concat(className || ''), style: style, children: Object.values(menu).map(function (item, key) {
|
|
40
|
-
var _a = item, fullComponent = _a.fullComponent, icon = _a.icon, title = _a.title, rightComponent = _a.rightComponent, seperator = _a.seperator, href = _a.href, style = _a.style, itemProps = _a.itemProps, type = _a.type, items = _a.items, menuProps = _a.menuProps, subMenuPopoverProps = _a.subMenuPopoverProps, other = __rest(_a, ["fullComponent", "icon", "title", "rightComponent", "seperator", "href", "style", "itemProps", "type", "items", "menuProps", "subMenuPopoverProps"]);
|
|
41
|
-
var hasSubmenu = type === 'submenu' && Array.isArray(items) && items.length > 0;
|
|
42
|
-
if (fullComponent)
|
|
43
|
-
return React.cloneElement(fullComponent, { key: key });
|
|
44
|
-
if (seperator)
|
|
45
|
-
return _jsx("li", __assign({ className: styles.seperator, style: style }, itemProps, other), key);
|
|
46
|
-
var 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 })] }));
|
|
47
|
-
if (hasSubmenu) {
|
|
48
|
-
return (_jsx(Popover, __assign({ component: _jsx("li", __assign({ style: style }, itemProps, other, { children: Component })), position: "right-top" }, (subMenuPopoverProps || {}), { children: _jsx(Menu, __assign({ menu: items }, (menuProps || {}))) }), key));
|
|
49
|
-
}
|
|
50
|
-
return (_jsx("li", __assign({ style: style, onClick: function (e) { return handleClick(item, e); } }, itemProps, other, { children: href ? _jsx(Link, { href: href, children: Component }) : Component }), key));
|
|
51
|
-
}) }));
|
|
52
|
-
});
|
package/dist/esm/modal/index.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* Copyright (c) 2023
|
|
5
|
-
* @author: izzetseydaoglu
|
|
6
|
-
* @last-modified: 9.02.2024 06:07
|
|
7
|
-
*/
|
|
8
|
-
import { memo, useEffect, useRef, useState } from "react";
|
|
9
|
-
import ReactDOM from "react-dom";
|
|
10
|
-
import styles from "./index.module.css";
|
|
11
|
-
export var Modal = memo(function MemoFunction(_a) {
|
|
12
|
-
var _b = _a.refModal, refModal = _b === void 0 ? null : _b, children = _a.children, _c = _a.open, open = _c === void 0 ? false : _c, close = _a.close, _d = _a.keepMounted, keepMounted = _d === void 0 ? false : _d, _e = _a.fullScreen, fullScreen = _e === void 0 ? false : _e, _f = _a.hideBackdrop, hideBackdrop = _f === void 0 ? true : _f, _g = _a.hideEsc, hideEsc = _g === void 0 ? false : _g, _h = _a.hideCloseButton, hideCloseButton = _h === void 0 ? false : _h, modalStyle = _a.modalStyle, backdropStyle = _a.backdropStyle, _j = _a.vertialAlign, vertialAlign = _j === void 0 ? "center" : _j, _k = _a.horizontalAlign, horizontalAlign = _k === void 0 ? "center" : _k;
|
|
13
|
-
var _l = useState(null), modalDiv = _l[0], setModalDiv = _l[1];
|
|
14
|
-
var ref = useRef(null);
|
|
15
|
-
useEffect(function () {
|
|
16
|
-
if (refModal)
|
|
17
|
-
refModal.current = ref.current;
|
|
18
|
-
}, [ref.current]);
|
|
19
|
-
var onClose = function () {
|
|
20
|
-
if (close)
|
|
21
|
-
close();
|
|
22
|
-
};
|
|
23
|
-
var checkHideBackDrop = function (e) {
|
|
24
|
-
if (open && ref.current && !ref.current.contains(e.target))
|
|
25
|
-
onClose();
|
|
26
|
-
};
|
|
27
|
-
var checkESC = function (e) {
|
|
28
|
-
if (e.keyCode === 27 || e.key === "Escape" || e.code === "Escape")
|
|
29
|
-
onClose();
|
|
30
|
-
};
|
|
31
|
-
useEffect(function () {
|
|
32
|
-
if (open) {
|
|
33
|
-
if (hideBackdrop)
|
|
34
|
-
window.addEventListener("mousedown", checkHideBackDrop);
|
|
35
|
-
if (hideEsc)
|
|
36
|
-
window.addEventListener("keydown", checkESC);
|
|
37
|
-
}
|
|
38
|
-
return function () {
|
|
39
|
-
if (hideBackdrop)
|
|
40
|
-
window.removeEventListener("mousedown", checkHideBackDrop);
|
|
41
|
-
if (hideEsc)
|
|
42
|
-
window.removeEventListener("keydown", checkESC);
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
useEffect(function () {
|
|
46
|
-
if (!modalDiv) {
|
|
47
|
-
var modalDivCheck = document.getElementById("smodal");
|
|
48
|
-
if (modalDivCheck) {
|
|
49
|
-
setModalDiv(modalDivCheck);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
var div = document.createElement("div");
|
|
53
|
-
div.setAttribute("id", "smodal");
|
|
54
|
-
document.body.appendChild(div);
|
|
55
|
-
setModalDiv(div);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return function () {
|
|
59
|
-
onClose();
|
|
60
|
-
};
|
|
61
|
-
}, []);
|
|
62
|
-
if ((!keepMounted && !open) || typeof window === "undefined")
|
|
63
|
-
return null;
|
|
64
|
-
var Component = (_jsx("div", { className: "".concat(styles.backdrop, " ").concat(open ? styles.backdrop_open : ""), style: __assign({ alignItems: vertialAlign, justifyContent: horizontalAlign }, backdropStyle), children: _jsxs("div", { ref: ref, className: "smodal ".concat(styles.modal, " ").concat(fullScreen ? styles.fullscreen : ""), style: modalStyle, children: [!hideCloseButton && (_jsx("div", { className: "close ".concat(styles.close_fixed), children: _jsx("div", { className: styles.close, onClick: onClose, children: "\u2715" }) })), children] }) }));
|
|
65
|
-
return modalDiv ? ReactDOM.createPortal(Component, modalDiv) : null;
|
|
66
|
-
});
|