albinasoft-ui-package 1.1.47 → 1.1.49
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.
@@ -9,7 +9,7 @@ interface CustomDateTimePickerProps {
|
|
9
9
|
id?: string;
|
10
10
|
name?: string;
|
11
11
|
label: string;
|
12
|
-
value:
|
12
|
+
value: string | null;
|
13
13
|
placeholder?: string;
|
14
14
|
required?: boolean;
|
15
15
|
errorMessage?: string;
|
@@ -26,7 +26,7 @@ interface CustomDateTimePickerProps {
|
|
26
26
|
timeFormat?: TimeFormat;
|
27
27
|
timeIntervals?: number;
|
28
28
|
submitted?: boolean;
|
29
|
-
onChange: (
|
29
|
+
onChange: (dateString: string | null) => void;
|
30
30
|
}
|
31
31
|
declare const CustomDateTimePicker: React.FC<CustomDateTimePickerProps>;
|
32
32
|
export { CustomDateTimePicker, TimeFormat };
|
@@ -16,20 +16,14 @@ var TimeFormat;
|
|
16
16
|
TimeFormat["HM"] = "HH:mm";
|
17
17
|
})(TimeFormat || (TimeFormat = {}));
|
18
18
|
exports.TimeFormat = TimeFormat;
|
19
|
-
//
|
19
|
+
// Türkçe locale objesi
|
20
20
|
var customTrLocale = {
|
21
21
|
localize: {
|
22
|
-
month: function (n) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
return months[n];
|
28
|
-
},
|
29
|
-
day: function (n) {
|
30
|
-
var days = ["Pzr", "Pts", "Sal", "Çrş", "Prş", "Cum", "Cts"];
|
31
|
-
return days[n];
|
32
|
-
},
|
22
|
+
month: function (n) { return [
|
23
|
+
"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran",
|
24
|
+
"Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
|
25
|
+
][n]; },
|
26
|
+
day: function (n) { return ["Pzr", "Pts", "Sal", "Çrş", "Prş", "Cum", "Cts"][n]; },
|
33
27
|
},
|
34
28
|
formatLong: {
|
35
29
|
date: function () { return "dd.MM.yyyy"; },
|
@@ -40,39 +34,29 @@ var customTrLocale = {
|
|
40
34
|
weekStartsOn: 1,
|
41
35
|
},
|
42
36
|
};
|
43
|
-
// TR saatine göre ISO-like string
|
44
|
-
var
|
37
|
+
// Yardımcı: Date objesini TR saatine göre ISO-like string'e çevir
|
38
|
+
var toLocalISOString = function (date) {
|
45
39
|
var pad = function (n) { return n.toString().padStart(2, "0"); };
|
46
|
-
|
47
|
-
var month = pad(date.getMonth() + 1);
|
48
|
-
var day = pad(date.getDate());
|
49
|
-
var hour = pad(date.getHours());
|
50
|
-
var minute = pad(date.getMinutes());
|
51
|
-
var second = pad(date.getSeconds());
|
52
|
-
var ms = date.getMilliseconds().toString().padStart(3, "0");
|
53
|
-
return "".concat(year, "-").concat(month, "-").concat(day, "T").concat(hour, ":").concat(minute, ":").concat(second, ".").concat(ms);
|
40
|
+
return "".concat(date.getFullYear(), "-").concat(pad(date.getMonth() + 1), "-").concat(pad(date.getDate()), "T").concat(pad(date.getHours()), ":").concat(pad(date.getMinutes()), ":").concat(pad(date.getSeconds()));
|
54
41
|
};
|
55
42
|
var CustomDateTimePicker = function (_a) {
|
56
43
|
var id = _a.id, name = _a.name, label = _a.label, value = _a.value, placeholder = _a.placeholder, _b = _a.required, required = _b === void 0 ? false : _b, errorMessage = _a.errorMessage, _c = _a.conditionalErrorVisible, conditionalErrorVisible = _c === void 0 ? false : _c, conditionalErrorMessage = _a.conditionalErrorMessage, tooltip = _a.tooltip, description = _a.description, _d = _a.disabled, disabled = _d === void 0 ? false : _d, className = _a.className, style = _a.style, showTimeSelect = _a.showTimeSelect, showTimeSelectOnly = _a.showTimeSelectOnly, showYearDropdown = _a.showYearDropdown, _e = _a.timeFormat, timeFormat = _e === void 0 ? TimeFormat.HM : _e, timeIntervals = _a.timeIntervals, submitted = _a.submitted, onChange = _a.onChange;
|
57
44
|
var isInvalid = submitted && required && !value;
|
58
|
-
//
|
45
|
+
// Value string olarak geliyor, bunu input'ta göstermek için Date'e çeviriyoruz
|
46
|
+
var parsedValue = value ? new Date(value.replace(" ", "T")) : null;
|
59
47
|
var handleChange = function (date) {
|
60
|
-
if (!date)
|
61
|
-
onChange(null);
|
62
|
-
|
63
|
-
|
64
|
-
// TR saatiyle toplanmış Date üret
|
65
|
-
var trIso = toTrIsoString(date);
|
66
|
-
var localDate = new Date(trIso); // UTC'ye çevrilmeden oluşturulmuş Date objesi
|
67
|
-
onChange(localDate);
|
48
|
+
if (!date)
|
49
|
+
return onChange(null);
|
50
|
+
var formatted = toLocalISOString(date);
|
51
|
+
onChange(formatted);
|
68
52
|
};
|
69
53
|
return (react_1.default.createElement("div", { className: "col-12", style: style },
|
70
54
|
react_1.default.createElement("div", { className: "form-group" },
|
71
55
|
react_1.default.createElement("label", { htmlFor: id, className: "form-label" }, label),
|
72
56
|
react_1.default.createElement("div", { className: "position-relative" },
|
73
|
-
react_1.default.createElement(react_bootstrap_1.OverlayTrigger, { placement: "bottom", overlay: tooltip ?
|
57
|
+
react_1.default.createElement(react_bootstrap_1.OverlayTrigger, { placement: "bottom", overlay: tooltip ? react_1.default.createElement(react_bootstrap_1.Tooltip, { id: "tooltip-".concat(id) }, tooltip) : react_1.default.createElement(react_1.default.Fragment, null) },
|
74
58
|
react_1.default.createElement("div", null,
|
75
|
-
react_1.default.createElement(react_datepicker_1.default, { id: id, name: name, selected:
|
59
|
+
react_1.default.createElement(react_datepicker_1.default, { id: id, name: name, selected: parsedValue, onChange: handleChange, className: "form-control ".concat(className || "", " ").concat(submitted
|
76
60
|
? isInvalid
|
77
61
|
? "is-invalid"
|
78
62
|
: "is-valid"
|
@@ -105,12 +105,12 @@ interface DateTimePickerElement {
|
|
105
105
|
id?: string;
|
106
106
|
type: ElementType;
|
107
107
|
label: string;
|
108
|
-
value:
|
108
|
+
value: string | null;
|
109
109
|
rowId?: number;
|
110
110
|
colId?: number;
|
111
111
|
innerRowId?: number;
|
112
112
|
colClass?: string;
|
113
|
-
onChange: (e:
|
113
|
+
onChange: (e: string | null) => void;
|
114
114
|
}
|
115
115
|
interface TextElement {
|
116
116
|
id: string;
|