@sydsoft/base 1.50.0 → 1.52.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.
Files changed (101) hide show
  1. package/_dist/{_lib → esm/_lib}/baseFunctions.js +38 -25
  2. package/_dist/{_lib → esm/_lib}/inputMask.js +69 -66
  3. package/_dist/{_lib → esm/_lib}/listFunctions.js +13 -12
  4. package/_dist/esm/_lib/storage/cookies.js +34 -0
  5. package/_dist/esm/_lib/storage/encData.js +43 -0
  6. package/_dist/{_lib → esm/_lib}/storage/localStorage.js +10 -10
  7. package/_dist/{_lib → esm/_lib}/storage/sessionStorage.js +10 -10
  8. package/_dist/{_lib → esm/_lib}/useInterval.js +5 -5
  9. package/_dist/{alert → esm/alert}/index.js +30 -28
  10. package/_dist/esm/box/Box.js +15 -0
  11. package/_dist/esm/box/BoxContent.js +7 -0
  12. package/_dist/esm/box/BoxFooter.js +8 -0
  13. package/_dist/esm/box/BoxHeader.js +9 -0
  14. package/_dist/esm/countDown/index.js +97 -0
  15. package/_dist/{dateTime → esm/dateTime}/index.js +31 -25
  16. package/_dist/esm/form/Button.js +76 -0
  17. package/_dist/esm/form/Checkbox.js +23 -0
  18. package/_dist/esm/form/Dialog.js +40 -0
  19. package/_dist/esm/form/Form.js +12 -0
  20. package/_dist/esm/form/FormOlustur.js +52 -0
  21. package/_dist/{form → esm/form}/Input.js +56 -57
  22. package/_dist/esm/form/Label.js +9 -0
  23. package/_dist/esm/form/SearchableInput.js +272 -0
  24. package/_dist/esm/form/UploadBase.js +86 -0
  25. package/_dist/esm/grid/index.js +97 -0
  26. package/_dist/{icon → esm/icon}/icons.js +1 -1
  27. package/_dist/esm/icon/index.js +26 -0
  28. package/_dist/esm/menu/index.js +52 -0
  29. package/_dist/esm/modal/index.js +66 -0
  30. package/_dist/{popover → esm/popover}/index.js +100 -100
  31. package/_dist/esm/tooltip/index.js +119 -0
  32. package/package.json +8 -9
  33. package/_dist/_lib/storage/cookies.js +0 -33
  34. package/_dist/_lib/storage/encData.js +0 -41
  35. package/_dist/box/Box.js +0 -14
  36. package/_dist/box/BoxContent.js +0 -5
  37. package/_dist/box/BoxFooter.js +0 -10
  38. package/_dist/box/BoxHeader.js +0 -10
  39. package/_dist/countDown/index.js +0 -92
  40. package/_dist/form/Button.js +0 -82
  41. package/_dist/form/Checkbox.js +0 -22
  42. package/_dist/form/Dialog.js +0 -53
  43. package/_dist/form/Form.js +0 -10
  44. package/_dist/form/FormOlustur.js +0 -50
  45. package/_dist/form/Label.js +0 -7
  46. package/_dist/form/SearchableInput.js +0 -260
  47. package/_dist/form/UploadBase.js +0 -84
  48. package/_dist/grid/index.js +0 -96
  49. package/_dist/icon/index.js +0 -34
  50. package/_dist/menu/index.js +0 -50
  51. package/_dist/modal/index.js +0 -64
  52. package/_dist/tooltip/index.js +0 -202
  53. /package/_dist/{_lib → esm/_lib}/baseFunctions.d.ts +0 -0
  54. /package/_dist/{_lib → esm/_lib}/inputMask.d.ts +0 -0
  55. /package/_dist/{_lib → esm/_lib}/listFunctions.d.ts +0 -0
  56. /package/_dist/{_lib → esm/_lib}/storage/cookies.d.ts +0 -0
  57. /package/_dist/{_lib → esm/_lib}/storage/encData.d.ts +0 -0
  58. /package/_dist/{_lib → esm/_lib}/storage/localStorage.d.ts +0 -0
  59. /package/_dist/{_lib → esm/_lib}/storage/sessionStorage.d.ts +0 -0
  60. /package/_dist/{_lib → esm/_lib}/useInterval.d.ts +0 -0
  61. /package/_dist/{alert → esm/alert}/index.d.ts +0 -0
  62. /package/_dist/{alert → esm/alert}/index.module.css +0 -0
  63. /package/_dist/{box → esm/box}/Box.d.ts +0 -0
  64. /package/_dist/{box → esm/box}/Box.module.css +0 -0
  65. /package/_dist/{box → esm/box}/BoxContent.d.ts +0 -0
  66. /package/_dist/{box → esm/box}/BoxFooter.d.ts +0 -0
  67. /package/_dist/{box → esm/box}/BoxHeader.d.ts +0 -0
  68. /package/_dist/{box → esm/box}/index.d.ts +0 -0
  69. /package/_dist/{box → esm/box}/index.js +0 -0
  70. /package/_dist/{countDown → esm/countDown}/index.d.ts +0 -0
  71. /package/_dist/{dateTime → esm/dateTime}/index.d.ts +0 -0
  72. /package/_dist/{form → esm/form}/Button.d.ts +0 -0
  73. /package/_dist/{form → esm/form}/Checkbox.d.ts +0 -0
  74. /package/_dist/{form → esm/form}/Dialog.d.ts +0 -0
  75. /package/_dist/{form → esm/form}/Form.d.ts +0 -0
  76. /package/_dist/{form → esm/form}/FormOlustur.d.ts +0 -0
  77. /package/_dist/{form → esm/form}/Input.d.ts +0 -0
  78. /package/_dist/{form → esm/form}/Label.d.ts +0 -0
  79. /package/_dist/{form → esm/form}/SearchableInput.d.ts +0 -0
  80. /package/_dist/{form → esm/form}/UploadBase.d.ts +0 -0
  81. /package/_dist/{form → esm/form}/index.d.ts +0 -0
  82. /package/_dist/{form → esm/form}/index.js +0 -0
  83. /package/_dist/{form → esm/form}/styles/Button.module.css +0 -0
  84. /package/_dist/{form → esm/form}/styles/Input.module.css +0 -0
  85. /package/_dist/{form → esm/form}/styles/Label.module.css +0 -0
  86. /package/_dist/{form → esm/form}/styles/SearchableInput.module.css +0 -0
  87. /package/_dist/{grid → esm/grid}/index.d.ts +0 -0
  88. /package/_dist/{grid → esm/grid}/index.module.css +0 -0
  89. /package/_dist/{icon → esm/icon}/icons.d.ts +0 -0
  90. /package/_dist/{icon → esm/icon}/index.d.ts +0 -0
  91. /package/_dist/{icon → esm/icon}/mui.d.ts +0 -0
  92. /package/_dist/{icon → esm/icon}/mui.js +0 -0
  93. /package/_dist/{index.d.ts → esm/index.d.ts} +0 -0
  94. /package/_dist/{index.js → esm/index.js} +0 -0
  95. /package/_dist/{menu → esm/menu}/index.d.ts +0 -0
  96. /package/_dist/{menu → esm/menu}/index.module.css +0 -0
  97. /package/_dist/{modal → esm/modal}/index.d.ts +0 -0
  98. /package/_dist/{modal → esm/modal}/index.module.css +0 -0
  99. /package/_dist/{popover → esm/popover}/index.d.ts +0 -0
  100. /package/_dist/{popover → esm/popover}/index.module.css +0 -0
  101. /package/_dist/{tooltip → esm/tooltip}/index.d.ts +0 -0
