albinasoft-ui-package 1.1.37 → 1.1.39
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.
@@ -44,4 +44,19 @@
|
|
44
44
|
.dark .dropdown-item:hover {
|
45
45
|
background: #151824;
|
46
46
|
}
|
47
|
-
|
47
|
+
|
48
|
+
/* custom-search-input */
|
49
|
+
.custom-search-input {
|
50
|
+
font-size: 1rem;
|
51
|
+
border: 2px solid #007bff;
|
52
|
+
border-radius: 4px;
|
53
|
+
}
|
54
|
+
|
55
|
+
.custom-search-input::placeholder {
|
56
|
+
color: #6c757d;
|
57
|
+
font-style: italic;
|
58
|
+
}
|
59
|
+
|
60
|
+
.custom-search-input:focus {
|
61
|
+
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
|
62
|
+
}
|
@@ -55,6 +55,11 @@ export interface CustomFileUploaderProps {
|
|
55
55
|
* Eğer bu prop’un değeri değişirse uploader içini temizle
|
56
56
|
*/
|
57
57
|
clearTrigger?: any;
|
58
|
+
/**
|
59
|
+
* Yükleme işlemi sırasında yükleme durumunu parent'a bildirmek için callback.
|
60
|
+
* Bu, yükleme işlemi başladığında ve bittiğinde çağrılabilir.
|
61
|
+
*/
|
62
|
+
onUploadingChange?: (uploading: boolean) => void;
|
58
63
|
}
|
59
64
|
declare const CustomFileUploader: React.FC<CustomFileUploaderProps>;
|
60
65
|
export default CustomFileUploader;
|
@@ -222,7 +222,7 @@ var isAllowedFileType = function (file, allowedType) {
|
|
222
222
|
// CustomFileUploader Bileşeni
|
223
223
|
// ====================
|
224
224
|
var CustomFileUploader = function (props) {
|
225
|
-
var url = props.url, multi = props.multi, allowedTypes = props.allowedTypes, maxFile = props.maxFile, maxSize = props.maxSize, onUploadComplete = props.onUploadComplete, onRemoveUploaded = props.onRemoveUploaded, label = props.label, onPendingChange = props.onPendingChange, translations = props.translations, clearTrigger = props.clearTrigger;
|
225
|
+
var url = props.url, multi = props.multi, allowedTypes = props.allowedTypes, maxFile = props.maxFile, maxSize = props.maxSize, onUploadComplete = props.onUploadComplete, onRemoveUploaded = props.onRemoveUploaded, label = props.label, onPendingChange = props.onPendingChange, translations = props.translations, clearTrigger = props.clearTrigger, onUploadingChange = props.onUploadingChange;
|
226
226
|
// Varsayılan çeviri metinlerini, gelen prop ile birleştiriyoruz.
|
227
227
|
var finalTranslations = __assign(__assign({}, exports.defaultTranslations), translations);
|
228
228
|
var _a = (0, react_1.useState)([]), previews = _a[0], setPreviews = _a[1];
|
@@ -342,6 +342,7 @@ var CustomFileUploader = function (props) {
|
|
342
342
|
return __generator(this, function (_a) {
|
343
343
|
switch (_a.label) {
|
344
344
|
case 0:
|
345
|
+
onUploadingChange === null || onUploadingChange === void 0 ? void 0 : onUploadingChange(true);
|
345
346
|
filesToUpload = previews.filter(function (item) { return !item.uploaded; }).map(function (item) { return item.file; });
|
346
347
|
if (filesToUpload.length === 0) {
|
347
348
|
react_toastify_1.toast.warning(finalTranslations.noFileSelectedWarning);
|
@@ -359,7 +360,7 @@ var CustomFileUploader = function (props) {
|
|
359
360
|
});
|
360
361
|
_a.label = 1;
|
361
362
|
case 1:
|
362
|
-
_a.trys.push([1, 7, ,
|
363
|
+
_a.trys.push([1, 7, 8, 9]);
|
363
364
|
return [4 /*yield*/, fetch(url, {
|
364
365
|
method: "POST",
|
365
366
|
body: formData,
|
@@ -400,13 +401,16 @@ var CustomFileUploader = function (props) {
|
|
400
401
|
console.error("API Hatası:", errorData);
|
401
402
|
react_toastify_1.toast.error(finalTranslations.uploadErrorToast);
|
402
403
|
_a.label = 6;
|
403
|
-
case 6: return [3 /*break*/,
|
404
|
+
case 6: return [3 /*break*/, 9];
|
404
405
|
case 7:
|
405
406
|
error_1 = _a.sent();
|
406
407
|
console.error("API çağrısında hata:", error_1);
|
407
408
|
react_toastify_1.toast.error(finalTranslations.uploadErrorToast);
|
408
|
-
return [3 /*break*/,
|
409
|
-
case 8:
|
409
|
+
return [3 /*break*/, 9];
|
410
|
+
case 8:
|
411
|
+
onUploadingChange === null || onUploadingChange === void 0 ? void 0 : onUploadingChange(false);
|
412
|
+
return [7 /*endfinally*/];
|
413
|
+
case 9: return [2 /*return*/];
|
410
414
|
}
|
411
415
|
});
|
412
416
|
}); };
|
@@ -121,6 +121,7 @@ var CustomForm = function (_a) {
|
|
121
121
|
var formRef = (0, react_1.useRef)(null);
|
122
122
|
var _f = (0, react_1.useState)(false), isLoading = _f[0], setIsLoading = _f[1];
|
123
123
|
var _g = (0, react_1.useState)(false), submitted = _g[0], setSubmitted = _g[1];
|
124
|
+
var _h = (0, react_1.useState)(false), isUploading = _h[0], setIsUploading = _h[1];
|
124
125
|
var handleConfirm = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
125
126
|
var form, customSelectValid, isValid, formValues_1, error_1;
|
126
127
|
return __generator(this, function (_a) {
|
@@ -229,14 +230,14 @@ var CustomForm = function (_a) {
|
|
229
230
|
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.SIMPLESELECT ? (react_1.default.createElement(CustomSimpleSelect_1.default, __assign({}, element, { value: Array.isArray(element.value) ? element.value[0] || "" : "", onChange: function (val) { return element.onChange(val); } }))) : element.type === ElementType.DATETIMEPICKER ? (react_1.default.createElement(CustomDateTimePicker_1.default, __assign({}, element, { submitted: submitted }))) : 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.PHONE ? (react_1.default.createElement(CustomPhoneInput_1.default, __assign({}, element))) : element.type === ElementType.FILEUPLOADER ? (
|
230
231
|
// FILEUPLOADER elemanı için CustomFileUploader'ı render ediyoruz
|
231
232
|
react_1.default.createElement(react_1.default.Fragment, null,
|
232
|
-
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, clearTrigger: element.clearTrigger, label: element.label, translations: element.translations }))) : null)); })));
|
233
|
+
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, clearTrigger: element.clearTrigger, label: element.label, translations: element.translations, onUploadingChange: setIsUploading }))) : null)); })));
|
233
234
|
})));
|
234
235
|
})));
|
235
236
|
}),
|
236
237
|
(showConfirmButton || showCancelButton) && (react_1.default.createElement("div", { className: "card-footer mt-3" },
|
237
238
|
react_1.default.createElement("div", { className: "form-actions mt-3", style: { display: "flex", justifyContent: "flex-end", gap: "10px" } },
|
238
|
-
showCancelButton && (react_1.default.createElement(CustomButton_1.default, { label: cancelLabel, className: "btn btn-secondary", onClick: handleCancel || (function () { }), isLoading: isLoading })),
|
239
|
-
showConfirmButton && (react_1.default.createElement(CustomButton_1.default, { label: confirmLabel, className: "btn btn-primary", onClick: handleConfirm, isLoading: isLoading })))))));
|
239
|
+
showCancelButton && (react_1.default.createElement(CustomButton_1.default, { label: cancelLabel, className: "btn btn-secondary", onClick: handleCancel || (function () { }), isLoading: isLoading || isUploading })),
|
240
|
+
showConfirmButton && (react_1.default.createElement(CustomButton_1.default, { label: confirmLabel, className: "btn btn-primary", onClick: handleConfirm, isLoading: isLoading || isUploading })))))));
|
240
241
|
};
|
241
242
|
exports.CustomForm = CustomForm;
|
242
243
|
exports.default = CustomForm;
|