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