@@ -6,19 +6,19 @@
6
6
  // source: https://overreacted.io/making-setinterval-declarative-with-react-hooks/
7
7
  import { useEffect, useRef } from "react";
8
8
  export function useInterval(callback, delay) {
9
- const savedCallback = useRef(null);
9
+ var savedCallback = useRef(null);
10
10
  // Remember the latest callback.
11
- useEffect(() => {
11
+ useEffect(function () {
12
12
  savedCallback.current = callback;
13
13
  }, [callback]);
14
14
  // Set up the interval.
15
- useEffect(() => {
15
+ useEffect(function () {
16
16
  function tick() {
17
17
  savedCallback && savedCallback.current && savedCallback.current();
18
18
  }
19
19
  if (delay !== null) {
20
- const id = setInterval(tick, delay);
21
- return () => clearInterval(id);
20
+ var id_1 = setInterval(tick, delay);
21
+ return function () { return clearInterval(id_1); };
22
22
  }
23
23
  }, [delay]);
24
24
  }
@@ -2,20 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect } from "react";
3
3
  import { createRoot } from "react-dom/client";
4
4
  import styles from "./index.module.css";
5
- const sAlertTimeout = [];
6
- export const Alert = ({ defaultTimer = "5000", defaultErrorTimer = "10000", defaultSuccessTimer = "5000" }) => {
7
- useEffect(() => {
5
+ var sAlertTimeout = [];
6
+ export var Alert = function (_a) {
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;
8
+ useEffect(function () {
8
9
  if (typeof window === "undefined")
9
10
  return;
10
- const divCheck = document.getElementById("salert");
11
+ var divCheck = document.getElementById("salert");
11
12
  if (!divCheck) {
12
13
  // let div = document.createElement('div') as HTMLDivElement
13
- const div = document.createElement("div");
14
+ var div = document.createElement("div");
14
15
  div.setAttribute("id", "salert");
15
16
  div.setAttribute("defaultTimer", defaultTimer);
16
17
  div.setAttribute("defaultErrorTimer", defaultErrorTimer);
17
18
  div.setAttribute("defaultSuccessTimer", defaultSuccessTimer);
18
- const alertStyle = [
19
+ var alertStyle = [
19
20
  "position: fixed",
20
21
  "bottom: 0",
21
22
  "right: 0",
@@ -33,26 +34,27 @@ export const Alert = ({ defaultTimer = "5000", defaultErrorTimer = "10000", defa
33
34
  }, []);
34
35
  return null;
35
36
  };
36
- export const alert_add = ({ type, message, style, timer }) => {
37
- var _a, _b, _c;
37
+ export var alert_add = function (_a) {
38
+ var _b, _c, _d;
39
+ var type = _a.type, message = _a.message, style = _a.style, timer = _a.timer;
38
40
  if (typeof window === "undefined")
39
41
  return false;
40
- const mainDiv = document.getElementById("salert");
42
+ var mainDiv = document.getElementById("salert");
41
43
  if (mainDiv) {
42
- const alert = document.createElement("div");
43
- mainDiv.prepend(alert);
44
- const onClose = () => {
45
- if (mainDiv && alert && mainDiv.contains(alert))
46
- mainDiv.removeChild(alert);
44
+ var alert_1 = document.createElement("div");
45
+ mainDiv.prepend(alert_1);
46
+ var onClose_1 = function () {
47
+ if (mainDiv && alert_1 && mainDiv.contains(alert_1))
48
+ mainDiv.removeChild(alert_1);
47
49
  };
48
- const root = createRoot(alert);
49
- const Component = (_jsxs("div", { className: `${styles.salert} ${styles[type]}`, style: style, children: [_jsx("div", { className: styles.message, dangerouslySetInnerHTML: { __html: message } }), _jsx("div", { className: styles.close, onClick: onClose, children: "\u2715" })] }));
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" })] }));
50
52
  root.render(Component);
51
- const defaultTimer = (_a = mainDiv.getAttribute("defaulttimer")) !== null && _a !== void 0 ? _a : "5000";
52
- const defaultErrorTimer = (_b = mainDiv.getAttribute("defaulterrortimer")) !== null && _b !== void 0 ? _b : "10000";
53
- const defaultSuccessTimer = (_c = mainDiv.getAttribute("defaultsuccesstimer")) !== null && _c !== void 0 ? _c : "5000";
54
- const timerFilled = typeof timer === "number" && timer > 0;
55
- let newTimer = timerFilled ? timer : defaultTimer;
53
+ var defaultTimer = (_b = mainDiv.getAttribute("defaulttimer")) !== null && _b !== void 0 ? _b : "5000";
54
+ var defaultErrorTimer = (_c = mainDiv.getAttribute("defaulterrortimer")) !== null && _c !== void 0 ? _c : "10000";
55
+ var defaultSuccessTimer = (_d = mainDiv.getAttribute("defaultsuccesstimer")) !== null && _d !== void 0 ? _d : "5000";
56
+ var timerFilled = typeof timer === "number" && timer > 0;
57
+ var newTimer = timerFilled ? timer : defaultTimer;
56
58
  switch (type) {
57
59
  case "error":
58
60
  newTimer = timerFilled ? timer : defaultErrorTimer;
@@ -67,27 +69,27 @@ export const alert_add = ({ type, message, style, timer }) => {
67
69
  if (typeof timer !== "boolean") {
68
70
  // False gelmişse sabit kalsın
69
71
  if (newTimer > 0) {
70
- const timeout = setTimeout(() => onClose(), newTimer);
72
+ var timeout = setTimeout(function () { return onClose_1(); }, newTimer);
71
73
  sAlertTimeout.push(timeout);
72
74
  }
73
75
  }
74
- return alert;
76
+ return alert_1;
75
77
  }
76
78
  return null;
77
79
  };
78
- export const alert_remove = (alert) => {
80
+ export var alert_remove = function (alert) {
79
81
  if (typeof window === "undefined" || !alert)
80
82
  return;
81
- const mainDiv = document.getElementById("salert");
83
+ var mainDiv = document.getElementById("salert");
82
84
  if (mainDiv && alert && mainDiv.contains(alert))
83
85
  mainDiv.removeChild(alert);
84
86
  return;
85
87
  };
86
- export const alert_clear = () => {
88
+ export var alert_clear = function () {
87
89
  if (typeof window === "undefined")
88
90
  return false;
89
- sAlertTimeout.map((id) => clearTimeout(id));
90
- const mainDiv = document.getElementById("salert");
91
+ sAlertTimeout.map(function (id) { return clearTimeout(id); });
92
+ var mainDiv = document.getElementById("salert");
91
93
  if (mainDiv)
92
94
  mainDiv.innerHTML = "";
93
95
  return true;
@@ -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
+ });
@@ -0,0 +1,97 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import React from 'react';
3
+ import { useInterval } from '../_lib/useInterval';
4
+ export var useCountDown = function (_a) {
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;
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 () {
12
+ if (!hide)
13
+ render();
14
+ }, [timer]);
15
+ useInterval(function () {
16
+ if (enabled) {
17
+ if (timer <= 1) {
18
+ stopCountDown();
19
+ }
20
+ else {
21
+ setTimer(timer - 1);
22
+ }
23
+ }
24
+ }, enabled ? timerSpeed : null);
25
+ var prepareTimer = function (timeORstring) {
26
+ if (timerType === 'datetime') {
27
+ setTimer(Math.floor((new Date(timeORstring).getTime() - new Date().getTime()) / 1000));
28
+ setEnabled(true);
29
+ }
30
+ else {
31
+ setTimer(timeORstring);
32
+ }
33
+ };
34
+ var stopCountDown = function () {
35
+ setTimer(0);
36
+ setEnabled(false);
37
+ if ((enabled && onComplete) || (timerType === 'datetime' && onComplete)) {
38
+ onComplete();
39
+ }
40
+ };
41
+ var padNumber = function (num, padLength, padString) {
42
+ if (padLength === void 0) { padLength = 2; }
43
+ if (padString === void 0) { padString = '0'; }
44
+ return (typeof targetTime === 'number' && targetTime < 10 ? num : String(num).padStart(padLength, padString));
45
+ };
46
+ var render = function () {
47
+ var days = 0, hours = 0, minutes = 0, seconds = timer;
48
+ if (countType === 'minutes:seconds') {
49
+ minutes = Math.floor(seconds / 60);
50
+ seconds -= minutes * 60;
51
+ }
52
+ else if (countType === 'hours:minutes:seconds') {
53
+ hours = Math.floor(seconds / (60 * 60));
54
+ seconds -= hours * 60 * 60;
55
+ minutes = Math.floor(seconds / 60);
56
+ seconds -= minutes * 60;
57
+ }
58
+ else if (countType === 'days:hours:minutes:seconds') {
59
+ days = Math.floor(seconds / (60 * 60 * 24));
60
+ seconds -= days * 60 * 60 * 24;
61
+ hours = Math.floor(seconds / (60 * 60));
62
+ seconds -= hours * 60 * 60;
63
+ minutes = Math.floor(seconds / 60);
64
+ seconds -= minutes * 60;
65
+ }
66
+ seconds = Math.floor(seconds);
67
+ if (getStatus && timer > 0)
68
+ getStatus({ days: days, hours: hours, minutes: minutes, seconds: seconds, timer: timer });
69
+ if (refCountDownRender.current) {
70
+ var getPadValues = function (div) {
71
+ var length = div.dataset.padlength || 2;
72
+ var string = div.dataset.padstring || '0';
73
+ return { length: length, string: string };
74
+ };
75
+ var divGun = refCountDownRender.current.querySelector("[data-name='days']");
76
+ if (divGun)
77
+ divGun.innerHTML = padNumber(days, getPadValues(divGun).length, getPadValues(divGun).string).toString();
78
+ var divSaat = refCountDownRender.current.querySelector("[data-name='hours']");
79
+ if (divSaat)
80
+ divSaat.innerHTML = padNumber(hours, getPadValues(divSaat).length, getPadValues(divSaat).string).toString();
81
+ var divDakika = refCountDownRender.current.querySelector("[data-name='minutes']");
82
+ if (divDakika)
83
+ divDakika.innerHTML = padNumber(minutes, getPadValues(divDakika).length, getPadValues(divDakika).string).toString();
84
+ var divSaniye = refCountDownRender.current.querySelector("[data-name='seconds']");
85
+ if (divSaniye)
86
+ divSaniye.innerHTML = padNumber(seconds, getPadValues(divSaniye).length, getPadValues(divSaniye).string).toString();
87
+ }
88
+ };
89
+ return {
90
+ ComponentCountDown: function (children) { return (hide ? null : React.cloneElement(children, { ref: refCountDownRender })); },
91
+ startCountDown: function () { return setEnabled(true); },
92
+ stopCountDown: function () { return setEnabled(false); },
93
+ setTargetTime: function (targetTime) { return prepareTimer(targetTime); },
94
+ setTimerSpeed: function (timerSpeed) { return setTimerSpeed(timerSpeed); },
95
+ getChildrenRef: function () { return refCountDownRender.current || null; }
96
+ };
97
+ };
@@ -1,20 +1,22 @@
1
- export default class dateTime {
2
- constructor(datetime = null, format = "y-m-d h:i:s") {
1
+ var dateTime = /** @class */ (function () {
2
+ function dateTime(datetime, format) {
3
+ if (datetime === void 0) { datetime = null; }
4
+ if (format === void 0) { format = "y-m-d h:i:s"; }
3
5
  this.resut_format = "y-m-d h:i:s";
4
6
  this.format(format);
5
7
  this.datetime = datetime !== "0000-00-00 00:00:00" && datetime !== "0000-00-00" && datetime ? datetime : new Date().toISOString(); // GMT ekli halde
6
8
  return this;
7
9
  }
8
- addDays(days) {
9
- const datetime = new Date(this.datetime);
10
+ dateTime.prototype.addDays = function (days) {
11
+ var datetime = new Date(this.datetime);
10
12
  datetime.setDate(datetime.getDate() + days);
11
13
  this.datetime = datetime.toISOString();
12
14
  return this;
13
- }
14
- parse() {
15
- const datetime = new Date(this.datetime);
16
- const monthNames = ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"];
17
- const dayNames = ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"];
15
+ };
16
+ dateTime.prototype.parse = function () {
17
+ var datetime = new Date(this.datetime);
18
+ var monthNames = ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"];
19
+ var dayNames = ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"];
18
20
  return {
19
21
  y: datetime.getFullYear().toString(),
20
22
  m: (datetime.getMonth() + 1).toString().padStart(2, "0"),
@@ -28,10 +30,10 @@ export default class dateTime {
28
30
  TAMAY: monthNames[datetime.getMonth()],
29
31
  TAMGUN: dayNames[datetime.getDay()]
30
32
  };
31
- }
32
- getResult() {
33
- const parse = this.parse();
34
- let result = this.resut_format;
33
+ };
34
+ dateTime.prototype.getResult = function () {
35
+ var parse = this.parse();
36
+ var result = this.resut_format;
35
37
  result = result.replace(new RegExp("y", "g"), parse.y.toString());
36
38
  result = result.replace(new RegExp("m", "g"), parse.m.toString());
37
39
  result = result.replace(new RegExp("d", "g"), parse.d.toString());
@@ -43,22 +45,24 @@ export default class dateTime {
43
45
  result = result.replace(new RegExp("TAMAY", "g"), parse.TAMAY.toString());
44
46
  result = result.replace(new RegExp("TAMGUN", "g"), parse.TAMGUN.toString());
45
47
  return result;
46
- }
47
- format(format = "y-m-d h:i:s") {
48
+ };
49
+ dateTime.prototype.format = function (format) {
50
+ if (format === void 0) { format = "y-m-d h:i:s"; }
48
51
  this.resut_format = format;
49
52
  return this;
50
- }
51
- today() {
53
+ };
54
+ dateTime.prototype.today = function () {
52
55
  this.datetime = new Date().toISOString();
53
56
  this.format("y-m-d");
54
57
  return this.getResult();
55
- }
56
- getTime() {
57
- const convertDateTime = new dateTime(this.datetime).format("y-m-d h:i:s").getResult();
58
- const datetime = new Date(convertDateTime);
58
+ };
59
+ dateTime.prototype.getTime = function () {
60
+ var convertDateTime = new dateTime(this.datetime).format("y-m-d h:i:s").getResult();
61
+ var datetime = new Date(convertDateTime);
59
62
  return datetime.getTime();
60
- }
61
- nextMonthFirstDay(format = "y-m-d") {
63
+ };
64
+ dateTime.prototype.nextMonthFirstDay = function (format) {
65
+ if (format === void 0) { format = "y-m-d"; }
62
66
  // Verilen tarihin bir sonraki ayının ilk gününü bul
63
67
  this.datetime = new Date(this.datetime);
64
68
  this.datetime.setMonth(this.datetime.getMonth() + 1);
@@ -66,5 +70,7 @@ export default class dateTime {
66
70
  this.datetime = this.datetime.toISOString();
67
71
  this.format(format);
68
72
  return this.getResult();
69
- }
70
- }
73
+ };
74
+ return dateTime;
75
+ }());
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
+ });
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import styles from "./styles/Input.module.css";
4
+ export var Checkbox = function (_a) {
5
+ var ref = _a.ref, children = _a.children, name = _a.name, label = _a.label, checked = _a.checked, className = _a.className, style = _a.style, styleCheckbox = _a.styleCheckbox, styleLabel = _a.styleLabel, onToogle = _a.onToogle, disabled = _a.disabled, tabIndex = _a.tabIndex, _b = _a.required, required = _b === void 0 ? false : _b;
6
+ var refMain = useRef(null);
7
+ // checked değerini boolean hâline getiriyoruz
8
+ var isChecked = checked === "1" || checked === true;
9
+ var handleChange = function (newChecked) {
10
+ if (disabled)
11
+ return;
12
+ onToogle === null || onToogle === void 0 ? void 0 : onToogle({
13
+ target: {
14
+ name: name,
15
+ value: newChecked ? "1" : "0"
16
+ }
17
+ });
18
+ };
19
+ var toggleCheck = function () {
20
+ handleChange(!isChecked);
21
+ };
22
+ return (_jsxs("div", { ref: refMain, className: "".concat(styles.checkbox, " ").concat(className || ""), style: style, tabIndex: tabIndex, onClick: toggleCheck, children: [_jsx("input", { ref: ref, type: "checkbox", name: name, onChange: function (e) { return handleChange(e.target.checked); }, checked: isChecked, required: required, style: styleCheckbox, disabled: disabled }), label && _jsx("label", { style: styleLabel, children: label }), children && _jsx("div", { children: children })] }));
23
+ };
@@ -0,0 +1,40 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Box, BoxFooter } from '../box';
4
+ import { createRoot } from 'react-dom/client';
5
+ import { Modal } from '../modal';
6
+ import { Button } from './Button';
7
+ export var Dialog = function (config) {
8
+ return new Promise(function (resolve) {
9
+ if (typeof window === 'undefined')
10
+ return false;
11
+ var mainDiv = document.getElementById('sdialog');
12
+ if (!mainDiv) {
13
+ var createDiv = document.createElement('div');
14
+ createDiv.setAttribute('id', 'sdialog');
15
+ document.body.appendChild(createDiv);
16
+ mainDiv = createDiv;
17
+ }
18
+ var root = createRoot(mainDiv);
19
+ var settings = __assign({ acceptButtonShow: true, cancelButtonShow: true, acceptButtonText: 'EVET', cancelButtonText: 'HAYIR', acceptButtonClass: 'danger', cancelButtonClass: 'secondary', vertialAlign: 'center', horizontalAlign: 'center', hideBackdrop: true, hideEsc: true, styleMessage: {
20
+ fontSize: '1.1rem',
21
+ padding: '10px 20px'
22
+ }, styleBox: { padding: 0, margin: 0, minWidth: 250 }, styleBoxFooter: { padding: '8px 5px' }, autoFocus: 'accept' }, config);
23
+ var close = function () {
24
+ if (mainDiv) {
25
+ root.unmount();
26
+ mainDiv.remove();
27
+ }
28
+ };
29
+ var onCancel = function () {
30
+ resolve(false);
31
+ close();
32
+ };
33
+ var onAccept = function () {
34
+ resolve(true);
35
+ close();
36
+ };
37
+ var Component = (_jsx(Modal, { open: true, keepMounted: false, close: onCancel, hideBackdrop: settings.hideBackdrop, hideEsc: settings.hideEsc, hideCloseButton: true, vertialAlign: settings.vertialAlign, horizontalAlign: settings.horizontalAlign, backdropStyle: settings.backdropStyle, children: _jsxs(Box, { style: settings.styleBox, children: [_jsx("div", { className: "sbox_content", style: settings.styleMessage, dangerouslySetInnerHTML: { __html: settings.message } }), (settings.acceptButtonShow || settings.cancelButtonShow) && (_jsxs(BoxFooter, { style: settings.styleBoxFooter, children: [settings.cancelButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'cancel', buttonClass: settings.cancelButtonClass, onClick: onCancel, children: settings.cancelButtonText })), settings.acceptButtonShow && (_jsx(Button, { autoFocus: settings.autoFocus === 'accept', buttonClass: settings.acceptButtonClass, onClick: onAccept, children: settings.acceptButtonText }))] }))] }) }));
38
+ root.render(Component);
39
+ });
40
+ };
@@ -0,0 +1,12 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { memo } from "react";
4
+ export var Form = memo(function FunctionMemo(_a) {
5
+ var _b = _a.encType, encType = _b === void 0 ? "multipart/form-data" : _b, onSubmit = _a.onSubmit, style = _a.style, _c = _a.disableOnEnterSubmit, disableOnEnterSubmit = _c === void 0 ? false : _c, other = __rest(_a, ["encType", "onSubmit", "style", "disableOnEnterSubmit"]);
6
+ var onKeyDown = function (e) {
7
+ if (e.key === "Enter" && disableOnEnterSubmit) {
8
+ e.preventDefault();
9
+ }
10
+ };
11
+ return _jsx("form", __assign({ style: style, encType: encType, onSubmit: onSubmit, onKeyDown: onKeyDown }, other));
12
+ });
@@ -0,0 +1,52 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React, { memo, useEffect, useMemo } from 'react';
4
+ import { Col, Row } from '../grid';
5
+ import { isDev } from '../_lib/baseFunctions';
6
+ import { Label } from './Label';
7
+ export var FormOlustur = memo(function FunctionMemo(props) {
8
+ var form = props.form, formOgeler = props.formOgeler, onChange = props.onChange, formType = props.formType, sabitGrid = props.sabitGrid, justifyContent = props.justifyContent, rowSpacing = props.rowSpacing, colSpacing = props.colSpacing;
9
+ useEffect(function () {
10
+ if (formOgeler && onChange && form) {
11
+ formOgeler.forEach(function (formOgeler) {
12
+ var _a, _b, _c, _d;
13
+ var fieldName = (_b = (_a = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.name;
14
+ if (formOgeler.noRender && fieldName && form[fieldName] && form[fieldName] != '') {
15
+ isDev && console.log('noRenderGuncelle');
16
+ if ((formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) && ((_d = (_c = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.name)) {
17
+ onChange({
18
+ target: {
19
+ name: fieldName,
20
+ value: ''
21
+ }
22
+ });
23
+ }
24
+ }
25
+ });
26
+ }
27
+ }, [JSON.stringify(form), formOgeler]);
28
+ var result = useMemo(function () {
29
+ return formOgeler.map(function (_a, i) {
30
+ var noRender = _a.noRender, fullComponent = _a.fullComponent, component = _a.component, propsComponent = _a.propsComponent, propsRow = _a.propsRow, label = _a.label, propsLabel = _a.propsLabel, gridLabel = _a.gridLabel, gridInput = _a.gridInput;
31
+ if (noRender) {
32
+ return null;
33
+ }
34
+ if (fullComponent)
35
+ return React.cloneElement(fullComponent, { key: i });
36
+ var newProps = __assign({}, propsComponent);
37
+ if (onChange && component && !component.props.onChange) {
38
+ newProps = __assign(__assign({}, newProps), { onChange: onChange });
39
+ }
40
+ if (onChange && form && component.props.name && !component.props.value) {
41
+ newProps = __assign(__assign({}, newProps), { value: form[component.props.name] && form[component.props.name].length > 0 ? String(form[component.props.name]) : '' });
42
+ }
43
+ if (formType === 'label')
44
+ newProps = __assign(__assign({}, newProps), { label: '' });
45
+ var detectLabel = label || component.props.label;
46
+ gridLabel = __assign(__assign({}, sabitGrid.label), gridLabel);
47
+ gridInput = __assign(__assign({}, sabitGrid.input), gridInput);
48
+ return (_jsxs(Row, __assign({ justifyContent: justifyContent, rowSpacing: rowSpacing, colSpacing: colSpacing }, propsRow, { children: [formType === 'label' && detectLabel && (_jsx(Col, __assign({}, gridLabel, { children: _jsx(Label, __assign({ required: component.props.required }, propsLabel, { children: detectLabel })) }))), _jsx(Col, __assign({}, gridInput, { children: React.cloneElement(component, newProps) }))] }), i));
49
+ });
50
+ }, [form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing]);
51
+ return _jsx(React.Fragment, { children: result });
52
+ });