@sydsoft/base 1.58.0 → 2.0.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/baseFunctions.d.ts +16 -0
- package/dist/esm/_lib/baseFunctions.js +102 -0
- package/dist/esm/_lib/inputMask.d.ts +12 -0
- package/dist/esm/_lib/inputMask.js +234 -0
- package/dist/esm/_lib/listFunctions.d.ts +7 -0
- package/dist/esm/_lib/listFunctions.js +119 -0
- package/dist/esm/_lib/storage/cookies.d.ts +9 -0
- package/dist/esm/_lib/storage/cookies.js +39 -0
- package/dist/esm/_lib/storage/encData.d.ts +7 -0
- package/dist/esm/_lib/storage/encData.js +48 -0
- package/dist/esm/_lib/storage/localStorage.d.ts +11 -0
- package/dist/esm/_lib/storage/localStorage.js +74 -0
- package/dist/esm/_lib/storage/sessionStorage.d.ts +11 -0
- package/dist/esm/_lib/storage/sessionStorage.js +74 -0
- package/dist/esm/_lib/useInterval.d.ts +6 -0
- package/dist/esm/_lib/useInterval.js +24 -0
- package/dist/esm/alert/index.d.ts +23 -0
- package/dist/esm/alert/index.js +112 -0
- package/dist/esm/alert/index.module.css +125 -0
- package/dist/esm/box/Box.d.ts +14 -0
- package/dist/esm/box/Box.js +20 -0
- package/dist/esm/box/Box.module.css +159 -0
- package/dist/esm/box/BoxContent.d.ts +14 -0
- package/dist/esm/box/BoxContent.js +7 -0
- package/dist/esm/box/BoxFooter.d.ts +15 -0
- package/dist/esm/box/BoxFooter.js +13 -0
- package/dist/esm/box/BoxHeader.d.ts +21 -0
- package/dist/esm/box/BoxHeader.js +14 -0
- package/dist/esm/box/index.d.ts +9 -0
- package/dist/esm/box/index.js +9 -0
- package/dist/esm/countDown/index.d.ts +27 -0
- package/dist/esm/countDown/index.js +102 -0
- package/dist/esm/dateTime/index.d.ts +17 -0
- package/dist/esm/dateTime/index.js +81 -0
- package/dist/esm/form/Button.d.ts +32 -0
- package/dist/esm/form/Button.js +81 -0
- package/dist/esm/form/Checkbox.d.ts +28 -0
- package/dist/esm/form/Checkbox.js +28 -0
- package/dist/esm/form/Dialog.d.ts +25 -0
- package/dist/esm/form/Dialog.js +40 -0
- package/dist/esm/form/Form.d.ts +15 -0
- package/dist/esm/form/Form.js +17 -0
- package/dist/esm/form/FormOlustur.d.ts +44 -0
- package/dist/esm/form/FormOlustur.js +57 -0
- package/dist/esm/form/Input.d.ts +66 -0
- package/dist/esm/form/Input.js +196 -0
- package/dist/esm/form/Label.d.ts +12 -0
- package/dist/esm/form/Label.js +14 -0
- package/dist/esm/form/SearchableInput.d.ts +42 -0
- package/dist/esm/form/SearchableInput.js +277 -0
- package/dist/esm/form/UploadBase.d.ts +25 -0
- package/dist/esm/form/UploadBase.js +86 -0
- package/dist/esm/form/index.d.ts +14 -0
- package/dist/esm/form/index.js +14 -0
- package/dist/esm/form/styles/Button.module.css +151 -0
- package/dist/esm/form/styles/Input.module.css +227 -0
- package/dist/esm/form/styles/Label.module.css +37 -0
- package/dist/esm/form/styles/SearchableInput.module.css +86 -0
- package/dist/esm/grid/index.d.ts +43 -0
- package/dist/esm/grid/index.js +102 -0
- package/dist/esm/grid/index.module.css +812 -0
- package/dist/esm/icon/icons.d.ts +27 -0
- package/dist/esm/icon/icons.js +28 -0
- package/dist/esm/icon/index.d.ts +38 -0
- package/dist/esm/icon/index.js +25 -0
- package/dist/esm/icon/mui.d.ts +6 -0
- package/dist/esm/icon/mui.js +6 -0
- package/dist/esm/index.d.ts +24 -0
- package/dist/esm/index.js +24 -0
- package/dist/esm/menu/index.d.ts +75 -0
- package/dist/esm/menu/index.js +59 -0
- package/dist/esm/menu/index.module.css +106 -0
- package/dist/esm/modal/index.d.ts +23 -0
- package/dist/esm/modal/index.js +66 -0
- package/dist/esm/modal/index.module.css +83 -0
- package/dist/esm/popover/index.d.ts +26 -0
- package/dist/esm/popover/index.js +343 -0
- package/dist/esm/popover/index.module.css +95 -0
- package/dist/esm/tooltip/index.d.ts +16 -0
- package/dist/esm/tooltip/index.js +124 -0
- package/package.json +12 -8
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export declare const isDev: boolean;
|
|
7
|
+
export declare const isServerReq: (context: any) => boolean;
|
|
8
|
+
export declare const sleep: (ms?: number) => Promise<unknown>;
|
|
9
|
+
export declare const padNumber: (num: number, padLength?: number, padString?: string) => string;
|
|
10
|
+
export declare function inputTumuBuyukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
11
|
+
export declare function inputTumuKucukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
12
|
+
export declare const convertLowerCase: (text?: any) => any;
|
|
13
|
+
export declare const convertForSearch: (value: string) => string;
|
|
14
|
+
export declare function convertForSEO(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
15
|
+
export declare function getDomain(context?: any): string;
|
|
16
|
+
export declare const uniqueID: (key?: string, length?: number) => string;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export var isDev = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
|
|
7
|
+
export var isServerReq = function (context) { var _a, _b; return !((_b = (_a = context === null || context === void 0 ? void 0 : context.req) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.startsWith('/_next')); };
|
|
8
|
+
export var sleep = function (ms) {
|
|
9
|
+
if (ms === void 0) { ms = 1000; }
|
|
10
|
+
return new Promise(function (resolve) { return setTimeout(resolve, ms); });
|
|
11
|
+
};
|
|
12
|
+
export var padNumber = function (num, padLength, padString) {
|
|
13
|
+
if (padLength === void 0) { padLength = 2; }
|
|
14
|
+
if (padString === void 0) { padString = '0'; }
|
|
15
|
+
return String(num).padStart(padLength, padString);
|
|
16
|
+
};
|
|
17
|
+
export function inputTumuBuyukCevir(e) {
|
|
18
|
+
var _a;
|
|
19
|
+
if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
|
|
20
|
+
var start = e.target.selectionStart;
|
|
21
|
+
var end = e.target.selectionEnd;
|
|
22
|
+
e.target.value = e.target.value.toString().toLocaleUpperCase('tr-TR');
|
|
23
|
+
e.target.setSelectionRange(start, end);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function inputTumuKucukCevir(e) {
|
|
27
|
+
var _a;
|
|
28
|
+
if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
|
|
29
|
+
var start = e.target.selectionStart;
|
|
30
|
+
var end = e.target.selectionEnd;
|
|
31
|
+
e.target.value = e.target.value.toString().toLocaleLowerCase('tr-TR');
|
|
32
|
+
e.target.setSelectionRange(start, end);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export var convertLowerCase = function (text) {
|
|
36
|
+
if (text === void 0) { text = ''; }
|
|
37
|
+
return text.toString().toLocaleLowerCase('tr-TR');
|
|
38
|
+
};
|
|
39
|
+
export var convertForSearch = function (value) {
|
|
40
|
+
var data = value === null || value === void 0 ? void 0 : value.toString().toLocaleLowerCase('tr-TR');
|
|
41
|
+
data = data.replace(/ö/g, 'o');
|
|
42
|
+
data = data.replace(/ç/g, 'c');
|
|
43
|
+
data = data.replace(/ş/g, 's');
|
|
44
|
+
data = data.replace(/ı/g, 'i');
|
|
45
|
+
data = data.replace(/ğ/g, 'g');
|
|
46
|
+
data = data.replace(/ü/g, 'u');
|
|
47
|
+
data = data.replace(/[^a-z\d]/g, ''); // %_- are allowed
|
|
48
|
+
data = data.replace(/^\s+|\s+$/g, '');
|
|
49
|
+
return data;
|
|
50
|
+
};
|
|
51
|
+
export function convertForSEO(e) {
|
|
52
|
+
var _a;
|
|
53
|
+
if ((e === null || e === void 0 ? void 0 : e.target) && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.setSelectionRange)) {
|
|
54
|
+
var start = e.target.selectionStart;
|
|
55
|
+
var end = e.target.selectionEnd;
|
|
56
|
+
var string = e.target.value.toString().toLocaleLowerCase('tr');
|
|
57
|
+
var turkce = [' ', '-', 'ş', 'Ş', 'ı', 'ü', 'Ü', 'ö', 'Ö', 'ç', 'Ç', 'ş', 'Ş', 'ı', 'ğ', 'Ğ', 'İ', 'ö', 'Ö', 'Ç', 'ç', 'ü', 'Ü', 'â', 'ê', 'Â', '“', '”'];
|
|
58
|
+
var duzgun = ['-', '-', 's', 'S', 'i', 'u', 'U', 'o', 'O', 'c', 'C', 's', 'S', 'i', 'g', 'G', 'I', 'o', 'O', 'C', 'c', 'u', 'U', 'a', 'ê', 'a', '', ''];
|
|
59
|
+
for (var i = 0; i < turkce.length; i++) {
|
|
60
|
+
string = string.split(turkce[i]).join(duzgun[i]);
|
|
61
|
+
}
|
|
62
|
+
string = string.replace(/[^a-z0-9\-_şıüğçİŞĞÜÇ]+/gi, '_');
|
|
63
|
+
string = string.replace(/_+/g, '_');
|
|
64
|
+
string = string.replace(/^-/, '_');
|
|
65
|
+
string = string.replace(/-$/, '_');
|
|
66
|
+
e.target.value = string;
|
|
67
|
+
e.target.setSelectionRange(start, end);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function getDomain(context) {
|
|
71
|
+
if (context === void 0) { context = null; }
|
|
72
|
+
var url = '';
|
|
73
|
+
if (context) {
|
|
74
|
+
url = context.req.headers.host;
|
|
75
|
+
}
|
|
76
|
+
else if (typeof window !== 'undefined') {
|
|
77
|
+
url = window.location.hostname;
|
|
78
|
+
}
|
|
79
|
+
if (url.length) {
|
|
80
|
+
var parts = url.split('.').reverse();
|
|
81
|
+
var cnt = parts.length;
|
|
82
|
+
if (cnt >= 3) {
|
|
83
|
+
// see if the second level domain is a common SLD.
|
|
84
|
+
if (parts[1].match(/^(com|edu|gov|net|mil|org|nom|co|name|info|biz)$/i)) {
|
|
85
|
+
var domain_1 = parts[2] + '.' + parts[1] + '.' + parts[0];
|
|
86
|
+
return domain_1.split(':')[0];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
var domain = parts[1] + '.' + parts[0];
|
|
90
|
+
return domain.split(':')[0];
|
|
91
|
+
}
|
|
92
|
+
return url;
|
|
93
|
+
}
|
|
94
|
+
export var uniqueID = function (key, length) {
|
|
95
|
+
if (key === void 0) { key = ''; }
|
|
96
|
+
if (length === void 0) { length = 16; }
|
|
97
|
+
return (key +
|
|
98
|
+
parseInt(Math.ceil(Math.random() * Date.now())
|
|
99
|
+
.toPrecision(length)
|
|
100
|
+
.toString()
|
|
101
|
+
.replace('.', '')));
|
|
102
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export declare const applyInputMask: (inputElement: any, mask: string, options?: any) => {
|
|
7
|
+
destroy: () => void;
|
|
8
|
+
setValue: (value: any) => void;
|
|
9
|
+
getValue: () => any;
|
|
10
|
+
getCleanValue: () => string;
|
|
11
|
+
applyMask: (inputValue: any) => string;
|
|
12
|
+
} | null;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
import { isDev } from "./baseFunctions";
|
|
7
|
+
// Mask işleme core fonksiyonları
|
|
8
|
+
var createMaskCore = function () {
|
|
9
|
+
var defaultTranslation = {
|
|
10
|
+
"0": { pattern: /\d/ },
|
|
11
|
+
"9": { pattern: /\d/, optional: true },
|
|
12
|
+
"#": { pattern: /\d/, recursive: true },
|
|
13
|
+
A: { pattern: /[a-zA-Z0-9]/ },
|
|
14
|
+
S: { pattern: /[a-zA-Z]/ },
|
|
15
|
+
U: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toUpperCase(); } },
|
|
16
|
+
L: { pattern: /[a-zA-Z]/, transform: function (char) { return char.toLowerCase(); } },
|
|
17
|
+
X: { pattern: /[0-9a-fA-F]/ }
|
|
18
|
+
};
|
|
19
|
+
var parseMask = function (maskString, translation) {
|
|
20
|
+
if (translation === void 0) { translation = defaultTranslation; }
|
|
21
|
+
var tokens = [];
|
|
22
|
+
var i = 0;
|
|
23
|
+
while (i < maskString.length) {
|
|
24
|
+
var char = maskString[i];
|
|
25
|
+
if (translation[char]) {
|
|
26
|
+
tokens.push({
|
|
27
|
+
type: "input",
|
|
28
|
+
pattern: translation[char].pattern,
|
|
29
|
+
optional: translation[char].optional,
|
|
30
|
+
recursive: translation[char].recursive,
|
|
31
|
+
transform: translation[char].transform
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
tokens.push({
|
|
36
|
+
type: "literal",
|
|
37
|
+
char: char
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
i++;
|
|
41
|
+
}
|
|
42
|
+
return tokens;
|
|
43
|
+
};
|
|
44
|
+
var applyMask = function (inputValue, maskTokens, reverse) {
|
|
45
|
+
if (reverse === void 0) { reverse = false; }
|
|
46
|
+
if (!maskTokens.length)
|
|
47
|
+
return inputValue;
|
|
48
|
+
var normalizedValue = inputValue == null ? "" : String(inputValue);
|
|
49
|
+
var cleanValue = normalizedValue.replace(/[^\w\s]/g, "");
|
|
50
|
+
if (reverse) {
|
|
51
|
+
return applyReverseMask(cleanValue, maskTokens);
|
|
52
|
+
}
|
|
53
|
+
var result = "";
|
|
54
|
+
var valueIndex = 0;
|
|
55
|
+
var maskIndex = 0;
|
|
56
|
+
while (maskIndex < maskTokens.length && valueIndex < cleanValue.length) {
|
|
57
|
+
var token = maskTokens[maskIndex];
|
|
58
|
+
if (token.type === "literal") {
|
|
59
|
+
result += token.char;
|
|
60
|
+
maskIndex++;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
var char = cleanValue[valueIndex];
|
|
64
|
+
if (token.pattern.test(char)) {
|
|
65
|
+
var transformedChar = token.transform ? token.transform(char) : char;
|
|
66
|
+
result += transformedChar;
|
|
67
|
+
valueIndex++;
|
|
68
|
+
maskIndex++;
|
|
69
|
+
}
|
|
70
|
+
else if (token.optional) {
|
|
71
|
+
maskIndex++;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
valueIndex++;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
while (maskIndex < maskTokens.length) {
|
|
79
|
+
var token = maskTokens[maskIndex];
|
|
80
|
+
if (token.type === "literal") {
|
|
81
|
+
result += token.char;
|
|
82
|
+
}
|
|
83
|
+
else if (!token.optional) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
maskIndex++;
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
};
|
|
90
|
+
var applyReverseMask = function (inputValue, maskTokens) {
|
|
91
|
+
var reversedMask = maskTokens.slice().reverse();
|
|
92
|
+
var reversedValue = inputValue.split("").reverse().join("");
|
|
93
|
+
var result = "";
|
|
94
|
+
var valueIndex = 0;
|
|
95
|
+
var maskIndex = 0;
|
|
96
|
+
while (maskIndex < reversedMask.length && valueIndex < reversedValue.length) {
|
|
97
|
+
var token = reversedMask[maskIndex];
|
|
98
|
+
if (token.type === "literal") {
|
|
99
|
+
result = token.char + result;
|
|
100
|
+
maskIndex++;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
var char = reversedValue[valueIndex];
|
|
104
|
+
if (token.pattern.test(char)) {
|
|
105
|
+
var transformedChar = token.transform ? token.transform(char) : char;
|
|
106
|
+
result = transformedChar + result;
|
|
107
|
+
valueIndex++;
|
|
108
|
+
maskIndex++;
|
|
109
|
+
}
|
|
110
|
+
else if (token.optional) {
|
|
111
|
+
maskIndex++;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
valueIndex++;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
};
|
|
120
|
+
var getCleanValue = function (maskedValue, maskTokens) {
|
|
121
|
+
if (!maskTokens.length)
|
|
122
|
+
return maskedValue;
|
|
123
|
+
var clean = "";
|
|
124
|
+
var valueIndex = 0;
|
|
125
|
+
var maskIndex = 0;
|
|
126
|
+
while (maskIndex < maskTokens.length && valueIndex < maskedValue.length) {
|
|
127
|
+
var token = maskTokens[maskIndex];
|
|
128
|
+
if (token.type === "literal") {
|
|
129
|
+
if (maskedValue[valueIndex] === token.char) {
|
|
130
|
+
valueIndex++;
|
|
131
|
+
}
|
|
132
|
+
maskIndex++;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
clean += maskedValue[valueIndex];
|
|
136
|
+
valueIndex++;
|
|
137
|
+
maskIndex++;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return clean;
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
parseMask: parseMask,
|
|
144
|
+
applyMask: applyMask,
|
|
145
|
+
getCleanValue: getCleanValue
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
// Fonksiyonel yaklaşım - herhangi bir input elementine mask uygula
|
|
149
|
+
export var applyInputMask = function (inputElement, mask, options) {
|
|
150
|
+
if (options === void 0) { options = {}; }
|
|
151
|
+
if (!inputElement || !mask)
|
|
152
|
+
return null;
|
|
153
|
+
isDev && console.log("Input mask applied:", { inputElement: inputElement, mask: mask, options: options });
|
|
154
|
+
var translation = options.translation, _a = options.reverse, reverse = _a === void 0 ? false : _a, _b = options.clearIfNotMatch, clearIfNotMatch = _b === void 0 ? true : _b, _c = options.selectOnFocus, selectOnFocus = _c === void 0 ? false : _c, onChange = options.onChange;
|
|
155
|
+
var maskCore = createMaskCore();
|
|
156
|
+
var maskTokens = maskCore.parseMask(mask, translation);
|
|
157
|
+
var applyMaskToValue = function (inputValue) { return maskCore.applyMask(inputValue, maskTokens, reverse); };
|
|
158
|
+
var getCleanValue = function (maskedValue) { return maskCore.getCleanValue(maskedValue, maskTokens); };
|
|
159
|
+
var handleInputChange = function (e) {
|
|
160
|
+
var inputValue = e.target.value;
|
|
161
|
+
var maskedValue = applyMaskToValue(inputValue);
|
|
162
|
+
var cleanValue = getCleanValue(maskedValue);
|
|
163
|
+
e.target.value = maskedValue;
|
|
164
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
|
|
165
|
+
};
|
|
166
|
+
var handleKeyDown = function (e) {
|
|
167
|
+
var key = e.key, target = e.target;
|
|
168
|
+
var cursorStart = target.selectionStart;
|
|
169
|
+
var cursorEnd = target.selectionEnd;
|
|
170
|
+
if (key === "Backspace" || key === "Delete") {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
var newValue = target.value;
|
|
173
|
+
if (cursorStart !== cursorEnd) {
|
|
174
|
+
newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorEnd);
|
|
175
|
+
}
|
|
176
|
+
else if (key === "Backspace" && cursorStart > 0) {
|
|
177
|
+
newValue = newValue.substring(0, cursorStart - 1) + newValue.substring(cursorStart);
|
|
178
|
+
}
|
|
179
|
+
else if (key === "Delete" && cursorStart < newValue.length) {
|
|
180
|
+
newValue = newValue.substring(0, cursorStart) + newValue.substring(cursorStart + 1);
|
|
181
|
+
}
|
|
182
|
+
var maskedValue = applyMaskToValue(newValue);
|
|
183
|
+
target.value = maskedValue;
|
|
184
|
+
var cleanValue = getCleanValue(maskedValue);
|
|
185
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(maskedValue, cleanValue, e);
|
|
186
|
+
setTimeout(function () {
|
|
187
|
+
var newPos = key === "Backspace" ? Math.max(0, cursorStart - 1) : cursorStart;
|
|
188
|
+
target.setSelectionRange(newPos, newPos);
|
|
189
|
+
}, 0);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var handleFocus = function (e) {
|
|
193
|
+
if (selectOnFocus) {
|
|
194
|
+
setTimeout(function () {
|
|
195
|
+
e.target.select();
|
|
196
|
+
}, 0);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
var handleBlur = function (e) {
|
|
200
|
+
if (clearIfNotMatch) {
|
|
201
|
+
var cleanValue = getCleanValue(e.target.value);
|
|
202
|
+
var expectedLength = maskTokens.filter(function (t) { return t.type === "input" && !t.optional; }).length;
|
|
203
|
+
if (cleanValue.length < expectedLength) {
|
|
204
|
+
e.target.value = "";
|
|
205
|
+
onChange === null || onChange === void 0 ? void 0 : onChange("", "", e);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
// Event listener'ları ekle
|
|
210
|
+
inputElement.addEventListener("input", handleInputChange);
|
|
211
|
+
inputElement.addEventListener("keydown", handleKeyDown);
|
|
212
|
+
inputElement.addEventListener("focus", handleFocus);
|
|
213
|
+
inputElement.addEventListener("blur", handleBlur);
|
|
214
|
+
// Cleanup fonksiyonu
|
|
215
|
+
var destroy = function () {
|
|
216
|
+
inputElement.removeEventListener("input", handleInputChange);
|
|
217
|
+
inputElement.removeEventListener("keydown", handleKeyDown);
|
|
218
|
+
inputElement.removeEventListener("focus", handleFocus);
|
|
219
|
+
inputElement.removeEventListener("blur", handleBlur);
|
|
220
|
+
};
|
|
221
|
+
// Utility fonksiyonları
|
|
222
|
+
return {
|
|
223
|
+
destroy: destroy,
|
|
224
|
+
setValue: function (value) {
|
|
225
|
+
if (!value)
|
|
226
|
+
return;
|
|
227
|
+
var maskedValue = applyMaskToValue(value || "");
|
|
228
|
+
inputElement.value = maskedValue;
|
|
229
|
+
},
|
|
230
|
+
getValue: function () { return inputElement.value; },
|
|
231
|
+
getCleanValue: function () { return getCleanValue(inputElement.value); },
|
|
232
|
+
applyMask: applyMaskToValue
|
|
233
|
+
};
|
|
234
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export declare const onKeyboardSelection: ({ e, targetElement, itemClass, selectedClass, checkByValue, checkByInput, clear }: any) => null | undefined;
|
|
7
|
+
export declare function setScrollListPosition(targetElement: any): void;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export var onKeyboardSelection = function (_a) {
|
|
7
|
+
var e = _a.e, targetElement = _a.targetElement, _b = _a.itemClass, itemClass = _b === void 0 ? "item" : _b, _c = _a.selectedClass, selectedClass = _c === void 0 ? "selected" : _c, checkByValue = _a.checkByValue, checkByInput = _a.checkByInput, clear = _a.clear;
|
|
8
|
+
if (!targetElement.current)
|
|
9
|
+
return null;
|
|
10
|
+
var config = {
|
|
11
|
+
e: e,
|
|
12
|
+
itemClass: itemClass,
|
|
13
|
+
selectedClass: selectedClass,
|
|
14
|
+
};
|
|
15
|
+
function selectEnter() {
|
|
16
|
+
if (!targetElement.current)
|
|
17
|
+
return null;
|
|
18
|
+
var text = targetElement.current.querySelector("".concat(config.itemClass, ".").concat(config.selectedClass));
|
|
19
|
+
if (text) {
|
|
20
|
+
checkByValue(text.dataset.value);
|
|
21
|
+
}
|
|
22
|
+
else if (targetElement.current.querySelectorAll("".concat(config.itemClass)).length > 0) {
|
|
23
|
+
var target = targetElement.current.querySelectorAll("".concat(config.itemClass, ".").concat(config.selectedClass))[0];
|
|
24
|
+
checkByValue(target.dataset.value);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
clear(true, true);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function selectFirst() {
|
|
31
|
+
if (!targetElement.current)
|
|
32
|
+
return null;
|
|
33
|
+
var showList = targetElement.current.querySelectorAll("".concat(config.itemClass));
|
|
34
|
+
if (showList.length > 0) {
|
|
35
|
+
showList[0].classList.add(config.selectedClass);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function selectLast() {
|
|
39
|
+
if (!targetElement.current)
|
|
40
|
+
return null;
|
|
41
|
+
var showList = targetElement.current.querySelectorAll("".concat(config.itemClass));
|
|
42
|
+
if (showList.length > 0) {
|
|
43
|
+
showList[showList.length - 1].classList.add(config.selectedClass);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function selectNext(element) {
|
|
47
|
+
element.classList.remove(config.selectedClass);
|
|
48
|
+
var next = element.nextElementSibling;
|
|
49
|
+
if (next && next.nodeType !== -1) {
|
|
50
|
+
if (next.classList.contains("item")) {
|
|
51
|
+
next.classList.add(config.selectedClass);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
selectNext(next);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
selectFirst();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function selectPrev(element) {
|
|
62
|
+
element.classList.remove(config.selectedClass);
|
|
63
|
+
var next = element.previousElementSibling;
|
|
64
|
+
if (next && next.nodeType !== -1) {
|
|
65
|
+
if (next.classList.contains("item")) {
|
|
66
|
+
next.classList.add(config.selectedClass);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
selectPrev(next);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
selectLast();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
var selected = targetElement.current.querySelector("".concat(config.itemClass, ".").concat(config.selectedClass));
|
|
77
|
+
if (e.which == 40) {
|
|
78
|
+
if (selected) {
|
|
79
|
+
selectNext(selected);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
selectFirst();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (e.which == 38) {
|
|
86
|
+
if (selected) {
|
|
87
|
+
selectPrev(selected);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
selectLast();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (e.which == 35) {
|
|
94
|
+
selectLast();
|
|
95
|
+
}
|
|
96
|
+
else if (e.which == 36) {
|
|
97
|
+
selectFirst();
|
|
98
|
+
}
|
|
99
|
+
else if (e.which == 13) {
|
|
100
|
+
selectEnter();
|
|
101
|
+
}
|
|
102
|
+
else if (e.which == 9) {
|
|
103
|
+
checkByInput();
|
|
104
|
+
}
|
|
105
|
+
setScrollListPosition(targetElement);
|
|
106
|
+
};
|
|
107
|
+
export function setScrollListPosition(targetElement) {
|
|
108
|
+
if (targetElement.current) {
|
|
109
|
+
var position = 0;
|
|
110
|
+
var text = targetElement.current.querySelector(".selected");
|
|
111
|
+
if (text) {
|
|
112
|
+
position = text.offsetTop - 35;
|
|
113
|
+
}
|
|
114
|
+
else if (targetElement.current.querySelector(".active")) {
|
|
115
|
+
position = targetElement.current.querySelector(".active").offsetTop - 35;
|
|
116
|
+
}
|
|
117
|
+
targetElement.current.scrollTop = position;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export declare const cerezOku: (context: any | null | undefined, key: string) => string | false;
|
|
7
|
+
export declare const cerezKaydet: (context: any | null | undefined, key: string, value: string, time?: number) => void;
|
|
8
|
+
export declare const cerezSil: (context: any | null | undefined, key: string) => void;
|
|
9
|
+
export declare const cerezTumuSil: (context?: any | null) => void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
import { __assign } from "tslib";
|
|
7
|
+
import nookies, { destroyCookie, parseCookies, setCookie } from 'nookies';
|
|
8
|
+
import { getDomain } from '../baseFunctions';
|
|
9
|
+
export var cerezOku = function (context, key) {
|
|
10
|
+
if (context === void 0) { context = null; }
|
|
11
|
+
var cookies = context ? nookies.get(context) : parseCookies();
|
|
12
|
+
return cookies[key] || false;
|
|
13
|
+
};
|
|
14
|
+
export var cerezKaydet = function (context, key, value, time) {
|
|
15
|
+
if (context === void 0) { context = null; }
|
|
16
|
+
if (time === void 0) { time = 0; }
|
|
17
|
+
var newConfig = checkDomain(context);
|
|
18
|
+
setCookie(context, key, value, __assign({ maxAge: time > 0 ? time : null }, newConfig));
|
|
19
|
+
};
|
|
20
|
+
export var cerezSil = function (context, key) {
|
|
21
|
+
if (context === void 0) { context = null; }
|
|
22
|
+
var newConfig = checkDomain(context);
|
|
23
|
+
destroyCookie(context, key, newConfig);
|
|
24
|
+
};
|
|
25
|
+
export var cerezTumuSil = function (context) {
|
|
26
|
+
if (context === void 0) { context = null; }
|
|
27
|
+
var cookies = parseCookies(context);
|
|
28
|
+
if (cookies) {
|
|
29
|
+
Object.keys(cookies).forEach(function (key) {
|
|
30
|
+
destroyCookie(context, key);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var checkDomain = function (context, config) {
|
|
35
|
+
if (context === void 0) { context = null; }
|
|
36
|
+
if (config === void 0) { config = {}; }
|
|
37
|
+
var cookieDomain = getDomain(context);
|
|
38
|
+
return __assign(__assign({}, config), { domain: '.' + cookieDomain, path: '/' });
|
|
39
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export declare const encData: (data: object | string | number, keys?: number[]) => string;
|
|
7
|
+
export declare const decData: (data: string, keys?: number[]) => any;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
import { isDev } from "../baseFunctions";
|
|
7
|
+
var encDecDataKeys = [3, 5, 8, 11, 15, 22];
|
|
8
|
+
export var encData = function (data, keys) {
|
|
9
|
+
if (keys === void 0) { keys = encDecDataKeys; }
|
|
10
|
+
try {
|
|
11
|
+
var newJSON = { data: data };
|
|
12
|
+
var utf8Data = unescape(encodeURIComponent(JSON.stringify(newJSON))); // Dizeyi UTF-8'e dönüştür
|
|
13
|
+
var newData_1 = btoa(utf8Data);
|
|
14
|
+
keys.map(function (value) {
|
|
15
|
+
var randomChar = String.fromCharCode(Math.floor(Math.random() * (122 - 97 + 1)) + 97);
|
|
16
|
+
newData_1 = newData_1.slice(0, value) + randomChar + newData_1.slice(value);
|
|
17
|
+
});
|
|
18
|
+
return newData_1;
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
isDev && console.log("ERROR => encData =>", e);
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export var decData = function (data, keys) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (keys === void 0) { keys = encDecDataKeys; }
|
|
28
|
+
try {
|
|
29
|
+
var decode_1 = data;
|
|
30
|
+
keys.map(function (value, index) {
|
|
31
|
+
var prevValue = keys[index - 1];
|
|
32
|
+
if (!prevValue) {
|
|
33
|
+
decode_1 = decode_1.slice(0, value) + decode_1.slice(value + 1);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
decode_1 = decode_1.slice(0, value - index) + decode_1.slice(value - index + 1);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
var decodedString = atob(decode_1);
|
|
40
|
+
var utf8DecodedString = decodeURIComponent(escape(decodedString));
|
|
41
|
+
var parse = JSON.parse(utf8DecodedString);
|
|
42
|
+
return (_a = parse === null || parse === void 0 ? void 0 : parse.data) !== null && _a !== void 0 ? _a : "";
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
isDev && console.log("ERROR => decData =>", e);
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author : izzetseydaoglu
|
|
3
|
+
* @copyright : sydSOFT Bilişim Hizmetleri (c) 2026
|
|
4
|
+
* @version : 2026-02-10 20:23:07
|
|
5
|
+
*/
|
|
6
|
+
export declare const setLocalStorage: (key: string, value: any) => boolean;
|
|
7
|
+
export declare const getLocalStorage: (key: string) => any;
|
|
8
|
+
export declare const removeLocalStorage: (key: string) => boolean;
|
|
9
|
+
export declare const clearLocalStorage: () => boolean;
|
|
10
|
+
export declare const getLocalStorageAllKeys: () => string[];
|
|
11
|
+
export declare const getLocalStorageSize: () => number;
|