albinasoft-ui-package 1.0.73 → 1.0.75
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.
@@ -1,7 +1,3 @@
|
|
1
|
-
.react-datepicker-wrapper {
|
2
|
-
display: block;
|
3
|
-
}
|
4
|
-
|
5
1
|
.react-datepicker-popper {
|
6
2
|
z-index: 5;
|
7
3
|
}
|
@@ -19,8 +15,9 @@
|
|
19
15
|
top: 6px;
|
20
16
|
width: 9px;
|
21
17
|
}
|
18
|
+
|
22
19
|
.react-datepicker-wrapper {
|
23
|
-
display:
|
20
|
+
display: block;
|
24
21
|
padding: 0;
|
25
22
|
border: 0;
|
26
23
|
}
|
@@ -115,16 +115,29 @@ var CustomForm = function (_a) {
|
|
115
115
|
showCancelButton = _e === void 0 ? false : _e;
|
116
116
|
var formRef = (0, react_1.useRef)(null);
|
117
117
|
var _f = (0, react_1.useState)(false), isLoading = _f[0], setIsLoading = _f[1];
|
118
|
+
var _g = (0, react_1.useState)(false), submitted = _g[0], setSubmitted = _g[1];
|
118
119
|
var handleConfirm = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
119
|
-
var form, isValid, formValues_1, error_1;
|
120
|
+
var form, customSelectValid, isValid, formValues_1, error_1;
|
120
121
|
return __generator(this, function (_a) {
|
121
122
|
switch (_a.label) {
|
122
123
|
case 0:
|
123
124
|
e.preventDefault();
|
125
|
+
setSubmitted(true); // Form gönderimi tetiklendi
|
124
126
|
form = formRef.current;
|
125
127
|
if (!form)
|
126
128
|
return [2 /*return*/];
|
127
|
-
|
129
|
+
customSelectValid = true;
|
130
|
+
elements.forEach(function (element) {
|
131
|
+
if (element.type === ElementType.SELECT && element.required) {
|
132
|
+
var selectElement = element;
|
133
|
+
// Eğer değer boş (string) veya boş array ise geçersiz kabul edin
|
134
|
+
if ((Array.isArray(selectElement.value) && selectElement.value.length === 0) ||
|
135
|
+
(!Array.isArray(selectElement.value) && !selectElement.value)) {
|
136
|
+
customSelectValid = false;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
});
|
140
|
+
isValid = form.checkValidity() && customSelectValid;
|
128
141
|
if (!isValid) return [3 /*break*/, 6];
|
129
142
|
setIsLoading(true);
|
130
143
|
_a.label = 1;
|
@@ -136,7 +149,6 @@ var CustomForm = function (_a) {
|
|
136
149
|
element instanceof HTMLTextAreaElement ||
|
137
150
|
element instanceof HTMLSelectElement) {
|
138
151
|
if (element.id) {
|
139
|
-
//RichTextbox boş göndermemesi için
|
140
152
|
var name_1 = element.name || element.id;
|
141
153
|
if (element instanceof HTMLInputElement &&
|
142
154
|
element.type === ElementType.RADIO) {
|
@@ -154,7 +166,7 @@ var CustomForm = function (_a) {
|
|
154
166
|
formValues_1[name_1] = selectedOptions;
|
155
167
|
}
|
156
168
|
else if (element instanceof HTMLSelectElement) {
|
157
|
-
formValues_1[name_1] = [element.value];
|
169
|
+
formValues_1[name_1] = [element.value];
|
158
170
|
}
|
159
171
|
else {
|
160
172
|
formValues_1[name_1] = element.value;
|
@@ -162,10 +174,10 @@ var CustomForm = function (_a) {
|
|
162
174
|
}
|
163
175
|
}
|
164
176
|
});
|
165
|
-
//
|
177
|
+
// Özel elemanlar için (örneğin RichTextbox) değerleri ekleyin
|
166
178
|
elements.forEach(function (element) {
|
167
179
|
if ("value" in element && element.type === ElementType.RICHTEXTBOX) {
|
168
|
-
formValues_1[element.id] = element.value;
|
180
|
+
formValues_1[element.id] = element.value;
|
169
181
|
}
|
170
182
|
});
|
171
183
|
return [4 /*yield*/, onSubmit(formValues_1)];
|
@@ -177,7 +189,7 @@ var CustomForm = function (_a) {
|
|
177
189
|
react_toastify_1.toast.error("Form gönderimi sırasında bir hata oluştu.");
|
178
190
|
return [3 /*break*/, 5];
|
179
191
|
case 4:
|
180
|
-
setIsLoading(false);
|
192
|
+
setIsLoading(false);
|
181
193
|
return [7 /*endfinally*/];
|
182
194
|
case 5: return [3 /*break*/, 7];
|
183
195
|
case 6:
|
@@ -209,7 +221,7 @@ var CustomForm = function (_a) {
|
|
209
221
|
var colId = _a[0], innerRows = _a[1];
|
210
222
|
return (react_1.default.createElement("div", { className: "col", key: "col-".concat(rowId, "-").concat(colId) }, Object.entries(innerRows).map(function (_a) {
|
211
223
|
var innerRowId = _a[0], elements = _a[1];
|
212
|
-
return (react_1.default.createElement("div", { className: "row ".concat(innerRowCustomClass), key: "inner-row-".concat(rowId, "-").concat(colId, "-").concat(innerRowId) }, elements.map(function (element) { return (react_1.default.createElement("div", { className: element.colClass || "col-12", key: element.id }, element.type === ElementType.TEXT ? (react_1.default.createElement(CustomText_1.default, __assign({}, element))) : element.type === ElementType.INPUT ? (react_1.default.createElement(CustomInput_1.default, __assign({}, element))) : element.type === ElementType.TEXTAREA ? (react_1.default.createElement(CustomTextarea_1.default, __assign({}, element))) : element.type === ElementType.CHECKBOX ? (react_1.default.createElement(CustomCheckbox_1.default, __assign({}, element))) : element.type === ElementType.RADIO ? (react_1.default.createElement(CustomRadioButton_1.default, __assign({}, element))) : element.type === ElementType.SELECT ? (react_1.default.createElement(CustomSelect_1.default, __assign({}, element))) : element.type === ElementType.DATETIMEPICKER ? (react_1.default.createElement(CustomDateTimePicker_1.default, __assign({}, element))) : element.type === ElementType.DIVIDER ? (react_1.default.createElement(CustomDivider_1.default, __assign({}, element))) : element.type === ElementType.RICHTEXTBOX ? (react_1.default.createElement(CustomRichTextbox_1.default, __assign({}, element))) : element.type === ElementType.TREEVIEW ? (react_1.default.createElement(CustomTreeView_1.default, __assign({}, element))) : element.type === ElementType.BUTTON ? (react_1.default.createElement(CustomButton_1.default, __assign({}, element, { isLoading: isLoading }))) : element.type === ElementType.AUTOCOMPLETEINPUT ? (react_1.default.createElement(CustomAutocompleteInput_1.default, __assign({}, element))) : element.type === ElementType.FILEUPLOADER ? (
|
224
|
+
return (react_1.default.createElement("div", { className: "row ".concat(innerRowCustomClass), key: "inner-row-".concat(rowId, "-").concat(colId, "-").concat(innerRowId) }, elements.map(function (element) { return (react_1.default.createElement("div", { className: element.colClass || "col-12", key: element.id }, element.type === ElementType.TEXT ? (react_1.default.createElement(CustomText_1.default, __assign({}, element))) : element.type === ElementType.INPUT ? (react_1.default.createElement(CustomInput_1.default, __assign({}, element))) : element.type === ElementType.TEXTAREA ? (react_1.default.createElement(CustomTextarea_1.default, __assign({}, element))) : element.type === ElementType.CHECKBOX ? (react_1.default.createElement(CustomCheckbox_1.default, __assign({}, element))) : element.type === ElementType.RADIO ? (react_1.default.createElement(CustomRadioButton_1.default, __assign({}, element))) : element.type === ElementType.SELECT ? (react_1.default.createElement(CustomSelect_1.default, __assign({}, element, { submitted: submitted }))) : element.type === ElementType.DATETIMEPICKER ? (react_1.default.createElement(CustomDateTimePicker_1.default, __assign({}, element))) : element.type === ElementType.DIVIDER ? (react_1.default.createElement(CustomDivider_1.default, __assign({}, element))) : element.type === ElementType.RICHTEXTBOX ? (react_1.default.createElement(CustomRichTextbox_1.default, __assign({}, element))) : element.type === ElementType.TREEVIEW ? (react_1.default.createElement(CustomTreeView_1.default, __assign({}, element))) : element.type === ElementType.BUTTON ? (react_1.default.createElement(CustomButton_1.default, __assign({}, element, { isLoading: isLoading }))) : element.type === ElementType.AUTOCOMPLETEINPUT ? (react_1.default.createElement(CustomAutocompleteInput_1.default, __assign({}, element))) : element.type === ElementType.FILEUPLOADER ? (
|
213
225
|
// FILEUPLOADER elemanı için CustomFileUploader'ı render ediyoruz
|
214
226
|
react_1.default.createElement(react_1.default.Fragment, null,
|
215
227
|
react_1.default.createElement(CustomFileUploader_1.default, { url: element.url, multi: element.multi, allowedTypes: element.allowedTypes, maxFile: element.maxFile, maxSize: element.maxSize, onUploadComplete: element.onUploadComplete, onRemoveUploaded: element.onRemoveUploaded, onPendingChange: element.onPendingChange, label: element.label }))) : null)); })));
|
@@ -37,15 +37,16 @@ var fa_1 = require("react-icons/fa");
|
|
37
37
|
require("../assets/css/custom-select.css");
|
38
38
|
var CustomSelect = function (_a) {
|
39
39
|
var _b;
|
40
|
-
var id = _a.id, name = _a.name, label = _a.label, options = _a.options, value = _a.value, _c = _a.searchable, searchable = _c === void 0 ? true : _c, _d = _a.required, required = _d === void 0 ? false : _d, _e = _a.multiple, multiple = _e === void 0 ? false : _e, _f = _a.placeholder, placeholder = _f === void 0 ? "Seçiniz..." : _f, errorMessage = _a.errorMessage, conditionalErrorVisible = _a.conditionalErrorVisible, conditionalErrorMessage = _a.conditionalErrorMessage, tooltip = _a.tooltip, description = _a.description, _g = _a.disabled, disabled = _g === void 0 ? false : _g, className = _a.className, mainClass = _a.mainClass, style = _a.style, mainStyle = _a.mainStyle, onChange = _a.onChange;
|
40
|
+
var id = _a.id, name = _a.name, label = _a.label, options = _a.options, value = _a.value, _c = _a.searchable, searchable = _c === void 0 ? true : _c, _d = _a.required, required = _d === void 0 ? false : _d, _e = _a.multiple, multiple = _e === void 0 ? false : _e, _f = _a.placeholder, placeholder = _f === void 0 ? "Seçiniz..." : _f, errorMessage = _a.errorMessage, conditionalErrorVisible = _a.conditionalErrorVisible, conditionalErrorMessage = _a.conditionalErrorMessage, tooltip = _a.tooltip, description = _a.description, _g = _a.disabled, disabled = _g === void 0 ? false : _g, className = _a.className, mainClass = _a.mainClass, style = _a.style, mainStyle = _a.mainStyle, submitted = _a.submitted, onChange = _a.onChange;
|
41
41
|
var _h = (0, react_1.useState)(""), inputValue = _h[0], setInputValue = _h[1];
|
42
42
|
var _j = (0, react_1.useState)(false), dropdownVisible = _j[0], setDropdownVisible = _j[1];
|
43
|
+
// Dropdown genişliği için
|
43
44
|
var _k = (0, react_1.useState)(undefined), dropdownWidth = _k[0], setDropdownWidth = _k[1];
|
44
|
-
var _l = (0, react_1.useState)(false), isInvalid = _l[0], setIsInvalid = _l[1];
|
45
|
+
var _l = (0, react_1.useState)(false), isInvalid = _l[0], setIsInvalid = _l[1];
|
45
46
|
var containerRef = (0, react_1.useRef)(null);
|
46
47
|
var currentValues = Array.isArray(value) ? value : [value];
|
47
48
|
var selectedValue = Array.isArray(value) ? value[0] : value;
|
48
|
-
//
|
49
|
+
// Kapsayıcının genişliğini ölç
|
49
50
|
(0, react_1.useEffect)(function () {
|
50
51
|
var updateDropdownWidth = function () {
|
51
52
|
if (containerRef.current) {
|
@@ -62,10 +63,11 @@ var CustomSelect = function (_a) {
|
|
62
63
|
window.removeEventListener("resize", updateDropdownWidth);
|
63
64
|
};
|
64
65
|
}, [containerRef.current]);
|
65
|
-
//
|
66
|
+
// Dış tıklamada dropdown'ı kapat
|
66
67
|
(0, react_1.useEffect)(function () {
|
67
68
|
var handleClickOutside = function (event) {
|
68
|
-
if (containerRef.current &&
|
69
|
+
if (containerRef.current &&
|
70
|
+
!containerRef.current.contains(event.target)) {
|
69
71
|
setDropdownVisible(false);
|
70
72
|
}
|
71
73
|
};
|
@@ -74,55 +76,36 @@ var CustomSelect = function (_a) {
|
|
74
76
|
document.removeEventListener("mousedown", handleClickOutside);
|
75
77
|
};
|
76
78
|
}, []);
|
77
|
-
|
78
|
-
var toggleValue = function (selectedValue) {
|
79
|
+
var toggleValue = function (selectedVal) {
|
79
80
|
if (multiple) {
|
80
|
-
var newValue = currentValues.includes(
|
81
|
-
? currentValues.filter(function (v) { return v !==
|
82
|
-
: __spreadArray(__spreadArray([], currentValues, true), [
|
81
|
+
var newValue = currentValues.includes(selectedVal)
|
82
|
+
? currentValues.filter(function (v) { return v !== selectedVal; })
|
83
|
+
: __spreadArray(__spreadArray([], currentValues, true), [selectedVal], false);
|
83
84
|
onChange(newValue);
|
84
85
|
}
|
85
86
|
else {
|
86
|
-
onChange(
|
87
|
+
onChange(selectedVal);
|
87
88
|
setDropdownVisible(false);
|
88
89
|
}
|
89
90
|
setInputValue("");
|
90
91
|
};
|
91
|
-
// Arama filtresi
|
92
92
|
var filteredOptions = options.filter(function (option) {
|
93
93
|
return option.label.toLowerCase().includes(inputValue.toLowerCase());
|
94
94
|
});
|
95
|
-
// "onInvalid" ve "onInput" event’lerini kullanarak validasyon durumunu yönetiyoruz
|
96
95
|
var handleInvalid = function () {
|
97
96
|
setIsInvalid(true);
|
98
97
|
};
|
99
98
|
var handleInput = function () {
|
100
|
-
// Herhangi bir şey yazıldığında veya değiştiğinde validasyonu sıfırlayabilirsiniz
|
101
99
|
setIsInvalid(false);
|
102
100
|
};
|
103
101
|
return (react_1.default.createElement("div", { className: mainClass, style: mainStyle, ref: containerRef },
|
104
102
|
react_1.default.createElement("div", { className: "form-group" },
|
105
103
|
react_1.default.createElement("label", { htmlFor: id, className: "form-label" }, label),
|
106
|
-
react_1.default.createElement("div", {
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
// Array.isArray(value)
|
112
|
-
// ? value.length > 0
|
113
|
-
// ? "is-valid"
|
114
|
-
// : "is-invalid"
|
115
|
-
// : value
|
116
|
-
// ? "is-valid"
|
117
|
-
// : "is-invalid"
|
118
|
-
// }`}
|
119
|
-
className: "select-container form-control ".concat(disabled ? "disabled" : "", " \n ").concat(Array.isArray(value)
|
120
|
-
? value.length > 0
|
121
|
-
? "is-valid"
|
122
|
-
: "is-invalid"
|
123
|
-
: value
|
124
|
-
? "is-valid"
|
125
|
-
: "is-invalid"), onClick: function () { return !disabled && setDropdownVisible(!dropdownVisible); }, style: { cursor: disabled ? "not-allowed" : "pointer" } }, multiple ? (currentValues.length > 0 ? (currentValues.map(function (val) {
|
104
|
+
react_1.default.createElement("div", { className: "select-container form-control ".concat(disabled ? "disabled" : "", " \n ").concat(submitted
|
105
|
+
? (Array.isArray(value)
|
106
|
+
? (value.length > 0 ? "is-valid" : "is-invalid")
|
107
|
+
: (value ? "is-valid" : "is-invalid"))
|
108
|
+
: ""), onClick: function () { return !disabled && setDropdownVisible(!dropdownVisible); }, style: { cursor: disabled ? "not-allowed" : "pointer" } }, multiple ? (currentValues.length > 0 ? (currentValues.map(function (val) {
|
126
109
|
var option = options.find(function (opt) { return opt.value === val; });
|
127
110
|
return (react_1.default.createElement("span", { key: val, className: "badge bg-primary m-1" },
|
128
111
|
react_1.default.createElement("span", null, option === null || option === void 0 ? void 0 : option.label),
|
@@ -143,15 +126,33 @@ var CustomSelect = function (_a) {
|
|
143
126
|
position: "absolute",
|
144
127
|
zIndex: 10,
|
145
128
|
width: dropdownWidth,
|
146
|
-
|
147
|
-
overflowY: "auto", // Fazla seçenekler dikey scroll ile görünür
|
129
|
+
overflow: "visible", // Dışa taşmasına izin ver
|
148
130
|
} },
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
131
|
+
react_1.default.createElement("div", { style: {
|
132
|
+
maxHeight: "200px",
|
133
|
+
overflowY: "auto",
|
134
|
+
//paddingBottom: "40px", // Kapama butonunun yer açması için
|
135
|
+
} },
|
136
|
+
searchable && (react_1.default.createElement("input", { type: "text", placeholder: "Ara...", className: "form-control search-input", value: inputValue, onChange: function (e) { return setInputValue(e.target.value); } })),
|
137
|
+
filteredOptions.length > 0 ? (filteredOptions.map(function (option) { return (react_1.default.createElement("div", { key: option.id, className: "dropdown-item ".concat(currentValues.includes(option.value) ? "selected" : ""), onClick: function () { return toggleValue(option.value); } },
|
138
|
+
currentValues.includes(option.value) && react_1.default.createElement(fa_1.FaCheck, { className: "me-2 text-success" }),
|
139
|
+
option.label)); })) : (react_1.default.createElement("div", { className: "dropdown-item text-muted" }, "Uygun se\u00E7enek yok"))),
|
140
|
+
react_1.default.createElement("button", { type: "button", className: "dropdown-close-btn", style: {
|
141
|
+
position: "absolute",
|
142
|
+
bottom: "0",
|
143
|
+
right: "0",
|
144
|
+
transform: "translate(50%, 50%)",
|
145
|
+
border: "none",
|
146
|
+
backgroundColor: "#ccc",
|
147
|
+
borderRadius: "50%",
|
148
|
+
width: "30px",
|
149
|
+
height: "30px",
|
150
|
+
display: "flex",
|
151
|
+
alignItems: "center",
|
152
|
+
justifyContent: "center",
|
153
|
+
cursor: "pointer",
|
154
|
+
}, onClick: function () { return setDropdownVisible(false); } },
|
155
|
+
react_1.default.createElement(fa_1.FaTimes, null)))),
|
155
156
|
react_1.default.createElement("div", { className: "invalid-feedback text-danger mt-2" },
|
156
157
|
react_1.default.createElement("div", { className: "description-icon" },
|
157
158
|
react_1.default.createElement(fa_1.FaExclamationTriangle, null)),
|