albinasoft-ui-package 1.1.55 → 1.1.57
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/components/CustomFileUploader.d.ts +2 -2
- package/dist/components/CustomFileUploader.js +13 -15
- package/dist/components/CustomForm.d.ts +2 -0
- package/dist/components/CustomForm.js +6 -5
- package/dist/index.d.ts +8 -6
- package/dist/index.js +14 -11
- package/dist/types/notify.d.ts +6 -0
- package/dist/types/notify.js +8 -0
- package/package.json +2 -4
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import { Notify } from "../types/notify";
|
2
3
|
export declare enum AllowedTypes {
|
3
4
|
PDF = "pdf",
|
4
5
|
FILE = "file",
|
@@ -61,8 +62,7 @@ export interface CustomFileUploaderProps {
|
|
61
62
|
* Bu, yükleme işlemi başladığında ve bittiğinde çağrılabilir.
|
62
63
|
*/
|
63
64
|
onUploadingChange?: (uploading: boolean) => void;
|
64
|
-
|
65
|
-
toastContainerId?: string;
|
65
|
+
onNotify?: Notify;
|
66
66
|
}
|
67
67
|
export type CustomFileUploaderHandle = {
|
68
68
|
/** Pending dosya varsa toast gösterir ve false döner. */
|
@@ -85,8 +85,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
85
|
exports.defaultTranslations = exports.AllowedTypes = void 0;
|
86
86
|
// CustomFileUploader.tsx
|
87
87
|
var react_1 = __importStar(require("react"));
|
88
|
-
// import { toast } from "react-toastify";
|
89
|
-
var react_toastify_1 = require("react-toastify");
|
90
88
|
var fa_1 = require("react-icons/fa");
|
91
89
|
var CustomButton_1 = __importDefault(require("./CustomButton"));
|
92
90
|
// ====================
|
@@ -224,8 +222,7 @@ var isAllowedFileType = function (file, allowedType) {
|
|
224
222
|
// CustomFileUploader Bileşeni
|
225
223
|
// ====================
|
226
224
|
var CustomFileUploader = (0, react_1.forwardRef)(function (props, ref) {
|
227
|
-
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,
|
228
|
-
var toastOpts = toastContainerId ? { containerId: toastContainerId } : undefined;
|
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, onNotify = props.onNotify;
|
229
226
|
// Varsayılan çeviri metinlerini, gelen prop ile birleştiriyoruz.
|
230
227
|
var finalTranslations = __assign(__assign({}, exports.defaultTranslations), translations);
|
231
228
|
var _a = (0, react_1.useState)([]), previews = _a[0], setPreviews = _a[1];
|
@@ -235,12 +232,12 @@ var CustomFileUploader = (0, react_1.forwardRef)(function (props, ref) {
|
|
235
232
|
validateReady: function () {
|
236
233
|
var hasPending = previews.some(function (p) { return !p.uploaded; });
|
237
234
|
if (hasPending) {
|
238
|
-
|
235
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.warning(finalTranslations.pendingBeforeSubmitWarning || exports.defaultTranslations.pendingBeforeSubmitWarning);
|
239
236
|
return false;
|
240
237
|
}
|
241
238
|
return true;
|
242
239
|
}
|
243
|
-
}); }, [previews, finalTranslations]);
|
240
|
+
}); }, [previews, finalTranslations, onNotify]);
|
244
241
|
// CustomFileUploader.tsx içinde component’in üst kısmına, diğer handler’ların yanına ekleyin:
|
245
242
|
var handleClearAll = function () {
|
246
243
|
previews.forEach(function (item) {
|
@@ -282,22 +279,22 @@ var CustomFileUploader = (0, react_1.forwardRef)(function (props, ref) {
|
|
282
279
|
var currentCount = multi ? previews.length : (previews.length > 0 ? 1 : 0);
|
283
280
|
var availableSlots = multi ? maxFile - currentCount : (currentCount === 0 ? 1 : 0);
|
284
281
|
if (availableSlots <= 0) {
|
285
|
-
|
282
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.warning(finalTranslations.uploadWarningLimit);
|
286
283
|
return;
|
287
284
|
}
|
288
285
|
var filesToAdd = filesArray.slice(0, availableSlots);
|
289
286
|
if (filesArray.length > availableSlots) {
|
290
|
-
|
287
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.warning(finalTranslations.uploadWarningExceed + availableSlots);
|
291
288
|
}
|
292
289
|
var newPreviews = [];
|
293
290
|
filesToAdd.forEach(function (file, index) {
|
294
291
|
if (file.size > maxSize) {
|
295
292
|
// Dosya adını eklemek için file.name'i dışarıda ekliyoruz.
|
296
|
-
|
293
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.error(file.name + " " + finalTranslations.fileSizeError);
|
297
294
|
return;
|
298
295
|
}
|
299
296
|
if (!isAllowedFileType(file, allowedTypes)) {
|
300
|
-
|
297
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.error(file.name + " " + finalTranslations.fileTypeError);
|
301
298
|
return;
|
302
299
|
}
|
303
300
|
var isImg = allowedTypes === AllowedTypes.IMAGE || (allowedTypes === AllowedTypes.VISUAL && isImageFile(file));
|
@@ -359,7 +356,8 @@ var CustomFileUploader = (0, react_1.forwardRef)(function (props, ref) {
|
|
359
356
|
onUploadingChange === null || onUploadingChange === void 0 ? void 0 : onUploadingChange(true);
|
360
357
|
filesToUpload = previews.filter(function (item) { return !item.uploaded; }).map(function (item) { return item.file; });
|
361
358
|
if (filesToUpload.length === 0) {
|
362
|
-
|
359
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.warning(finalTranslations.noFileSelectedWarning);
|
360
|
+
onUploadingChange === null || onUploadingChange === void 0 ? void 0 : onUploadingChange(false);
|
363
361
|
return [2 /*return*/];
|
364
362
|
}
|
365
363
|
// Yüklenmeye başlayan dosyaları işaretle
|
@@ -403,23 +401,23 @@ var CustomFileUploader = (0, react_1.forwardRef)(function (props, ref) {
|
|
403
401
|
updatePendingStatus(updatedPreviews);
|
404
402
|
return updatedPreviews;
|
405
403
|
});
|
406
|
-
|
404
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.success(finalTranslations.uploadSuccessToast);
|
407
405
|
}
|
408
406
|
else {
|
409
|
-
|
407
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.error(finalTranslations.uploadErrorToast);
|
410
408
|
}
|
411
409
|
return [3 /*break*/, 6];
|
412
410
|
case 4: return [4 /*yield*/, response.json()];
|
413
411
|
case 5:
|
414
412
|
errorData = _a.sent();
|
415
413
|
console.error("API Hatası:", errorData);
|
416
|
-
|
414
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.error(finalTranslations.uploadErrorToast);
|
417
415
|
_a.label = 6;
|
418
416
|
case 6: return [3 /*break*/, 9];
|
419
417
|
case 7:
|
420
418
|
error_1 = _a.sent();
|
421
419
|
console.error("API çağrısında hata:", error_1);
|
422
|
-
|
420
|
+
onNotify === null || onNotify === void 0 ? void 0 : onNotify.error(finalTranslations.uploadErrorToast);
|
423
421
|
return [3 /*break*/, 9];
|
424
422
|
case 8:
|
425
423
|
onUploadingChange === null || onUploadingChange === void 0 ? void 0 : onUploadingChange(false);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import { Notify } from "../types/notify";
|
2
3
|
import { TreeNode } from "./CustomTreeView";
|
3
4
|
import { AllowedTypes, FileUploaderTranslations } from "./CustomFileUploader";
|
4
5
|
declare enum ElementType {
|
@@ -220,6 +221,7 @@ interface CustomFormProps {
|
|
220
221
|
showConfirmButton?: boolean;
|
221
222
|
showCancelButton?: boolean;
|
222
223
|
fileUploaderCheck?: () => boolean;
|
224
|
+
onNotify?: Notify;
|
223
225
|
}
|
224
226
|
declare const CustomForm: React.FC<CustomFormProps>;
|
225
227
|
export { CustomForm, ElementType };
|
@@ -76,7 +76,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
76
|
exports.ElementType = exports.CustomForm = void 0;
|
77
77
|
//CustomForm.tsx
|
78
78
|
var react_1 = __importStar(require("react"));
|
79
|
-
var
|
79
|
+
var notify_1 = require("../types/notify");
|
80
80
|
var CustomButton_1 = __importDefault(require("./CustomButton"));
|
81
81
|
var CustomInput_1 = __importDefault(require("./CustomInput"));
|
82
82
|
var CustomTextarea_1 = __importDefault(require("./CustomTextarea"));
|
@@ -118,7 +118,8 @@ var CustomForm = function (_a) {
|
|
118
118
|
handleCancel = _a.handleCancel, _d = _a.showConfirmButton, showConfirmButton = _d === void 0 ? true : _d, // Varsayılan olarak görünür
|
119
119
|
_e = _a.showCancelButton, // Varsayılan olarak görünür
|
120
120
|
showCancelButton = _e === void 0 ? false : _e, // Varsayılan olarak görünür
|
121
|
-
fileUploaderCheck = _a.fileUploaderCheck;
|
121
|
+
fileUploaderCheck = _a.fileUploaderCheck, onNotify = _a.onNotify;
|
122
|
+
var notify = onNotify !== null && onNotify !== void 0 ? onNotify : notify_1.noopNotify;
|
122
123
|
var formRef = (0, react_1.useRef)(null);
|
123
124
|
var _f = (0, react_1.useState)(false), isLoading = _f[0], setIsLoading = _f[1];
|
124
125
|
var _g = (0, react_1.useState)(false), submitted = _g[0], setSubmitted = _g[1];
|
@@ -222,14 +223,14 @@ var CustomForm = function (_a) {
|
|
222
223
|
return [3 /*break*/, 5];
|
223
224
|
case 3:
|
224
225
|
error_1 = _b.sent();
|
225
|
-
|
226
|
+
notify.error("Form gönderimi sırasında bir hata oluştu.");
|
226
227
|
return [3 /*break*/, 5];
|
227
228
|
case 4:
|
228
229
|
setIsLoading(false);
|
229
230
|
return [7 /*endfinally*/];
|
230
231
|
case 5: return [3 /*break*/, 7];
|
231
232
|
case 6:
|
232
|
-
|
233
|
+
notify.error("Gerekli tüm alanları doldurunuz.");
|
233
234
|
form.classList.add("was-validated");
|
234
235
|
_b.label = 7;
|
235
236
|
case 7: return [2 /*return*/];
|
@@ -264,7 +265,7 @@ var CustomForm = function (_a) {
|
|
264
265
|
} }))) : 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, { submitted: submitted }))) : 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 ? (
|
265
266
|
// FILEUPLOADER elemanı için CustomFileUploader'ı render ediyoruz
|
266
267
|
react_1.default.createElement(react_1.default.Fragment, null,
|
267
|
-
react_1.default.createElement(CustomFileUploader_1.default, { ref: getUploaderRefCb(element.id), 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,
|
268
|
+
react_1.default.createElement(CustomFileUploader_1.default, { ref: getUploaderRefCb(element.id), 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, onNotify: onNotify }))) : null)); })));
|
268
269
|
})));
|
269
270
|
})));
|
270
271
|
}),
|
package/dist/index.d.ts
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
import AlbinaForm from './components/AlbinaForm';
|
2
|
+
import CustomAutocompleteInput from './components/CustomAutocompleteInput';
|
2
3
|
import CustomButton from './components/CustomButton';
|
3
4
|
import CustomCheckbox from './components/CustomCheckbox';
|
5
|
+
import CustomDatatable from './components/CustomDatatable';
|
4
6
|
import CustomDateTimePicker from './components/CustomDateTimePicker';
|
5
7
|
import CustomDivider from './components/CustomDivider';
|
6
|
-
import
|
8
|
+
import CustomFileUploader from './components/CustomFileUploader';
|
7
9
|
import CustomInput from './components/CustomInput';
|
8
10
|
import CustomModal from './components/CustomModal';
|
9
11
|
import CustomPhoneInput from './components/CustomPhoneInput';
|
12
|
+
import CustomProgressBar from './components/CustomProgressBar';
|
10
13
|
import CustomRadioButton from './components/CustomRadioButton';
|
11
14
|
import CustomRichTextbox from './components/CustomRichTextbox';
|
12
15
|
import CustomSelect from './components/CustomSelect';
|
@@ -14,9 +17,8 @@ import CustomSimpleSelect from './components/CustomSimpleSelect';
|
|
14
17
|
import CustomTab from './components/CustomTab';
|
15
18
|
import CustomText from './components/CustomText';
|
16
19
|
import CustomTextarea from './components/CustomTextarea';
|
17
|
-
import CustomTreeView from './components/CustomTreeView';
|
18
|
-
import CustomAutocompleteInput from './components/CustomAutocompleteInput';
|
19
|
-
import CustomProgressBar from './components/CustomProgressBar';
|
20
20
|
import CustomTimeline from './components/CustomTimeline';
|
21
|
-
import
|
22
|
-
export { AlbinaForm, CustomButton, CustomCheckbox, CustomDateTimePicker, CustomDivider,
|
21
|
+
import CustomTreeView from './components/CustomTreeView';
|
22
|
+
export { AlbinaForm, CustomAutocompleteInput, CustomButton, CustomCheckbox, CustomDatatable, CustomDateTimePicker, CustomDivider, CustomFileUploader, CustomInput, CustomModal, CustomPhoneInput, CustomProgressBar, CustomRadioButton, CustomRichTextbox, CustomSelect, CustomSimpleSelect, CustomTab, CustomText, CustomTextarea, CustomTimeline, CustomTreeView, };
|
23
|
+
export type { Notify, noopNotify } from "./types/notify";
|
24
|
+
export { default as CustomForm, ElementType } from './components/CustomForm';
|
package/dist/index.js
CHANGED
@@ -3,25 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
6
|
+
exports.ElementType = exports.CustomForm = exports.CustomTreeView = exports.CustomTimeline = exports.CustomTextarea = exports.CustomText = exports.CustomTab = exports.CustomSimpleSelect = exports.CustomSelect = exports.CustomRichTextbox = exports.CustomRadioButton = exports.CustomProgressBar = exports.CustomPhoneInput = exports.CustomModal = exports.CustomInput = exports.CustomFileUploader = exports.CustomDivider = exports.CustomDateTimePicker = exports.CustomDatatable = exports.CustomCheckbox = exports.CustomButton = exports.CustomAutocompleteInput = exports.AlbinaForm = void 0;
|
7
7
|
var AlbinaForm_1 = __importDefault(require("./components/AlbinaForm"));
|
8
8
|
exports.AlbinaForm = AlbinaForm_1.default;
|
9
|
+
var CustomAutocompleteInput_1 = __importDefault(require("./components/CustomAutocompleteInput"));
|
10
|
+
exports.CustomAutocompleteInput = CustomAutocompleteInput_1.default;
|
9
11
|
var CustomButton_1 = __importDefault(require("./components/CustomButton"));
|
10
12
|
exports.CustomButton = CustomButton_1.default;
|
11
13
|
var CustomCheckbox_1 = __importDefault(require("./components/CustomCheckbox"));
|
12
14
|
exports.CustomCheckbox = CustomCheckbox_1.default;
|
15
|
+
var CustomDatatable_1 = __importDefault(require("./components/CustomDatatable"));
|
16
|
+
exports.CustomDatatable = CustomDatatable_1.default;
|
13
17
|
var CustomDateTimePicker_1 = __importDefault(require("./components/CustomDateTimePicker"));
|
14
18
|
exports.CustomDateTimePicker = CustomDateTimePicker_1.default;
|
15
19
|
var CustomDivider_1 = __importDefault(require("./components/CustomDivider"));
|
16
20
|
exports.CustomDivider = CustomDivider_1.default;
|
17
|
-
var
|
18
|
-
exports.
|
21
|
+
var CustomFileUploader_1 = __importDefault(require("./components/CustomFileUploader"));
|
22
|
+
exports.CustomFileUploader = CustomFileUploader_1.default;
|
19
23
|
var CustomInput_1 = __importDefault(require("./components/CustomInput"));
|
20
24
|
exports.CustomInput = CustomInput_1.default;
|
21
25
|
var CustomModal_1 = __importDefault(require("./components/CustomModal"));
|
22
26
|
exports.CustomModal = CustomModal_1.default;
|
23
27
|
var CustomPhoneInput_1 = __importDefault(require("./components/CustomPhoneInput"));
|
24
28
|
exports.CustomPhoneInput = CustomPhoneInput_1.default;
|
29
|
+
var CustomProgressBar_1 = __importDefault(require("./components/CustomProgressBar"));
|
30
|
+
exports.CustomProgressBar = CustomProgressBar_1.default;
|
25
31
|
var CustomRadioButton_1 = __importDefault(require("./components/CustomRadioButton"));
|
26
32
|
exports.CustomRadioButton = CustomRadioButton_1.default;
|
27
33
|
var CustomRichTextbox_1 = __importDefault(require("./components/CustomRichTextbox"));
|
@@ -36,13 +42,10 @@ var CustomText_1 = __importDefault(require("./components/CustomText"));
|
|
36
42
|
exports.CustomText = CustomText_1.default;
|
37
43
|
var CustomTextarea_1 = __importDefault(require("./components/CustomTextarea"));
|
38
44
|
exports.CustomTextarea = CustomTextarea_1.default;
|
39
|
-
var CustomTreeView_1 = __importDefault(require("./components/CustomTreeView"));
|
40
|
-
exports.CustomTreeView = CustomTreeView_1.default;
|
41
|
-
var CustomAutocompleteInput_1 = __importDefault(require("./components/CustomAutocompleteInput"));
|
42
|
-
exports.CustomAutocompleteInput = CustomAutocompleteInput_1.default;
|
43
|
-
var CustomProgressBar_1 = __importDefault(require("./components/CustomProgressBar"));
|
44
|
-
exports.CustomProgressBar = CustomProgressBar_1.default;
|
45
45
|
var CustomTimeline_1 = __importDefault(require("./components/CustomTimeline"));
|
46
46
|
exports.CustomTimeline = CustomTimeline_1.default;
|
47
|
-
var
|
48
|
-
exports.
|
47
|
+
var CustomTreeView_1 = __importDefault(require("./components/CustomTreeView"));
|
48
|
+
exports.CustomTreeView = CustomTreeView_1.default;
|
49
|
+
var CustomForm_1 = require("./components/CustomForm");
|
50
|
+
Object.defineProperty(exports, "CustomForm", { enumerable: true, get: function () { return __importDefault(CustomForm_1).default; } });
|
51
|
+
Object.defineProperty(exports, "ElementType", { enumerable: true, get: function () { return CustomForm_1.ElementType; } });
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "albinasoft-ui-package",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.57",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"types": "dist/index.d.ts",
|
6
6
|
"scripts": {
|
@@ -25,7 +25,6 @@
|
|
25
25
|
"devDependencies": {
|
26
26
|
"react": "^18.0.0",
|
27
27
|
"react-dom": "^18.0.0",
|
28
|
-
"react-toastify": "^10.0.6",
|
29
28
|
"@types/react": "^19.0.1",
|
30
29
|
"@types/react-bootstrap": "^0.32.37",
|
31
30
|
"@types/react-input-mask": "^3.0.6",
|
@@ -34,8 +33,7 @@
|
|
34
33
|
},
|
35
34
|
"peerDependencies": {
|
36
35
|
"react": "^18.0.0",
|
37
|
-
"react-dom": "^18.0.0"
|
38
|
-
"react-toastify": "^10.0.0"
|
36
|
+
"react-dom": "^18.0.0"
|
39
37
|
},
|
40
38
|
"files": [
|
41
39
|
"dist"
|