@sydsoft/base 1.27.0 → 1.28.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 +1 -0
- package/dist/esm/_lib/baseFunctions.js +34 -10
- package/dist/esm/_lib/index.d.ts +4 -0
- package/dist/esm/_lib/index.js +4 -0
- package/dist/esm/_lib/storage/cookies.d.ts +4 -0
- package/dist/esm/_lib/storage/cookies.js +34 -0
- package/dist/esm/form/Input.js +2 -2
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/package.json +3 -2
|
@@ -3,3 +3,4 @@ export declare const isDev: boolean;
|
|
|
3
3
|
export declare function tumuBuyukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
4
4
|
export declare function tumuKucukCevir(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
5
5
|
export declare function seoCevirFunction(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
6
|
+
export declare function getDomain(context?: any): string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export var isDev = !process.env.NODE_ENV || process.env.NODE_ENV ===
|
|
1
|
+
export var isDev = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
|
|
2
2
|
export function tumuBuyukCevir(e) {
|
|
3
3
|
var _a;
|
|
4
4
|
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)) {
|
|
5
5
|
var start = e.target.selectionStart;
|
|
6
6
|
var end = e.target.selectionEnd;
|
|
7
|
-
e.target.value = e.target.value.toString().toLocaleUpperCase(
|
|
7
|
+
e.target.value = e.target.value.toString().toLocaleUpperCase('tr');
|
|
8
8
|
e.target.setSelectionRange(start, end);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -13,7 +13,7 @@ export function tumuKucukCevir(e) {
|
|
|
13
13
|
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)) {
|
|
14
14
|
var start = e.target.selectionStart;
|
|
15
15
|
var end = e.target.selectionEnd;
|
|
16
|
-
e.target.value = e.target.value.toString().toLocaleLowerCase(
|
|
16
|
+
e.target.value = e.target.value.toString().toLocaleLowerCase('tr');
|
|
17
17
|
e.target.setSelectionRange(start, end);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -22,17 +22,41 @@ export function seoCevirFunction(e) {
|
|
|
22
22
|
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)) {
|
|
23
23
|
var start = e.target.selectionStart;
|
|
24
24
|
var end = e.target.selectionEnd;
|
|
25
|
-
var string = e.target.value.toString().toLocaleLowerCase(
|
|
26
|
-
var turkce = [
|
|
27
|
-
var duzgun = [
|
|
25
|
+
var string = e.target.value.toString().toLocaleLowerCase('tr');
|
|
26
|
+
var turkce = [' ', '-', 'ş', 'Ş', 'ı', 'ü', 'Ü', 'ö', 'Ö', 'ç', 'Ç', 'ş', 'Ş', 'ı', 'ğ', 'Ğ', 'İ', 'ö', 'Ö', 'Ç', 'ç', 'ü', 'Ü', 'â', 'ê', 'Â', '“', '”'];
|
|
27
|
+
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', '', ''];
|
|
28
28
|
for (var i = 0; i < turkce.length; i++) {
|
|
29
29
|
string = string.split(turkce[i]).join(duzgun[i]);
|
|
30
30
|
}
|
|
31
|
-
string = string.replace(/[^a-z0-9\-_şıüğçİŞĞÜÇ]+/gi,
|
|
32
|
-
string = string.replace(/_+/g,
|
|
33
|
-
string = string.replace(/^-/,
|
|
34
|
-
string = string.replace(/-$/,
|
|
31
|
+
string = string.replace(/[^a-z0-9\-_şıüğçİŞĞÜÇ]+/gi, '_');
|
|
32
|
+
string = string.replace(/_+/g, '_');
|
|
33
|
+
string = string.replace(/^-/, '_');
|
|
34
|
+
string = string.replace(/-$/, '_');
|
|
35
35
|
e.target.value = string;
|
|
36
36
|
e.target.setSelectionRange(start, end);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
export function getDomain(context) {
|
|
40
|
+
if (context === void 0) { context = null; }
|
|
41
|
+
var url = "";
|
|
42
|
+
if (context) {
|
|
43
|
+
url = context.req.headers.host;
|
|
44
|
+
}
|
|
45
|
+
else if (typeof window !== "undefined") {
|
|
46
|
+
url = window.location.hostname;
|
|
47
|
+
}
|
|
48
|
+
if (url.length) {
|
|
49
|
+
var parts = url.split('.').reverse();
|
|
50
|
+
var cnt = parts.length;
|
|
51
|
+
if (cnt >= 3) {
|
|
52
|
+
// see if the second level domain is a common SLD.
|
|
53
|
+
if (parts[1].match(/^(com|edu|gov|net|mil|org|nom|co|name|info|biz)$/i)) {
|
|
54
|
+
var domain_1 = parts[2] + '.' + parts[1] + '.' + parts[0];
|
|
55
|
+
return domain_1.split(":")[0];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
var domain = parts[1] + '.' + parts[0];
|
|
59
|
+
return domain.split(":")[0];
|
|
60
|
+
}
|
|
61
|
+
return url;
|
|
62
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const cerezOku: (context: any | null, key: string) => string | false;
|
|
2
|
+
export declare const cerezKaydet: (context: any | null, key: string, value: string, time?: number) => void;
|
|
3
|
+
export declare const cerezSil: (context: any | null, key: string) => void;
|
|
4
|
+
export declare const cerezTumuSil: (context?: any | null) => void;
|
|
@@ -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
|
+
};
|
package/dist/esm/form/Input.js
CHANGED
|
@@ -2,9 +2,9 @@ import { __assign } from "tslib";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { seoCevirFunction, tumuBuyukCevir, tumuKucukCevir } from "../_lib/baseFunctions";
|
|
5
|
-
import { Dialog } from "./Dialog";
|
|
6
|
-
import { alert_add } from "../alert";
|
|
7
5
|
import { applyInputMask } from "../_lib/inputMask";
|
|
6
|
+
import { alert_add } from "../alert";
|
|
7
|
+
import { Dialog } from "./Dialog";
|
|
8
8
|
import styles from "./styles/Input.module.css";
|
|
9
9
|
export var Input = function (_a) {
|
|
10
10
|
var componentRef = _a.componentRef, inputRef = _a.inputRef, className = _a.className, propsComponent = _a.propsComponent, propsInput = _a.propsInput, id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, type = _a.type, label = _a.label, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, placeholder = _a.placeholder, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, onClick = _a.onClick, onKeyPress = _a.onKeyPress, onKeyUp = _a.onKeyUp, onKeyDown = _a.onKeyDown, disabled = _a.disabled, required = _a.required, loading = _a.loading, autoFocus = _a.autoFocus, select = _a.select, _b = _a.valueKey, valueKey = _b === void 0 ? "value" : _b, _c = _a.labelKey, labelKey = _c === void 0 ? "label" : _c, ilkSec = _a.ilkSec, multiline = _a.multiline, rows = _a.rows, sadeceYazi = _a.sadeceYazi, sadeceSayi = _a.sadeceSayi, tumuBuyuk = _a.tumuBuyuk, tumuKucuk = _a.tumuKucuk, seoCevir = _a.seoCevir, dosyaNoGiris = _a.dosyaNoGiris, fileNameGiris = _a.fileNameGiris, dateGecmisKontrol = _a.dateGecmisKontrol, autoSelectText = _a.autoSelectText, _d = _a.mask, mask = _d === void 0 ? "" : _d, _e = _a.maskSettings, maskSettings = _e === void 0 ? {
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sydsoft/base",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.28.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
7
7
|
"module": "./dist/esm/index.js",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"homepage": "https://github.com/izzetseydaoglu/sydsoft.com.tr-packages/#readme",
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=18",
|
|
33
|
-
"react-dom": ">=18"
|
|
33
|
+
"react-dom": ">=18",
|
|
34
|
+
"nookies": "^2.5.2"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/react": "^18",
|