@sydsoft/base 1.52.0 → 1.53.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/{esm/_lib → _lib}/baseFunctions.js +24 -11
- package/_dist/{esm/_lib → _lib}/inputMask.js +7 -3
- package/_dist/{esm/_lib → _lib}/listFunctions.js +7 -2
- package/_dist/_lib/storage/cookies.js +41 -0
- package/_dist/{esm/_lib → _lib}/storage/encData.js +10 -5
- package/_dist/_lib/storage/localStorage.js +78 -0
- package/_dist/_lib/storage/sessionStorage.js +78 -0
- package/_dist/{esm/_lib → _lib}/useInterval.js +8 -5
- package/_dist/{esm/alert → alert}/index.js +22 -13
- package/_dist/box/Box.js +19 -0
- package/_dist/box/BoxContent.js +11 -0
- package/_dist/box/BoxFooter.js +11 -0
- package/_dist/box/BoxHeader.js +12 -0
- package/_dist/box/index.js +12 -0
- package/_dist/{esm/countDown → countDown}/index.js +17 -12
- package/_dist/{esm/dateTime → dateTime}/index.js +3 -1
- package/_dist/form/Button.js +79 -0
- package/_dist/form/Checkbox.js +28 -0
- package/_dist/form/Dialog.js +44 -0
- package/_dist/form/Form.js +15 -0
- package/_dist/{esm/form → form}/FormOlustur.js +22 -19
- package/_dist/{esm/form → form}/Input.js +49 -45
- package/_dist/form/Label.js +12 -0
- package/_dist/{esm/form → form}/SearchableInput.js +48 -45
- package/_dist/{esm/form → form}/UploadBase.js +21 -16
- package/_dist/form/index.js +12 -0
- package/_dist/grid/index.js +104 -0
- package/_dist/icon/icons.js +26 -0
- package/_dist/icon/index.js +30 -0
- package/_dist/icon/mui.js +2 -0
- package/_dist/index.js +22 -0
- package/_dist/menu/index.js +55 -0
- package/_dist/{esm/modal → modal}/index.js +16 -13
- package/_dist/{esm/popover → popover}/index.js +39 -36
- package/_dist/{esm/tooltip → tooltip}/index.js +9 -6
- package/package.json +6 -7
- package/_dist/esm/_lib/storage/cookies.js +0 -34
- package/_dist/esm/_lib/storage/localStorage.js +0 -69
- package/_dist/esm/_lib/storage/sessionStorage.js +0 -69
- 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/box/index.js +0 -9
- 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/Label.js +0 -9
- package/_dist/esm/form/index.js +0 -9
- package/_dist/esm/grid/index.js +0 -97
- package/_dist/esm/icon/icons.js +0 -23
- package/_dist/esm/icon/index.js +0 -26
- package/_dist/esm/icon/mui.js +0 -1
- package/_dist/esm/index.js +0 -19
- package/_dist/esm/menu/index.js +0 -52
- /package/_dist/{esm/_lib → _lib}/baseFunctions.d.ts +0 -0
- /package/_dist/{esm/_lib → _lib}/inputMask.d.ts +0 -0
- /package/_dist/{esm/_lib → _lib}/listFunctions.d.ts +0 -0
- /package/_dist/{esm/_lib → _lib}/storage/cookies.d.ts +0 -0
- /package/_dist/{esm/_lib → _lib}/storage/encData.d.ts +0 -0
- /package/_dist/{esm/_lib → _lib}/storage/localStorage.d.ts +0 -0
- /package/_dist/{esm/_lib → _lib}/storage/sessionStorage.d.ts +0 -0
- /package/_dist/{esm/_lib → _lib}/useInterval.d.ts +0 -0
- /package/_dist/{esm/alert → alert}/index.d.ts +0 -0
- /package/_dist/{esm/alert → alert}/index.module.css +0 -0
- /package/_dist/{esm/box → box}/Box.d.ts +0 -0
- /package/_dist/{esm/box → box}/Box.module.css +0 -0
- /package/_dist/{esm/box → box}/BoxContent.d.ts +0 -0
- /package/_dist/{esm/box → box}/BoxFooter.d.ts +0 -0
- /package/_dist/{esm/box → box}/BoxHeader.d.ts +0 -0
- /package/_dist/{esm/box → box}/index.d.ts +0 -0
- /package/_dist/{esm/countDown → countDown}/index.d.ts +0 -0
- /package/_dist/{esm/dateTime → dateTime}/index.d.ts +0 -0
- /package/_dist/{esm/form → form}/Button.d.ts +0 -0
- /package/_dist/{esm/form → form}/Checkbox.d.ts +0 -0
- /package/_dist/{esm/form → form}/Dialog.d.ts +0 -0
- /package/_dist/{esm/form → form}/Form.d.ts +0 -0
- /package/_dist/{esm/form → form}/FormOlustur.d.ts +0 -0
- /package/_dist/{esm/form → form}/Input.d.ts +0 -0
- /package/_dist/{esm/form → form}/Label.d.ts +0 -0
- /package/_dist/{esm/form → form}/SearchableInput.d.ts +0 -0
- /package/_dist/{esm/form → form}/UploadBase.d.ts +0 -0
- /package/_dist/{esm/form → form}/index.d.ts +0 -0
- /package/_dist/{esm/form → form}/styles/Button.module.css +0 -0
- /package/_dist/{esm/form → form}/styles/Input.module.css +0 -0
- /package/_dist/{esm/form → form}/styles/Label.module.css +0 -0
- /package/_dist/{esm/form → form}/styles/SearchableInput.module.css +0 -0
- /package/_dist/{esm/grid → grid}/index.d.ts +0 -0
- /package/_dist/{esm/grid → grid}/index.module.css +0 -0
- /package/_dist/{esm/icon → icon}/icons.d.ts +0 -0
- /package/_dist/{esm/icon → icon}/index.d.ts +0 -0
- /package/_dist/{esm/icon → icon}/mui.d.ts +0 -0
- /package/_dist/{esm/index.d.ts → index.d.ts} +0 -0
- /package/_dist/{esm/menu → menu}/index.d.ts +0 -0
- /package/_dist/{esm/menu → menu}/index.module.css +0 -0
- /package/_dist/{esm/modal → modal}/index.d.ts +0 -0
- /package/_dist/{esm/modal → modal}/index.module.css +0 -0
- /package/_dist/{esm/popover → popover}/index.d.ts +0 -0
- /package/_dist/{esm/popover → popover}/index.module.css +0 -0
- /package/_dist/{esm/tooltip → tooltip}/index.d.ts +0 -0
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchableInput = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var index_1 = require("./index");
|
|
7
|
+
var baseFunctions_1 = require("../_lib/baseFunctions");
|
|
8
|
+
var react_1 = require("react");
|
|
9
|
+
var listFunctions_1 = require("../_lib/listFunctions");
|
|
10
|
+
var icon_1 = require("../icon");
|
|
11
|
+
var SearchableInput_module_css_1 = tslib_1.__importDefault(require("./styles/SearchableInput.module.css"));
|
|
12
|
+
exports.SearchableInput = (0, react_1.forwardRef)(function (_a, ref) {
|
|
13
|
+
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 = tslib_1.__rest(_a, ["autoCompleteList", "isDataFromApi", "name", "value", "parentInputValue", "disabled", "itemComponent", "valueKey", "labelKey", "onSelect", "onChange", "onText", "onLoad", "style", "listPositionRelative", "loadingMessage", "notFoundMessage", "placeholder", "endAdornment", "ilkSec", "newCreate", "inputRef"]);
|
|
14
|
+
var refMain = (0, react_1.useRef)(null);
|
|
15
|
+
var refInput = (0, react_1.useRef)(null);
|
|
16
|
+
var refList = (0, react_1.useRef)(null);
|
|
17
|
+
var _k = (0, react_1.useState)(autoCompleteList !== null && autoCompleteList !== void 0 ? autoCompleteList : []), data = _k[0], setData = _k[1];
|
|
18
|
+
var _l = (0, react_1.useState)(value !== null && value !== void 0 ? value : undefined), selectedValue = _l[0], setSelectedValue = _l[1];
|
|
19
|
+
var _m = (0, react_1.useState)(parentInputValue !== null && parentInputValue !== void 0 ? parentInputValue : undefined), parentValue = _m[0], setParentValue = _m[1];
|
|
20
|
+
var _o = (0, react_1.useState)(''), text = _o[0], setText = _o[1]; //Inputta görünen
|
|
21
|
+
var _p = (0, react_1.useState)(''), filter = _p[0], setFilter = _p[1]; // Filtrelemeye tabi tutulan
|
|
22
|
+
var _q = (0, react_1.useState)({ created: false }), newItemCreate = _q[0], setNewItemCreate = _q[1];
|
|
23
|
+
var _r = (0, react_1.useState)(false), open = _r[0], setOpen = _r[1];
|
|
24
|
+
var _s = (0, react_1.useState)(isDataFromApi && (!autoCompleteList || (autoCompleteList === null || autoCompleteList === void 0 ? void 0 : autoCompleteList.length) == 0)), loading = _s[0], setLoading = _s[1];
|
|
25
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
23
26
|
setAutoCompleteList: function (list, value, callback) {
|
|
24
27
|
if (value === void 0) { value = undefined; }
|
|
25
28
|
if (autoCompleteList && (autoCompleteList === null || autoCompleteList === void 0 ? void 0 : autoCompleteList.length) > 0) {
|
|
@@ -51,12 +54,12 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
51
54
|
},
|
|
52
55
|
setLoading: function (value) { return setLoading(value); }
|
|
53
56
|
}); }, [autoCompleteList, data, value]);
|
|
54
|
-
useEffect(function () {
|
|
57
|
+
(0, react_1.useEffect)(function () {
|
|
55
58
|
if (inputRef)
|
|
56
59
|
inputRef.current = refInput.current;
|
|
57
60
|
}, [refInput.current]);
|
|
58
|
-
useEffect(function () { return onLoad && onLoad(value); }, []);
|
|
59
|
-
useEffect(function () {
|
|
61
|
+
(0, react_1.useEffect)(function () { return onLoad && onLoad(value); }, []);
|
|
62
|
+
(0, react_1.useEffect)(function () {
|
|
60
63
|
if (autoCompleteList && Array.isArray(autoCompleteList)) {
|
|
61
64
|
if (autoCompleteList.length > 0) {
|
|
62
65
|
// Sadece gerçekten farklıysa set et
|
|
@@ -74,7 +77,7 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
}, [autoCompleteList]);
|
|
77
|
-
useEffect(function () {
|
|
80
|
+
(0, react_1.useEffect)(function () {
|
|
78
81
|
// isDev && console.log('data =>', name, data, 'selectedValue =>', selectedValue, 'value =>', value);
|
|
79
82
|
if (!Array.isArray(data)) {
|
|
80
83
|
setData([]);
|
|
@@ -91,21 +94,21 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
91
94
|
}
|
|
92
95
|
}, [data]);
|
|
93
96
|
// Seçim değişikliğinde parent'ı bilgilendir
|
|
94
|
-
useEffect(function () {
|
|
97
|
+
(0, react_1.useEffect)(function () {
|
|
95
98
|
// isDev && console.log('selectedValue =>', name, selectedValue, 'value =>', value);
|
|
96
99
|
if ((value === null || value === void 0 ? void 0 : value.toString()) != (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.toString())) {
|
|
97
100
|
checkByValue(value, open);
|
|
98
101
|
// isDev && console.log('value Kontrol ediliyor', value, selectedValue);
|
|
99
102
|
}
|
|
100
103
|
}, [value]);
|
|
101
|
-
useEffect(function () {
|
|
104
|
+
(0, react_1.useEffect)(function () {
|
|
102
105
|
if (parentInputValue !== parentValue) {
|
|
103
106
|
setParentValue(parentInputValue);
|
|
104
107
|
clear(false);
|
|
105
108
|
// isDev && console.log(name, "parentInputValueDeğişti =>", parentInputValue);
|
|
106
109
|
}
|
|
107
110
|
}, [parentInputValue]);
|
|
108
|
-
useEffect(function () {
|
|
111
|
+
(0, react_1.useEffect)(function () {
|
|
109
112
|
var checkHideBackDrop = function (e) {
|
|
110
113
|
if (open && refMain.current && !refMain.current.contains(e.target)) {
|
|
111
114
|
checkByInput();
|
|
@@ -119,7 +122,7 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
119
122
|
if (refMain.current)
|
|
120
123
|
refMain.current.addEventListener('keydown', checkESC);
|
|
121
124
|
if (open) {
|
|
122
|
-
setScrollListPosition(refList);
|
|
125
|
+
(0, listFunctions_1.setScrollListPosition)(refList);
|
|
123
126
|
if (!listPositionRelative) {
|
|
124
127
|
window.addEventListener('scroll', handleUpdatePosition, true);
|
|
125
128
|
window.addEventListener('resize', handleUpdatePosition);
|
|
@@ -133,8 +136,8 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
133
136
|
window.removeEventListener('resize', handleUpdatePosition);
|
|
134
137
|
};
|
|
135
138
|
}, [open]);
|
|
136
|
-
useLayoutEffect(function () { return handleUpdatePosition(); }, [open]);
|
|
137
|
-
var setValue = useCallback(function (item, openList) {
|
|
139
|
+
(0, react_1.useLayoutEffect)(function () { return handleUpdatePosition(); }, [open]);
|
|
140
|
+
var setValue = (0, react_1.useCallback)(function (item, openList) {
|
|
138
141
|
var _a, _b;
|
|
139
142
|
var newValue = (_a = item === null || item === void 0 ? void 0 : item[valueKey]) !== null && _a !== void 0 ? _a : '';
|
|
140
143
|
var newLabel = (_b = item === null || item === void 0 ? void 0 : item[labelKey]) !== null && _b !== void 0 ? _b : '';
|
|
@@ -148,26 +151,26 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
148
151
|
onChange && sendChange(newValue);
|
|
149
152
|
onSelect && onSelect(item);
|
|
150
153
|
}, [onChange, onSelect, name, selectedValue, valueKey, labelKey]);
|
|
151
|
-
var textInputOnChange = useCallback(function (e) {
|
|
154
|
+
var textInputOnChange = (0, react_1.useCallback)(function (e) {
|
|
152
155
|
setSelectedValue(undefined);
|
|
153
156
|
setText(e.target.value);
|
|
154
157
|
setFilter(e.target.value.trim());
|
|
155
158
|
setOpen(true);
|
|
156
159
|
onText && onText(e.target.value);
|
|
157
160
|
}, [setValue, onText]);
|
|
158
|
-
var checkByValue = useCallback(function (value, openList, list) {
|
|
161
|
+
var checkByValue = (0, react_1.useCallback)(function (value, openList, list) {
|
|
159
162
|
if (openList === void 0) { openList = false; }
|
|
160
163
|
if (list === void 0) { list = []; }
|
|
161
164
|
var targetList = list.length > 0 ? list : data;
|
|
162
|
-
var find = Object.values(targetList).find(function (item) { return convertLowerCase(item[valueKey]) === convertLowerCase(value); });
|
|
165
|
+
var find = Object.values(targetList).find(function (item) { return (0, baseFunctions_1.convertLowerCase)(item[valueKey]) === (0, baseFunctions_1.convertLowerCase)(value); });
|
|
163
166
|
if (!find && newCreate && newItemCreate.create) {
|
|
164
167
|
find = newItemCreate;
|
|
165
168
|
}
|
|
166
169
|
// isDev && console.log('find', find, 'value', value, data);
|
|
167
170
|
setValue(find, openList);
|
|
168
171
|
}, [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); });
|
|
172
|
+
var checkByInput = (0, react_1.useCallback)(function () {
|
|
173
|
+
var findByLabel = data.find(function (item) { var _a; return (0, baseFunctions_1.convertLowerCase)(item[labelKey]) === (0, baseFunctions_1.convertLowerCase)((_a = refInput.current) === null || _a === void 0 ? void 0 : _a.value); });
|
|
171
174
|
if (findByLabel && value == findByLabel[valueKey]) {
|
|
172
175
|
setOpen(false);
|
|
173
176
|
return;
|
|
@@ -180,7 +183,7 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
180
183
|
onText('');
|
|
181
184
|
}
|
|
182
185
|
}, [data, labelKey, value, valueKey, isDataFromApi, onText, setValue, refInput.current]);
|
|
183
|
-
var clear = useCallback(function (openList, focusInput) {
|
|
186
|
+
var clear = (0, react_1.useCallback)(function (openList, focusInput) {
|
|
184
187
|
var _a;
|
|
185
188
|
if (openList === void 0) { openList = true; }
|
|
186
189
|
if (focusInput === void 0) { focusInput = false; }
|
|
@@ -190,17 +193,17 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
190
193
|
onText && onText('');
|
|
191
194
|
focusInput && ((_a = refInput === null || refInput === void 0 ? void 0 : refInput.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
192
195
|
}, [setValue, onText]);
|
|
193
|
-
var sendChange = useCallback(function (value) {
|
|
196
|
+
var sendChange = (0, react_1.useCallback)(function (value) {
|
|
194
197
|
// isDev && console.log(name, "sendChange", value, "selectedValue", selectedValue);
|
|
195
198
|
if (onChange && value !== selectedValue) {
|
|
196
199
|
onChange({ target: { name: name, value: value } });
|
|
197
200
|
}
|
|
198
201
|
}, [onChange, name]);
|
|
199
|
-
var filteredData = useMemo(function () {
|
|
202
|
+
var filteredData = (0, react_1.useMemo)(function () {
|
|
200
203
|
var _a;
|
|
201
204
|
var list;
|
|
202
205
|
if (filter.length > 0) {
|
|
203
|
-
list = data.filter(function (item) { return convertForSearch(item[labelKey]).includes(convertForSearch(filter)) || item[labelKey] == filter; });
|
|
206
|
+
list = data.filter(function (item) { return (0, baseFunctions_1.convertForSearch)(item[labelKey]).includes((0, baseFunctions_1.convertForSearch)(filter)) || item[labelKey] == filter; });
|
|
204
207
|
}
|
|
205
208
|
else {
|
|
206
209
|
list = data;
|
|
@@ -209,7 +212,7 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
209
212
|
var filterText = data.find(function (item) { return item[labelKey].toString().toLowerCase() === text.toString().toLowerCase(); });
|
|
210
213
|
if (!filterText) {
|
|
211
214
|
var newItem = (_a = {}, _a[labelKey] = text, _a[valueKey] = text, _a.create = true, _a);
|
|
212
|
-
list = __spreadArray([newItem], list, true);
|
|
215
|
+
list = tslib_1.__spreadArray([newItem], list, true);
|
|
213
216
|
setNewItemCreate(newItem);
|
|
214
217
|
}
|
|
215
218
|
else {
|
|
@@ -227,7 +230,7 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
227
230
|
var onKeyDown = function (e) {
|
|
228
231
|
if (!open || !refList.current)
|
|
229
232
|
return null;
|
|
230
|
-
onKeyboardSelection({
|
|
233
|
+
(0, listFunctions_1.onKeyboardSelection)({
|
|
231
234
|
e: e,
|
|
232
235
|
targetElement: refList,
|
|
233
236
|
checkByInput: checkByInput,
|
|
@@ -237,10 +240,10 @@ export var SearchableInput = forwardRef(function (_a, ref) {
|
|
|
237
240
|
selectedClass: 'selected'
|
|
238
241
|
});
|
|
239
242
|
};
|
|
240
|
-
return (
|
|
243
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: refMain, className: SearchableInput_module_css_1.default.searchableInputComponent, onKeyDown: onKeyDown, style: style, children: [(0, jsx_runtime_1.jsx)(index_1.Input, tslib_1.__assign({}, other, { inputRef: refInput, name: name, value: text, onFocus: function () { return !disabled && setOpen(true); }, onChange: textInputOnChange, endAdornment: !disabled && ((0, jsx_runtime_1.jsxs)("div", { style: { marginRight: 5 }, tabIndex: -1, children: [(0, jsx_runtime_1.jsx)(index_1.Button, { title: 'Temizle', tabIndex: -1, hidden: !(text && text.length > 0), onClick: function () { return clear(true, true); }, onlyIcon: (0, jsx_runtime_1.jsx)(icon_1.Icon, { name: 'close', style: { color: '#444' } }) }), endAdornment, (0, jsx_runtime_1.jsx)(index_1.Button, { tabIndex: -1, hidden: !data || !(data.length > 0), onClick: function () { return !disabled && setOpen(!open); }, onlyIcon: (0, jsx_runtime_1.jsx)(icon_1.Icon, { name: open ? 'keyboard_arrow_up' : 'keyboard_arrow_down', style: { color: '#444' } }) })] })), placeholder: loading ? 'Lütfen bekleyiniz...' : placeholder, loading: loading, disabled: disabled, propsInput: tslib_1.__assign(tslib_1.__assign({}, other === null || other === void 0 ? void 0 : other.propsInput), { autoComplete: 'off' }) })), open && ((0, jsx_runtime_1.jsx)("div", { className: 'listDiv', "data-relative": listPositionRelative, children: (0, jsx_runtime_1.jsxs)("ul", { ref: refList, className: "list ".concat(open ? 'open' : ''), children: [(filteredData.length === 0 || loading) && (0, jsx_runtime_1.jsx)("div", { className: "message ".concat(loading ? 'loading' : ''), children: loading ? loadingMessage : notFoundMessage }), filteredData.map(function (item, key) {
|
|
241
244
|
var itemValue = item[valueKey];
|
|
242
245
|
var itemLabel = item[labelKey];
|
|
243
|
-
return (
|
|
246
|
+
return ((0, jsx_runtime_1.jsxs)("li", { className: "item ".concat(itemValue === selectedValue ? 'active' : ''), "data-value": itemValue, "data-label": itemLabel, onClick: function () { return setValue(item, false); }, children: [item.create && (0, jsx_runtime_1.jsx)("span", { className: 'newCreate', children: "Yeni Olu\u015Ftur: " }), itemComponent ? itemComponent(item) : itemLabel] }, key));
|
|
244
247
|
})] }) }))] }));
|
|
245
248
|
});
|
|
246
249
|
var setFixedPosition = function (refMain) {
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uploadBase_CreateForm = exports.UploadBase = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
3
6
|
/**
|
|
4
7
|
* Copyright (c) 2024
|
|
5
8
|
* @author: izzetseydaoglu
|
|
6
9
|
* @last-modified: 11.06.2024 02:39
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
var react_1 = require("react");
|
|
12
|
+
var alert_1 = require("../alert");
|
|
10
13
|
var upload_ext_ok = ["pdf", "doc", "docx", "xls", "xlsx", "jpg", "jpeg", "png", "bmp", "tiff", "tif", "udf", "txt", "rtf", "csv", "xml", "zip", "rar"];
|
|
11
14
|
var upload_maxsize = 30;
|
|
12
15
|
var upload_maxfile = 50;
|
|
13
|
-
|
|
16
|
+
var UploadBase = function (_a) {
|
|
14
17
|
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 () {
|
|
18
|
+
var ref = (0, react_1.useRef)(null);
|
|
19
|
+
(0, react_1.useEffect)(function () {
|
|
17
20
|
if (refUploadInput)
|
|
18
21
|
refUploadInput.current = ref.current;
|
|
19
22
|
}, [ref.current]);
|
|
@@ -23,7 +26,7 @@ export var UploadBase = function (_a) {
|
|
|
23
26
|
return null;
|
|
24
27
|
}
|
|
25
28
|
if (e.target.files.length > maxFile) {
|
|
26
|
-
alert_add({ type: "error", message: "En fazla " + maxFile + " dosya seçebilirsiniz." });
|
|
29
|
+
(0, alert_1.alert_add)({ type: "error", message: "En fazla " + maxFile + " dosya seçebilirsiniz." });
|
|
27
30
|
e.target.value = null;
|
|
28
31
|
return null;
|
|
29
32
|
}
|
|
@@ -32,10 +35,10 @@ export var UploadBase = function (_a) {
|
|
|
32
35
|
var size = file.size;
|
|
33
36
|
var ext = file.name.replace(/^.*\./, "").toLowerCase();
|
|
34
37
|
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(", ") });
|
|
38
|
+
(0, alert_1.alert_add)({ type: "error", message: "Yüklemeye çalıştığınız dosya türü desteklenmiyor. Desteklenen dosya türleri: " + ext_ok.join(", ") });
|
|
36
39
|
}
|
|
37
40
|
else if (size > maxSize * 1000000) {
|
|
38
|
-
alert_add({ type: "error", message: "En fazla " + maxSize + "MB büyüklüğündeki dosyaları seçebilirsiniz." });
|
|
41
|
+
(0, alert_1.alert_add)({ type: "error", message: "En fazla " + maxSize + "MB büyüklüğündeki dosyaları seçebilirsiniz." });
|
|
39
42
|
}
|
|
40
43
|
else {
|
|
41
44
|
fileList.push(file);
|
|
@@ -50,10 +53,10 @@ export var UploadBase = function (_a) {
|
|
|
50
53
|
fileList.map(function (file) {
|
|
51
54
|
var _a;
|
|
52
55
|
uniqueID_1 = uniqueID_1 + 1;
|
|
53
|
-
newform_1 = __assign(__assign({}, newform_1), (_a = {}, _a[name + uniqueID_1] = file, _a));
|
|
56
|
+
newform_1 = tslib_1.__assign(tslib_1.__assign({}, newform_1), (_a = {}, _a[name + uniqueID_1] = file, _a));
|
|
54
57
|
nameList_1.push(file.name);
|
|
55
58
|
});
|
|
56
|
-
targetForm(function (prev) { return (__assign(__assign({}, prev), { uploadBaseList: __assign({}, newform_1), uploadBaseListName: nameList_1.join(", ") })); });
|
|
59
|
+
targetForm(function (prev) { return (tslib_1.__assign(tslib_1.__assign({}, prev), { uploadBaseList: tslib_1.__assign({}, newform_1), uploadBaseListName: nameList_1.join(", ") })); });
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
var defaultStyle = {
|
|
@@ -61,7 +64,7 @@ export var UploadBase = function (_a) {
|
|
|
61
64
|
cursor: "pointer"
|
|
62
65
|
};
|
|
63
66
|
var Component = component.toLowerCase();
|
|
64
|
-
return (
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(Component, { className: className, style: tslib_1.__assign(tslib_1.__assign({}, defaultStyle), style), "data-label": label !== null && label !== void 0 ? label : "", children: [children, (0, jsx_runtime_1.jsx)("input", { ref: ref, type: "file", required: required, onChange: fileSelected, multiple: multiple, accept: ext_ok.map(function (i) { return "." + i; }).join(","), style: {
|
|
65
68
|
position: "absolute",
|
|
66
69
|
top: 0,
|
|
67
70
|
left: 0,
|
|
@@ -72,15 +75,17 @@ export var UploadBase = function (_a) {
|
|
|
72
75
|
zIndex: 1
|
|
73
76
|
} })] }));
|
|
74
77
|
};
|
|
75
|
-
|
|
78
|
+
exports.UploadBase = UploadBase;
|
|
79
|
+
var uploadBase_CreateForm = function (formData) {
|
|
76
80
|
var _a;
|
|
77
|
-
var newform = __assign({}, formData);
|
|
81
|
+
var newform = tslib_1.__assign({}, formData);
|
|
78
82
|
var list = (_a = formData["uploadBaseList"]) !== null && _a !== void 0 ? _a : {};
|
|
79
83
|
Object.keys(list).map(function (fileKey) {
|
|
80
84
|
var _a;
|
|
81
|
-
return (newform = __assign(__assign({}, newform), (_a = {}, _a[fileKey] = list[fileKey], _a)));
|
|
85
|
+
return (newform = tslib_1.__assign(tslib_1.__assign({}, newform), (_a = {}, _a[fileKey] = list[fileKey], _a)));
|
|
82
86
|
});
|
|
83
87
|
delete newform["uploadBaseList"];
|
|
84
88
|
delete newform["uploadBaseListName"];
|
|
85
89
|
return newform;
|
|
86
90
|
};
|
|
91
|
+
exports.uploadBase_CreateForm = uploadBase_CreateForm;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./Button"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./Checkbox"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./Dialog"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./Form"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./FormOlustur"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./Input"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./Label"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./SearchableInput"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./UploadBase"), exports);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DevelopGridComponent = exports.Hidden = exports.Col = exports.Row = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
var index_module_css_1 = tslib_1.__importDefault(require("./index.module.css"));
|
|
8
|
+
var Row = function (_a) {
|
|
9
|
+
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 = tslib_1.__rest(_a, ["children", "className", "style", "flexDirection", "flexWrap", "justifyContent", "alignContent", "alignItems", "rowSpacing", "colSpacing"]);
|
|
10
|
+
var classes = [
|
|
11
|
+
index_module_css_1.default.row,
|
|
12
|
+
rowSpacing !== undefined && index_module_css_1.default["row-spacing-".concat(rowSpacing)],
|
|
13
|
+
colSpacing !== undefined && index_module_css_1.default["col-spacing-".concat(colSpacing)],
|
|
14
|
+
flexDirection !== 'row' && index_module_css_1.default["flex-".concat(flexDirection.replace('-', '-'))],
|
|
15
|
+
flexWrap !== 'wrap' && index_module_css_1.default["flex-".concat(flexWrap)],
|
|
16
|
+
justifyContent !== 'flex-start' && index_module_css_1.default["justify-".concat(justifyContent.replace('flex-', '').replace('space-', ''))],
|
|
17
|
+
alignItems !== 'center' && index_module_css_1.default["align-items-".concat(alignItems.replace('flex-', ''))],
|
|
18
|
+
alignContent !== 'center' && index_module_css_1.default["align-content-".concat(alignContent.replace('flex-', ''))],
|
|
19
|
+
className
|
|
20
|
+
]
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join(' ');
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: classes, style: style }, other, { children: children })));
|
|
24
|
+
};
|
|
25
|
+
exports.Row = Row;
|
|
26
|
+
var Col = function (_a) {
|
|
27
|
+
// Cascading logic - aynı sizin component'inizdeki gibi
|
|
28
|
+
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 = tslib_1.__rest(_a, ["children", "className", "style", "xs", "sm", "md", "lg", "xl", "xxl"]);
|
|
29
|
+
var classes = [
|
|
30
|
+
index_module_css_1.default.col,
|
|
31
|
+
// Sadece belirtilen breakpoint'ler için class ekle
|
|
32
|
+
xs && index_module_css_1.default["col-xs-".concat(xs)],
|
|
33
|
+
sm && index_module_css_1.default["col-sm-".concat(sm)],
|
|
34
|
+
md && index_module_css_1.default["col-md-".concat(md)],
|
|
35
|
+
lg && index_module_css_1.default["col-lg-".concat(lg)],
|
|
36
|
+
xl && index_module_css_1.default["col-xl-".concat(xl)],
|
|
37
|
+
xxl && index_module_css_1.default["col-xxl-".concat(xxl)],
|
|
38
|
+
className
|
|
39
|
+
]
|
|
40
|
+
.filter(Boolean)
|
|
41
|
+
.join(' ');
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: classes, style: style }, other, { children: children })));
|
|
43
|
+
};
|
|
44
|
+
exports.Col = Col;
|
|
45
|
+
var Hidden = function (_a) {
|
|
46
|
+
var children = _a.children, hidden = _a.hidden, onlyHidden = _a.onlyHidden, other = tslib_1.__rest(_a, ["children", "hidden", "onlyHidden"]);
|
|
47
|
+
var existingClassName = children.props.className || '';
|
|
48
|
+
var hiddenClasses = [];
|
|
49
|
+
if (onlyHidden) {
|
|
50
|
+
onlyHidden.forEach(function (breakpoint) {
|
|
51
|
+
hiddenClasses.push(index_module_css_1.default["hidden-".concat(breakpoint)]);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else if (hidden) {
|
|
55
|
+
// Orijinal mantık: seçilen breakpoint ve altındaki tüm breakpoint'ler gizlenir
|
|
56
|
+
var breakpoints = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
57
|
+
var targetIndex = breakpoints.indexOf(hidden);
|
|
58
|
+
if (targetIndex !== -1) {
|
|
59
|
+
for (var i = 0; i <= targetIndex; i++) {
|
|
60
|
+
hiddenClasses.push(index_module_css_1.default["hidden-".concat(breakpoints[i])]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var newClassName = tslib_1.__spreadArray([existingClassName], hiddenClasses, true).filter(Boolean).join(' ');
|
|
65
|
+
return react_1.default.cloneElement(children, tslib_1.__assign({ className: newClassName }, other));
|
|
66
|
+
};
|
|
67
|
+
exports.Hidden = Hidden;
|
|
68
|
+
var DevelopGridComponent = function () {
|
|
69
|
+
var _a = (0, react_1.useState)(''), currentBreakpoint = _a[0], setCurrentBreakpoint = _a[1];
|
|
70
|
+
// Breakpoint detector
|
|
71
|
+
react_1.default.useEffect(function () {
|
|
72
|
+
var updateBreakpoint = function () {
|
|
73
|
+
var width = window.innerWidth;
|
|
74
|
+
var breakpoint = '';
|
|
75
|
+
if (width <= 576)
|
|
76
|
+
breakpoint = 'XS (≤576px)';
|
|
77
|
+
else if (width <= 768)
|
|
78
|
+
breakpoint = 'SM (577-768px)';
|
|
79
|
+
else if (width <= 992)
|
|
80
|
+
breakpoint = 'MD (769-992px)';
|
|
81
|
+
else if (width <= 1200)
|
|
82
|
+
breakpoint = 'LG (993-1200px)';
|
|
83
|
+
else if (width <= 1400)
|
|
84
|
+
breakpoint = 'XL (1201-1400px)';
|
|
85
|
+
else
|
|
86
|
+
breakpoint = 'XXL (≥1401px)';
|
|
87
|
+
setCurrentBreakpoint(breakpoint);
|
|
88
|
+
};
|
|
89
|
+
updateBreakpoint();
|
|
90
|
+
window.addEventListener('resize', updateBreakpoint);
|
|
91
|
+
return function () { return window.removeEventListener('resize', updateBreakpoint); };
|
|
92
|
+
}, []);
|
|
93
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
94
|
+
position: 'fixed',
|
|
95
|
+
bottom: '10px',
|
|
96
|
+
right: '10px',
|
|
97
|
+
background: '#333',
|
|
98
|
+
color: 'white',
|
|
99
|
+
padding: '10px',
|
|
100
|
+
borderRadius: '4px',
|
|
101
|
+
zIndex: 9999999
|
|
102
|
+
}, children: ["Current: ", currentBreakpoint] }));
|
|
103
|
+
};
|
|
104
|
+
exports.DevelopGridComponent = DevelopGridComponent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.iconMap = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
exports.iconMap = {
|
|
6
|
+
close: {
|
|
7
|
+
viewBox: '0 -960 960 960',
|
|
8
|
+
content: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.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" }) }))
|
|
9
|
+
},
|
|
10
|
+
search: {
|
|
11
|
+
viewBox: '0 0 24 24',
|
|
12
|
+
content: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })] }))
|
|
13
|
+
},
|
|
14
|
+
edit: {
|
|
15
|
+
viewBox: '0 -960 960 960',
|
|
16
|
+
content: ((0, jsx_runtime_1.jsx)("path", { d: "M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z" }))
|
|
17
|
+
},
|
|
18
|
+
keyboard_arrow_up: {
|
|
19
|
+
viewBox: '0 -960 960 960',
|
|
20
|
+
content: (0, jsx_runtime_1.jsx)("path", { d: "M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z" })
|
|
21
|
+
},
|
|
22
|
+
keyboard_arrow_down: {
|
|
23
|
+
viewBox: '0 -960 960 960',
|
|
24
|
+
content: (0, jsx_runtime_1.jsx)("path", { d: "M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z" })
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Icon = exports.iconList = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var icons_1 = require("./icons");
|
|
7
|
+
exports.iconList = Object.keys(icons_1.iconMap);
|
|
8
|
+
var defaultIconStyle = {
|
|
9
|
+
userSelect: 'none',
|
|
10
|
+
width: '1em',
|
|
11
|
+
height: '1em',
|
|
12
|
+
// display: 'inline-block',
|
|
13
|
+
verticalAlign: 'middle',
|
|
14
|
+
flexShrink: 0,
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
justifyContent: 'center'
|
|
18
|
+
};
|
|
19
|
+
var Icon = function (_a) {
|
|
20
|
+
var name = _a.name, iconMui = _a.iconMui, customIcon = _a.customIcon, fontSize = _a.fontSize, color = _a.color, className = _a.className, style = _a.style, other = tslib_1.__rest(_a, ["name", "iconMui", "customIcon", "fontSize", "color", "className", "style"]);
|
|
21
|
+
if (iconMui) {
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: "material-icons ".concat(className || ''), style: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, defaultIconStyle), style), { fontSize: fontSize || '1.3rem', color: color || 'inherit' }), "aria-hidden": "true" }, other, { children: iconMui })));
|
|
23
|
+
}
|
|
24
|
+
var iconComponent = name ? icons_1.iconMap[name] : customIcon;
|
|
25
|
+
if (!iconComponent) {
|
|
26
|
+
return (0, jsx_runtime_1.jsx)("span", { children: "\u26A0\uFE0F" });
|
|
27
|
+
}
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: className, style: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, defaultIconStyle), style), { fontSize: fontSize || '1.5rem', color: color || 'inherit' }) }, other, { children: (0, jsx_runtime_1.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 }) })));
|
|
29
|
+
};
|
|
30
|
+
exports.Icon = Icon;
|
package/_dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./_lib/baseFunctions"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./_lib/inputMask"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./_lib/listFunctions"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./_lib/storage/cookies"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./_lib/storage/encData"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./_lib/storage/localStorage"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./_lib/storage/sessionStorage"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./_lib/useInterval"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./alert"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./box"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./countDown"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./dateTime"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./form"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./grid"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./icon"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./menu"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./modal"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./popover"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./tooltip"), exports);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Menu = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* @author : izzetseydaoglu
|
|
8
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
9
|
+
* @version : 2026-02-07 19:31:01
|
|
10
|
+
*/
|
|
11
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
12
|
+
var form_1 = require("../form");
|
|
13
|
+
var popover_1 = require("../popover");
|
|
14
|
+
var link_1 = tslib_1.__importDefault(require("next/link"));
|
|
15
|
+
var index_module_css_1 = tslib_1.__importDefault(require("./index.module.css"));
|
|
16
|
+
exports.Menu = (0, react_1.memo)(function MemoFunction(_a) {
|
|
17
|
+
var menu = _a.menu, className = _a.className, style = _a.style, _b = _a.withIcon, withIcon = _b === void 0 ? 'auto' : _b;
|
|
18
|
+
var withIconComponent = (0, react_1.useMemo)(function () {
|
|
19
|
+
if (withIcon === true)
|
|
20
|
+
return true;
|
|
21
|
+
if (withIcon === false)
|
|
22
|
+
return false;
|
|
23
|
+
return Object.values(menu).some(function (item) { return 'icon' in item && !!item.icon; });
|
|
24
|
+
}, [menu, withIcon]);
|
|
25
|
+
var withRightComponent = (0, react_1.useMemo)(function () {
|
|
26
|
+
return Object.values(menu).some(function (item) { return 'rightComponent' in item && !!item.rightComponent; });
|
|
27
|
+
}, [menu]);
|
|
28
|
+
var handleClick = function (item, e) {
|
|
29
|
+
if (!item.onClick)
|
|
30
|
+
return;
|
|
31
|
+
if (item.dialog) {
|
|
32
|
+
(0, form_1.Dialog)(tslib_1.__assign({}, item.dialog)).then(function (result) {
|
|
33
|
+
if (result && item.onClick) {
|
|
34
|
+
item.onClick(e);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
item.onClick(e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)("ul", { className: "smenu ".concat(index_module_css_1.default.ul, " ").concat(className || ''), style: style, children: Object.values(menu).map(function (item, key) {
|
|
43
|
+
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 = tslib_1.__rest(_a, ["fullComponent", "icon", "title", "rightComponent", "seperator", "href", "style", "itemProps", "type", "items", "menuProps", "subMenuPopoverProps"]);
|
|
44
|
+
var hasSubmenu = type === 'submenu' && Array.isArray(items) && items.length > 0;
|
|
45
|
+
if (fullComponent)
|
|
46
|
+
return react_1.default.cloneElement(fullComponent, { key: key });
|
|
47
|
+
if (seperator)
|
|
48
|
+
return (0, jsx_runtime_1.jsx)("li", tslib_1.__assign({ className: index_module_css_1.default.seperator, style: style }, itemProps, other), key);
|
|
49
|
+
var Component = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [withIconComponent && (0, jsx_runtime_1.jsx)("div", { className: index_module_css_1.default.menuicon, children: icon }), (0, jsx_runtime_1.jsx)("div", { className: index_module_css_1.default.menutitle, children: title }), withRightComponent && (0, jsx_runtime_1.jsx)("div", { className: index_module_css_1.default.rightmenu, children: rightComponent })] }));
|
|
50
|
+
if (hasSubmenu) {
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(popover_1.Popover, tslib_1.__assign({ component: (0, jsx_runtime_1.jsx)("li", tslib_1.__assign({ style: style }, itemProps, other, { children: Component })), position: "right-top" }, (subMenuPopoverProps || {}), { children: (0, jsx_runtime_1.jsx)(exports.Menu, tslib_1.__assign({ menu: items }, (menuProps || {}))) }), key));
|
|
52
|
+
}
|
|
53
|
+
return ((0, jsx_runtime_1.jsx)("li", tslib_1.__assign({ style: style, onClick: function (e) { return handleClick(item, e); } }, itemProps, other, { children: href ? (0, jsx_runtime_1.jsx)(link_1.default, { href: href, children: Component }) : Component }), key));
|
|
54
|
+
}) }));
|
|
55
|
+
});
|