@sydsoft/base 1.53.0 → 1.56.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 → dist/esm}/_lib/baseFunctions.js +11 -24
- package/{_dist → dist/esm}/_lib/inputMask.js +3 -7
- package/{_dist → dist/esm}/_lib/listFunctions.js +2 -7
- package/dist/esm/_lib/storage/cookies.js +34 -0
- package/{_dist → dist/esm}/_lib/storage/encData.js +5 -10
- package/dist/esm/_lib/storage/localStorage.js +69 -0
- package/dist/esm/_lib/storage/sessionStorage.js +69 -0
- package/{_dist → dist/esm}/_lib/useInterval.js +5 -8
- package/{_dist → dist/esm}/alert/index.js +13 -22
- package/dist/esm/box/Box.js +15 -0
- package/dist/esm/box/BoxContent.js +7 -0
- package/dist/esm/box/BoxFooter.js +8 -0
- package/dist/esm/box/BoxHeader.js +9 -0
- package/dist/esm/box/index.js +9 -0
- package/{_dist → dist/esm}/countDown/index.js +12 -17
- package/{_dist → dist/esm}/dateTime/index.js +1 -3
- package/dist/esm/form/Button.js +76 -0
- package/dist/esm/form/Checkbox.js +23 -0
- package/dist/esm/form/Dialog.js +40 -0
- package/dist/esm/form/Form.js +12 -0
- package/{_dist → dist/esm}/form/FormOlustur.js +19 -22
- package/{_dist → dist/esm}/form/Input.js +45 -49
- package/dist/esm/form/Label.js +9 -0
- package/{_dist → dist/esm}/form/SearchableInput.js +45 -48
- package/{_dist → dist/esm}/form/UploadBase.js +16 -21
- package/dist/esm/form/index.js +9 -0
- package/dist/esm/grid/index.js +97 -0
- package/dist/esm/icon/icons.js +23 -0
- package/dist/esm/icon/index.js +26 -0
- package/dist/esm/icon/mui.js +1 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/menu/index.js +52 -0
- package/{_dist → dist/esm}/modal/index.js +13 -16
- package/{_dist → dist/esm}/popover/index.js +36 -39
- package/{_dist → dist/esm}/tooltip/index.js +6 -9
- package/package.json +8 -13
- package/_dist/_lib/storage/cookies.js +0 -41
- package/_dist/_lib/storage/localStorage.js +0 -78
- package/_dist/_lib/storage/sessionStorage.js +0 -78
- package/_dist/box/Box.js +0 -19
- package/_dist/box/BoxContent.js +0 -11
- package/_dist/box/BoxFooter.js +0 -11
- package/_dist/box/BoxHeader.js +0 -12
- package/_dist/box/index.js +0 -12
- package/_dist/form/Button.js +0 -79
- package/_dist/form/Checkbox.js +0 -28
- package/_dist/form/Dialog.js +0 -44
- package/_dist/form/Form.js +0 -15
- package/_dist/form/Label.js +0 -12
- package/_dist/form/index.js +0 -12
- package/_dist/grid/index.js +0 -104
- package/_dist/icon/icons.js +0 -26
- package/_dist/icon/index.js +0 -30
- package/_dist/icon/mui.js +0 -2
- package/_dist/index.js +0 -22
- package/_dist/menu/index.js +0 -55
- /package/{_dist → dist/esm}/_lib/baseFunctions.d.ts +0 -0
- /package/{_dist → dist/esm}/_lib/inputMask.d.ts +0 -0
- /package/{_dist → dist/esm}/_lib/listFunctions.d.ts +0 -0
- /package/{_dist → dist/esm}/_lib/storage/cookies.d.ts +0 -0
- /package/{_dist → dist/esm}/_lib/storage/encData.d.ts +0 -0
- /package/{_dist → dist/esm}/_lib/storage/localStorage.d.ts +0 -0
- /package/{_dist → dist/esm}/_lib/storage/sessionStorage.d.ts +0 -0
- /package/{_dist → dist/esm}/_lib/useInterval.d.ts +0 -0
- /package/{_dist → dist/esm}/alert/index.d.ts +0 -0
- /package/{_dist → dist/esm}/alert/index.module.css +0 -0
- /package/{_dist → dist/esm}/box/Box.d.ts +0 -0
- /package/{_dist → dist/esm}/box/Box.module.css +0 -0
- /package/{_dist → dist/esm}/box/BoxContent.d.ts +0 -0
- /package/{_dist → dist/esm}/box/BoxFooter.d.ts +0 -0
- /package/{_dist → dist/esm}/box/BoxHeader.d.ts +0 -0
- /package/{_dist → dist/esm}/box/index.d.ts +0 -0
- /package/{_dist → dist/esm}/countDown/index.d.ts +0 -0
- /package/{_dist → dist/esm}/dateTime/index.d.ts +0 -0
- /package/{_dist → dist/esm}/form/Button.d.ts +0 -0
- /package/{_dist → dist/esm}/form/Checkbox.d.ts +0 -0
- /package/{_dist → dist/esm}/form/Dialog.d.ts +0 -0
- /package/{_dist → dist/esm}/form/Form.d.ts +0 -0
- /package/{_dist → dist/esm}/form/FormOlustur.d.ts +0 -0
- /package/{_dist → dist/esm}/form/Input.d.ts +0 -0
- /package/{_dist → dist/esm}/form/Label.d.ts +0 -0
- /package/{_dist → dist/esm}/form/SearchableInput.d.ts +0 -0
- /package/{_dist → dist/esm}/form/UploadBase.d.ts +0 -0
- /package/{_dist → dist/esm}/form/index.d.ts +0 -0
- /package/{_dist → dist/esm}/form/styles/Button.module.css +0 -0
- /package/{_dist → dist/esm}/form/styles/Input.module.css +0 -0
- /package/{_dist → dist/esm}/form/styles/Label.module.css +0 -0
- /package/{_dist → dist/esm}/form/styles/SearchableInput.module.css +0 -0
- /package/{_dist → dist/esm}/grid/index.d.ts +0 -0
- /package/{_dist → dist/esm}/grid/index.module.css +0 -0
- /package/{_dist → dist/esm}/icon/icons.d.ts +0 -0
- /package/{_dist → dist/esm}/icon/index.d.ts +0 -0
- /package/{_dist → dist/esm}/icon/mui.d.ts +0 -0
- /package/{_dist → dist/esm}/index.d.ts +0 -0
- /package/{_dist → dist/esm}/menu/index.d.ts +0 -0
- /package/{_dist → dist/esm}/menu/index.module.css +0 -0
- /package/{_dist → dist/esm}/modal/index.d.ts +0 -0
- /package/{_dist → dist/esm}/modal/index.module.css +0 -0
- /package/{_dist → dist/esm}/popover/index.d.ts +0 -0
- /package/{_dist → dist/esm}/popover/index.module.css +0 -0
- /package/{_dist → dist/esm}/tooltip/index.d.ts +0 -0
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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) {
|
|
1
|
+
export var isDev = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
|
|
2
|
+
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')); };
|
|
3
|
+
export var sleep = function (ms) {
|
|
12
4
|
if (ms === void 0) { ms = 1000; }
|
|
13
5
|
return new Promise(function (resolve) { return setTimeout(resolve, ms); });
|
|
14
6
|
};
|
|
15
|
-
|
|
16
|
-
var padNumber = function (num, padLength, padString) {
|
|
7
|
+
export var padNumber = function (num, padLength, padString) {
|
|
17
8
|
if (padLength === void 0) { padLength = 2; }
|
|
18
9
|
if (padString === void 0) { padString = '0'; }
|
|
19
10
|
return String(num).padStart(padLength, padString);
|
|
20
11
|
};
|
|
21
|
-
|
|
22
|
-
function inputTumuBuyukCevir(e) {
|
|
12
|
+
export function inputTumuBuyukCevir(e) {
|
|
23
13
|
var _a;
|
|
24
14
|
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
15
|
var start = e.target.selectionStart;
|
|
@@ -28,7 +18,7 @@ function inputTumuBuyukCevir(e) {
|
|
|
28
18
|
e.target.setSelectionRange(start, end);
|
|
29
19
|
}
|
|
30
20
|
}
|
|
31
|
-
function inputTumuKucukCevir(e) {
|
|
21
|
+
export function inputTumuKucukCevir(e) {
|
|
32
22
|
var _a;
|
|
33
23
|
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
24
|
var start = e.target.selectionStart;
|
|
@@ -37,12 +27,11 @@ function inputTumuKucukCevir(e) {
|
|
|
37
27
|
e.target.setSelectionRange(start, end);
|
|
38
28
|
}
|
|
39
29
|
}
|
|
40
|
-
var convertLowerCase = function (text) {
|
|
30
|
+
export var convertLowerCase = function (text) {
|
|
41
31
|
if (text === void 0) { text = ''; }
|
|
42
32
|
return text.toString().toLocaleLowerCase('tr-TR');
|
|
43
33
|
};
|
|
44
|
-
|
|
45
|
-
var convertForSearch = function (value) {
|
|
34
|
+
export var convertForSearch = function (value) {
|
|
46
35
|
var data = value === null || value === void 0 ? void 0 : value.toString().toLocaleLowerCase('tr-TR');
|
|
47
36
|
data = data.replace(/ö/g, 'o');
|
|
48
37
|
data = data.replace(/ç/g, 'c');
|
|
@@ -54,8 +43,7 @@ var convertForSearch = function (value) {
|
|
|
54
43
|
data = data.replace(/^\s+|\s+$/g, '');
|
|
55
44
|
return data;
|
|
56
45
|
};
|
|
57
|
-
|
|
58
|
-
function convertForSEO(e) {
|
|
46
|
+
export function convertForSEO(e) {
|
|
59
47
|
var _a;
|
|
60
48
|
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
49
|
var start = e.target.selectionStart;
|
|
@@ -74,7 +62,7 @@ function convertForSEO(e) {
|
|
|
74
62
|
e.target.setSelectionRange(start, end);
|
|
75
63
|
}
|
|
76
64
|
}
|
|
77
|
-
function getDomain(context) {
|
|
65
|
+
export function getDomain(context) {
|
|
78
66
|
if (context === void 0) { context = null; }
|
|
79
67
|
var url = '';
|
|
80
68
|
if (context) {
|
|
@@ -98,7 +86,7 @@ function getDomain(context) {
|
|
|
98
86
|
}
|
|
99
87
|
return url;
|
|
100
88
|
}
|
|
101
|
-
var uniqueID = function (key, length) {
|
|
89
|
+
export var uniqueID = function (key, length) {
|
|
102
90
|
if (key === void 0) { key = ''; }
|
|
103
91
|
if (length === void 0) { length = 16; }
|
|
104
92
|
return (key +
|
|
@@ -107,4 +95,3 @@ var uniqueID = function (key, length) {
|
|
|
107
95
|
.toString()
|
|
108
96
|
.replace('.', '')));
|
|
109
97
|
};
|
|
110
|
-
exports.uniqueID = uniqueID;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyInputMask = void 0;
|
|
4
|
-
var baseFunctions_1 = require("./baseFunctions");
|
|
1
|
+
import { isDev } from "./baseFunctions";
|
|
5
2
|
// Mask işleme core fonksiyonları
|
|
6
3
|
var createMaskCore = function () {
|
|
7
4
|
var defaultTranslation = {
|
|
@@ -144,11 +141,11 @@ var createMaskCore = function () {
|
|
|
144
141
|
};
|
|
145
142
|
};
|
|
146
143
|
// Fonksiyonel yaklaşım - herhangi bir input elementine mask uygula
|
|
147
|
-
var applyInputMask = function (inputElement, mask, options) {
|
|
144
|
+
export var applyInputMask = function (inputElement, mask, options) {
|
|
148
145
|
if (options === void 0) { options = {}; }
|
|
149
146
|
if (!inputElement || !mask)
|
|
150
147
|
return null;
|
|
151
|
-
|
|
148
|
+
isDev && console.log("Input mask applied:", { inputElement: inputElement, mask: mask, options: options });
|
|
152
149
|
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
150
|
var maskCore = createMaskCore();
|
|
154
151
|
var maskTokens = maskCore.parseMask(mask, translation);
|
|
@@ -230,4 +227,3 @@ var applyInputMask = function (inputElement, mask, options) {
|
|
|
230
227
|
applyMask: applyMaskToValue
|
|
231
228
|
};
|
|
232
229
|
};
|
|
233
|
-
exports.applyInputMask = applyInputMask;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.onKeyboardSelection = void 0;
|
|
4
|
-
exports.setScrollListPosition = setScrollListPosition;
|
|
5
|
-
var onKeyboardSelection = function (_a) {
|
|
1
|
+
export var onKeyboardSelection = function (_a) {
|
|
6
2
|
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
3
|
if (!targetElement.current)
|
|
8
4
|
return null;
|
|
@@ -103,8 +99,7 @@ var onKeyboardSelection = function (_a) {
|
|
|
103
99
|
}
|
|
104
100
|
setScrollListPosition(targetElement);
|
|
105
101
|
};
|
|
106
|
-
|
|
107
|
-
function setScrollListPosition(targetElement) {
|
|
102
|
+
export function setScrollListPosition(targetElement) {
|
|
108
103
|
if (targetElement.current) {
|
|
109
104
|
var position = 0;
|
|
110
105
|
var text = targetElement.current.querySelector(".selected");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import nookies, { destroyCookie, parseCookies, setCookie } from 'nookies';
|
|
3
|
+
import { getDomain } from '../baseFunctions';
|
|
4
|
+
export var cerezOku = function (context, key) {
|
|
5
|
+
if (context === void 0) { context = null; }
|
|
6
|
+
var cookies = context ? nookies.get(context) : parseCookies();
|
|
7
|
+
return cookies[key] || false;
|
|
8
|
+
};
|
|
9
|
+
export var cerezKaydet = function (context, key, value, time) {
|
|
10
|
+
if (context === void 0) { context = null; }
|
|
11
|
+
if (time === void 0) { time = 0; }
|
|
12
|
+
var newConfig = checkDomain(context);
|
|
13
|
+
setCookie(context, key, value, __assign({ maxAge: time > 0 ? time : null }, newConfig));
|
|
14
|
+
};
|
|
15
|
+
export var cerezSil = function (context, key) {
|
|
16
|
+
if (context === void 0) { context = null; }
|
|
17
|
+
var newConfig = checkDomain(context);
|
|
18
|
+
destroyCookie(context, key, newConfig);
|
|
19
|
+
};
|
|
20
|
+
export var cerezTumuSil = function (context) {
|
|
21
|
+
if (context === void 0) { context = null; }
|
|
22
|
+
var cookies = parseCookies(context);
|
|
23
|
+
if (cookies) {
|
|
24
|
+
Object.keys(cookies).forEach(function (key) {
|
|
25
|
+
destroyCookie(context, key);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var checkDomain = function (context, config) {
|
|
30
|
+
if (context === void 0) { context = null; }
|
|
31
|
+
if (config === void 0) { config = {}; }
|
|
32
|
+
var cookieDomain = getDomain(context);
|
|
33
|
+
return __assign(__assign({}, config), { domain: '.' + cookieDomain, path: '/' });
|
|
34
|
+
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decData = exports.encData = void 0;
|
|
4
|
-
var baseFunctions_1 = require("../baseFunctions");
|
|
1
|
+
import { isDev } from "../baseFunctions";
|
|
5
2
|
var encDecDataKeys = [3, 5, 8, 11, 15, 22];
|
|
6
|
-
var encData = function (data, keys) {
|
|
3
|
+
export var encData = function (data, keys) {
|
|
7
4
|
if (keys === void 0) { keys = encDecDataKeys; }
|
|
8
5
|
try {
|
|
9
6
|
var newJSON = { data: data };
|
|
@@ -16,12 +13,11 @@ var encData = function (data, keys) {
|
|
|
16
13
|
return newData_1;
|
|
17
14
|
}
|
|
18
15
|
catch (e) {
|
|
19
|
-
|
|
16
|
+
isDev && console.log("ERROR => encData =>", e);
|
|
20
17
|
return "";
|
|
21
18
|
}
|
|
22
19
|
};
|
|
23
|
-
|
|
24
|
-
var decData = function (data, keys) {
|
|
20
|
+
export var decData = function (data, keys) {
|
|
25
21
|
var _a;
|
|
26
22
|
if (keys === void 0) { keys = encDecDataKeys; }
|
|
27
23
|
try {
|
|
@@ -41,8 +37,7 @@ var decData = function (data, keys) {
|
|
|
41
37
|
return (_a = parse === null || parse === void 0 ? void 0 : parse.data) !== null && _a !== void 0 ? _a : "";
|
|
42
38
|
}
|
|
43
39
|
catch (e) {
|
|
44
|
-
|
|
40
|
+
isDev && console.log("ERROR => decData =>", e);
|
|
45
41
|
return "";
|
|
46
42
|
}
|
|
47
43
|
};
|
|
48
|
-
exports.decData = decData;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { decData, encData } from './encData';
|
|
2
|
+
import { isDev } from '../baseFunctions';
|
|
3
|
+
var storageAvailable = typeof Storage === 'undefined' || !window.localStorage ? false : true;
|
|
4
|
+
export var setLocalStorage = function (key, value) {
|
|
5
|
+
if (!storageAvailable)
|
|
6
|
+
return false;
|
|
7
|
+
try {
|
|
8
|
+
localStorage.setItem(key, encData(value));
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
isDev && console.log('ERROR => localStorage =>', e);
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export var getLocalStorage = function (key) {
|
|
17
|
+
if (!storageAvailable)
|
|
18
|
+
return false;
|
|
19
|
+
try {
|
|
20
|
+
var saved = localStorage.getItem(key);
|
|
21
|
+
return saved ? decData(saved) : null;
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
isDev && console.log('ERROR => localStorage =>', e);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export var removeLocalStorage = function (key) {
|
|
29
|
+
if (!storageAvailable)
|
|
30
|
+
return false;
|
|
31
|
+
try {
|
|
32
|
+
localStorage.removeItem(key);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
isDev && console.log('ERROR => localStorage =>', e);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export var clearLocalStorage = function () {
|
|
41
|
+
if (!storageAvailable)
|
|
42
|
+
return false;
|
|
43
|
+
try {
|
|
44
|
+
localStorage.clear();
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
isDev && console.log('ERROR => localStorage =>', e);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
// Tüm localStorage anahtarlarını getir
|
|
53
|
+
export var getLocalStorageAllKeys = function () {
|
|
54
|
+
if (!storageAvailable)
|
|
55
|
+
return [];
|
|
56
|
+
return Object.keys(localStorage);
|
|
57
|
+
};
|
|
58
|
+
// Tüm localStorage boyutunu getir
|
|
59
|
+
export var getLocalStorageSize = function () {
|
|
60
|
+
if (!storageAvailable)
|
|
61
|
+
return 0;
|
|
62
|
+
var total = 0;
|
|
63
|
+
for (var key in localStorage) {
|
|
64
|
+
if (localStorage.hasOwnProperty(key)) {
|
|
65
|
+
total += localStorage[key].length + key.length;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return total;
|
|
69
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { decData, encData } from "./encData";
|
|
2
|
+
import { isDev } from "../baseFunctions";
|
|
3
|
+
var storageAvailable = typeof Storage === "undefined" || !window.sessionStorage ? false : true;
|
|
4
|
+
export var setSessionStorage = function (key, value) {
|
|
5
|
+
if (!storageAvailable)
|
|
6
|
+
return false;
|
|
7
|
+
try {
|
|
8
|
+
sessionStorage.setItem(key, encData(value));
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
isDev && console.log("ERROR => SessionStorage =>", e);
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export var getSessionStorage = function (key) {
|
|
17
|
+
if (!storageAvailable)
|
|
18
|
+
return false;
|
|
19
|
+
try {
|
|
20
|
+
var saved = sessionStorage.getItem(key);
|
|
21
|
+
return saved ? decData(saved) : null;
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
isDev && console.log("ERROR => SessionStorage =>", e);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export var removeSessionStorage = function (key) {
|
|
29
|
+
if (!storageAvailable)
|
|
30
|
+
return false;
|
|
31
|
+
try {
|
|
32
|
+
sessionStorage.removeItem(key);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
isDev && console.log("ERROR => SessionStorage =>", e);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export var clearSessionStorage = function () {
|
|
41
|
+
if (!storageAvailable)
|
|
42
|
+
return false;
|
|
43
|
+
try {
|
|
44
|
+
sessionStorage.clear();
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
isDev && console.log("ERROR => SessionStorage =>", e);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
// Tüm SessionStorage anahtarlarını getir
|
|
53
|
+
export var getSessionStorageAllKeys = function () {
|
|
54
|
+
if (!storageAvailable)
|
|
55
|
+
return [];
|
|
56
|
+
return Object.keys(sessionStorage);
|
|
57
|
+
};
|
|
58
|
+
// Tüm SessionStorage boyutunu getir
|
|
59
|
+
export var getSessionStorageSize = function () {
|
|
60
|
+
if (!storageAvailable)
|
|
61
|
+
return 0;
|
|
62
|
+
var total = 0;
|
|
63
|
+
for (var key in sessionStorage) {
|
|
64
|
+
if (sessionStorage.hasOwnProperty(key)) {
|
|
65
|
+
total += sessionStorage[key].length + key.length;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return total;
|
|
69
|
+
};
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Copyright (c) 2023
|
|
4
3
|
* @author: izzetseydaoglu
|
|
5
4
|
* @last-modified: 29.01.2024 04:09
|
|
6
5
|
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.useInterval = useInterval;
|
|
9
6
|
// source: https://overreacted.io/making-setinterval-declarative-with-react-hooks/
|
|
10
|
-
|
|
11
|
-
function useInterval(callback, delay) {
|
|
12
|
-
var savedCallback =
|
|
7
|
+
import { useEffect, useRef } from "react";
|
|
8
|
+
export function useInterval(callback, delay) {
|
|
9
|
+
var savedCallback = useRef(null);
|
|
13
10
|
// Remember the latest callback.
|
|
14
|
-
|
|
11
|
+
useEffect(function () {
|
|
15
12
|
savedCallback.current = callback;
|
|
16
13
|
}, [callback]);
|
|
17
14
|
// Set up the interval.
|
|
18
|
-
|
|
15
|
+
useEffect(function () {
|
|
19
16
|
function tick() {
|
|
20
17
|
savedCallback && savedCallback.current && savedCallback.current();
|
|
21
18
|
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
var react_1 = require("react");
|
|
8
|
-
var client_1 = require("react-dom/client");
|
|
9
|
-
var index_module_css_1 = tslib_1.__importDefault(require("./index.module.css"));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import styles from "./index.module.css";
|
|
10
5
|
var sAlertTimeout = [];
|
|
11
|
-
var Alert = function (_a) {
|
|
6
|
+
export var Alert = function (_a) {
|
|
12
7
|
var _b = _a.defaultTimer, defaultTimer = _b === void 0 ? "5000" : _b, _c = _a.defaultErrorTimer, defaultErrorTimer = _c === void 0 ? "10000" : _c, _d = _a.defaultSuccessTimer, defaultSuccessTimer = _d === void 0 ? "5000" : _d;
|
|
13
|
-
|
|
8
|
+
useEffect(function () {
|
|
14
9
|
if (typeof window === "undefined")
|
|
15
10
|
return;
|
|
16
11
|
var divCheck = document.getElementById("salert");
|
|
@@ -39,8 +34,7 @@ var Alert = function (_a) {
|
|
|
39
34
|
}, []);
|
|
40
35
|
return null;
|
|
41
36
|
};
|
|
42
|
-
|
|
43
|
-
var alert_add = function (_a) {
|
|
37
|
+
export var alert_add = function (_a) {
|
|
44
38
|
var _b, _c, _d;
|
|
45
39
|
var type = _a.type, message = _a.message, style = _a.style, timer = _a.timer;
|
|
46
40
|
if (typeof window === "undefined")
|
|
@@ -53,8 +47,8 @@ var alert_add = function (_a) {
|
|
|
53
47
|
if (mainDiv && alert_1 && mainDiv.contains(alert_1))
|
|
54
48
|
mainDiv.removeChild(alert_1);
|
|
55
49
|
};
|
|
56
|
-
var root =
|
|
57
|
-
var Component = ((
|
|
50
|
+
var root = createRoot(alert_1);
|
|
51
|
+
var Component = (_jsxs("div", { className: "".concat(styles.salert, " ").concat(styles[type]), style: style, children: [_jsx("div", { className: styles.message, dangerouslySetInnerHTML: { __html: message } }), _jsx("div", { className: styles.close, onClick: onClose_1, children: "\u2715" })] }));
|
|
58
52
|
root.render(Component);
|
|
59
53
|
var defaultTimer = (_b = mainDiv.getAttribute("defaulttimer")) !== null && _b !== void 0 ? _b : "5000";
|
|
60
54
|
var defaultErrorTimer = (_c = mainDiv.getAttribute("defaulterrortimer")) !== null && _c !== void 0 ? _c : "10000";
|
|
@@ -83,8 +77,7 @@ var alert_add = function (_a) {
|
|
|
83
77
|
}
|
|
84
78
|
return null;
|
|
85
79
|
};
|
|
86
|
-
|
|
87
|
-
var alert_remove = function (alert) {
|
|
80
|
+
export var alert_remove = function (alert) {
|
|
88
81
|
if (typeof window === "undefined" || !alert)
|
|
89
82
|
return;
|
|
90
83
|
var mainDiv = document.getElementById("salert");
|
|
@@ -92,8 +85,7 @@ var alert_remove = function (alert) {
|
|
|
92
85
|
mainDiv.removeChild(alert);
|
|
93
86
|
return;
|
|
94
87
|
};
|
|
95
|
-
|
|
96
|
-
var alert_clear = function () {
|
|
88
|
+
export var alert_clear = function () {
|
|
97
89
|
if (typeof window === "undefined")
|
|
98
90
|
return false;
|
|
99
91
|
sAlertTimeout.map(function (id) { return clearTimeout(id); });
|
|
@@ -102,11 +94,10 @@ var alert_clear = function () {
|
|
|
102
94
|
mainDiv.innerHTML = "";
|
|
103
95
|
return true;
|
|
104
96
|
};
|
|
105
|
-
|
|
106
|
-
function alertCheck(response) {
|
|
97
|
+
export function alertCheck(response) {
|
|
107
98
|
if (response.data && response.data["alert"]) {
|
|
108
99
|
response.data["alert"].map(function (alert) {
|
|
109
|
-
|
|
100
|
+
alert_add({
|
|
110
101
|
type: alert.type,
|
|
111
102
|
message: alert.message,
|
|
112
103
|
timer: alert.timer
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useEffect, useRef, useState } from "react";
|
|
3
|
+
import styles from "./Box.module.css";
|
|
4
|
+
export var Box = memo(function MemoFunction(_a) {
|
|
5
|
+
var children = _a.children, className = _a.className, style = _a.style, _b = _a.loading, loading = _b === void 0 ? false : _b;
|
|
6
|
+
var boxRef = useRef(null);
|
|
7
|
+
var _c = useState(false), hasContent = _c[0], setHasContent = _c[1];
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
if (!boxRef.current)
|
|
10
|
+
return;
|
|
11
|
+
var found = boxRef.current.querySelector(".sbox_content");
|
|
12
|
+
setHasContent(!!found);
|
|
13
|
+
}, [children]);
|
|
14
|
+
return (_jsxs("div", { ref: boxRef, className: "sbox ".concat(styles.sbox, " ").concat(className || ""), style: style, children: [(hasContent && children) || _jsx("div", { className: styles.content, children: children }), loading && (_jsx("div", { className: styles.loading, children: _jsx("div", { className: styles.loading_spinner }) }))] }));
|
|
15
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import styles from "./Box.module.css";
|
|
4
|
+
export var BoxContent = function (_a) {
|
|
5
|
+
var className = _a.className, style = _a.style, padding = _a.padding, children = _a.children;
|
|
6
|
+
return (_jsx("div", { className: "".concat(styles.content, " sbox_content ").concat(className || ""), style: __assign(__assign({}, style), { padding: padding }), children: children }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import styles from "./Box.module.css";
|
|
5
|
+
export var BoxFooter = memo(function FunctionMemo(_a) {
|
|
6
|
+
var children = _a.children, className = _a.className, style = _a.style, align = _a.align, marginTop = _a.marginTop;
|
|
7
|
+
return (_jsx("div", { className: "sbox_footer ".concat(styles.footer, " ").concat(className || ""), style: __assign({ marginTop: marginTop, justifyContent: align }, style), children: children }));
|
|
8
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import styles from './Box.module.css';
|
|
5
|
+
export var BoxHeader = memo(function FunctionMemo(_a) {
|
|
6
|
+
var children = _a.children, className = _a.className, title = _a.title, icon = _a.icon, menu = _a.menu, mainStyle = _a.mainStyle, iconStyle = _a.iconStyle, titleStyle = _a.titleStyle, menuStyle = _a.menuStyle, marginBottom = _a.marginBottom, _b = _a.component, component = _b === void 0 ? 'div' : _b;
|
|
7
|
+
var Comp = component;
|
|
8
|
+
return (_jsxs("div", { className: "sbox_header ".concat(styles.header, " ").concat(className || ''), style: __assign({ marginBottom: marginBottom }, mainStyle), children: [icon && (_jsx("div", { className: styles.icon, style: iconStyle, children: icon })), _jsx(Comp, { className: "sbox_title ".concat(styles.title), style: titleStyle, children: children || title }), menu && (_jsx("div", { className: styles.menu, style: menuStyle, children: menu }))] }));
|
|
9
|
+
});
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var react_2 = tslib_1.__importDefault(require("react"));
|
|
7
|
-
var useInterval_1 = require("../_lib/useInterval");
|
|
8
|
-
var useCountDown = function (_a) {
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useInterval } from '../_lib/useInterval';
|
|
4
|
+
export var useCountDown = function (_a) {
|
|
9
5
|
var _b = _a.autoStart, autoStart = _b === void 0 ? false : _b, onComplete = _a.onComplete, getStatus = _a.getStatus, targetTime = _a.targetTime, _c = _a.timerType, timerType = _c === void 0 ? 'countdown' : _c, _d = _a.countType, countType = _d === void 0 ? 'seconds' : _d, _e = _a.speed, speed = _e === void 0 ? 1000 : _e, hide = _a.hide;
|
|
10
|
-
var refCountDownRender =
|
|
11
|
-
var _f =
|
|
12
|
-
var _g =
|
|
13
|
-
var _h =
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
var refCountDownRender = useRef(null);
|
|
7
|
+
var _f = useState(timerType === 'datetime' || autoStart), enabled = _f[0], setEnabled = _f[1];
|
|
8
|
+
var _g = useState(0), timer = _g[0], setTimer = _g[1];
|
|
9
|
+
var _h = useState(typeof speed === 'number' && speed > 0 ? speed : 1000), timerSpeed = _h[0], setTimerSpeed = _h[1];
|
|
10
|
+
useEffect(function () { return prepareTimer(targetTime); }, [targetTime]);
|
|
11
|
+
useEffect(function () {
|
|
16
12
|
if (!hide)
|
|
17
13
|
render();
|
|
18
14
|
}, [timer]);
|
|
19
|
-
|
|
15
|
+
useInterval(function () {
|
|
20
16
|
if (enabled) {
|
|
21
17
|
if (timer <= 1) {
|
|
22
18
|
stopCountDown();
|
|
@@ -91,7 +87,7 @@ var useCountDown = function (_a) {
|
|
|
91
87
|
}
|
|
92
88
|
};
|
|
93
89
|
return {
|
|
94
|
-
ComponentCountDown: function (children) { return (hide ? null :
|
|
90
|
+
ComponentCountDown: function (children) { return (hide ? null : React.cloneElement(children, { ref: refCountDownRender })); },
|
|
95
91
|
startCountDown: function () { return setEnabled(true); },
|
|
96
92
|
stopCountDown: function () { return setEnabled(false); },
|
|
97
93
|
setTargetTime: function (targetTime) { return prepareTimer(targetTime); },
|
|
@@ -99,4 +95,3 @@ var useCountDown = function (_a) {
|
|
|
99
95
|
getChildrenRef: function () { return refCountDownRender.current || null; }
|
|
100
96
|
};
|
|
101
97
|
};
|
|
102
|
-
exports.useCountDown = useCountDown;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
var dateTime = /** @class */ (function () {
|
|
4
2
|
function dateTime(datetime, format) {
|
|
5
3
|
if (datetime === void 0) { datetime = null; }
|
|
@@ -75,4 +73,4 @@ var dateTime = /** @class */ (function () {
|
|
|
75
73
|
};
|
|
76
74
|
return dateTime;
|
|
77
75
|
}());
|
|
78
|
-
|
|
76
|
+
export default dateTime;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog } from "./Dialog";
|
|
4
|
+
import { memo, useCallback, useEffect, useState } from "react";
|
|
5
|
+
import { Tooltip } from "../tooltip";
|
|
6
|
+
import Link from "next/link";
|
|
7
|
+
import styles from "./styles/Button.module.css";
|
|
8
|
+
export var Button = memo(function MemoFunction(_a) {
|
|
9
|
+
var children = _a.children, _b = _a.component, component = _b === void 0 ? "button" : _b, className = _a.className, _c = _a.buttonClass, buttonClass = _c === void 0 ? "default" : _c, _d = _a.buttonSize, buttonSize = _d === void 0 ? "medium" : _d, style = _a.style, _e = _a.type, type = _e === void 0 ? "button" : _e, _f = _a.fullWidth, fullWidth = _f === void 0 ? false : _f, onlyIcon = _a.onlyIcon, onClick = _a.onClick, href = _a.href, target = _a.target, tabIndex = _a.tabIndex, title = _a.title, titlePosition = _a.titlePosition, titleArrow = _a.titleArrow, dialog = _a.dialog, autoFocus = _a.autoFocus, other = __rest(_a, ["children", "component", "className", "buttonClass", "buttonSize", "style", "type", "fullWidth", "onlyIcon", "onClick", "href", "target", "tabIndex", "title", "titlePosition", "titleArrow", "dialog", "autoFocus"]);
|
|
10
|
+
var Comp = component;
|
|
11
|
+
var ripple = function (e) {
|
|
12
|
+
var el = e.currentTarget;
|
|
13
|
+
var circle = document.createElement("span");
|
|
14
|
+
var diameter = Math.max(el.clientWidth, el.clientHeight);
|
|
15
|
+
circle.style.width = circle.style.height = "".concat(diameter, "px");
|
|
16
|
+
circle.classList.add(styles.ripple);
|
|
17
|
+
var ripple = el.getElementsByClassName(styles.ripple)[0];
|
|
18
|
+
if (ripple)
|
|
19
|
+
ripple.remove();
|
|
20
|
+
el.appendChild(circle);
|
|
21
|
+
};
|
|
22
|
+
var handleClick = function (e) {
|
|
23
|
+
ripple(e);
|
|
24
|
+
if (dialog) {
|
|
25
|
+
Dialog(dialog).then(function (result) {
|
|
26
|
+
if (result && onClick) {
|
|
27
|
+
onClick(e);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (onClick)
|
|
33
|
+
onClick(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var createClassList = useCallback(function () {
|
|
37
|
+
var list = ["sbutton", styles.button];
|
|
38
|
+
if (buttonClass)
|
|
39
|
+
list.push(styles[buttonClass]);
|
|
40
|
+
if (className)
|
|
41
|
+
list.push(className);
|
|
42
|
+
if (onlyIcon)
|
|
43
|
+
list.push(styles.iconbutton);
|
|
44
|
+
if (fullWidth)
|
|
45
|
+
list.push(styles.fullwidth);
|
|
46
|
+
return list.join(" ");
|
|
47
|
+
}, [buttonClass, className, onlyIcon, fullWidth]);
|
|
48
|
+
var _g = useState(function () { return createClassList(); }), classList = _g[0], setClassList = _g[1];
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
var newClassList = createClassList().split(" ").filter(Boolean);
|
|
51
|
+
if (href && typeof window !== "undefined" && window.location.pathname === href) {
|
|
52
|
+
newClassList.push("active");
|
|
53
|
+
}
|
|
54
|
+
setClassList(newClassList.join(" "));
|
|
55
|
+
}, [href, createClassList]);
|
|
56
|
+
var ortakProps = __assign({ className: classList, style: style, onClick: handleClick, tabIndex: tabIndex, autoFocus: autoFocus, "data-button-size": (!onlyIcon) ? buttonSize : null }, other);
|
|
57
|
+
var renderComponent;
|
|
58
|
+
if (href !== undefined) {
|
|
59
|
+
if (other === null || other === void 0 ? void 0 : other.hidden) {
|
|
60
|
+
renderComponent = null;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
var checkHref = (other === null || other === void 0 ? void 0 : other.disabled) ? "#" : href;
|
|
64
|
+
renderComponent = (_jsx(Link, { href: checkHref, target: (other === null || other === void 0 ? void 0 : other.disabled) ? "_self" : target, children: _jsx(Comp, __assign({}, ortakProps, { children: onlyIcon ? onlyIcon : children })) }));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
renderComponent = (_jsx(Comp, __assign({ type: type }, ortakProps, { children: onlyIcon ? onlyIcon : children })));
|
|
69
|
+
}
|
|
70
|
+
if (title && renderComponent) {
|
|
71
|
+
return (_jsx(Tooltip, { title: title, position: titlePosition, arrow: titleArrow, children: renderComponent }));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return renderComponent;
|
|
75
|
+
}
|
|
76
|
+
});
|