albinasoft-ui-package 1.1.42 → 1.1.44
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/LICENSE +21 -21
- package/dist/assets/css/custom-autocomplete-input.css +49 -49
- package/dist/assets/css/custom-datatable.css +2 -2
- package/dist/assets/css/custom-datetime-picker.css +779 -779
- package/dist/assets/css/custom-progress-bar.css +37 -37
- package/dist/assets/css/custom-select.css +62 -62
- package/dist/assets/css/custom-simple-select.css +117 -117
- package/dist/assets/css/custom-timeline.css +43 -43
- package/dist/assets/css/custom-treeview.css +84 -0
- package/dist/assets/css/dark.css +2159 -2159
- package/dist/assets/css/main.css +26664 -26664
- package/dist/components/AlbinaForm.d.ts +28 -28
- package/dist/components/AlbinaForm.js +88 -88
- package/dist/components/CustomAutocompleteInput.d.ts +23 -23
- package/dist/components/CustomAutocompleteInput.js +185 -185
- package/dist/components/CustomButton.d.ts +14 -14
- package/dist/components/CustomButton.js +98 -98
- package/dist/components/CustomCheckbox.d.ts +20 -20
- package/dist/components/CustomCheckbox.js +58 -58
- package/dist/components/CustomDatatable.d.ts +42 -42
- package/dist/components/CustomDatatable.js +92 -92
- package/dist/components/CustomDateTimePicker.d.ts +33 -33
- package/dist/components/CustomDateTimePicker.js +91 -91
- package/dist/components/CustomDivider.d.ts +51 -51
- package/dist/components/CustomDivider.js +87 -87
- package/dist/components/CustomFileUploader.d.ts +65 -65
- package/dist/components/CustomFileUploader.js +460 -460
- package/dist/components/CustomForm.d.ts +225 -225
- package/dist/components/CustomForm.js +259 -243
- package/dist/components/CustomInput.d.ts +37 -37
- package/dist/components/CustomInput.js +85 -85
- package/dist/components/CustomModal.d.ts +15 -15
- package/dist/components/CustomModal.js +17 -17
- package/dist/components/CustomPhoneInput.d.ts +29 -29
- package/dist/components/CustomPhoneInput.js +251 -251
- package/dist/components/CustomProgressBar.d.ts +9 -9
- package/dist/components/CustomProgressBar.js +40 -40
- package/dist/components/CustomRadioButton.d.ts +25 -25
- package/dist/components/CustomRadioButton.js +34 -34
- package/dist/components/CustomRichTextbox.d.ts +14 -14
- package/dist/components/CustomRichTextbox.js +89 -89
- package/dist/components/CustomSelect.d.ts +32 -32
- package/dist/components/CustomSelect.js +193 -191
- package/dist/components/CustomSimpleSelect.d.ts +21 -21
- package/dist/components/CustomSimpleSelect.js +64 -64
- package/dist/components/CustomTab.d.ts +44 -44
- package/dist/components/CustomTab.js +122 -122
- package/dist/components/CustomText.d.ts +72 -72
- package/dist/components/CustomText.js +158 -158
- package/dist/components/CustomTextarea.d.ts +22 -22
- package/dist/components/CustomTextarea.js +33 -33
- package/dist/components/CustomTimeline.d.ts +30 -30
- package/dist/components/CustomTimeline.js +80 -80
- package/dist/components/CustomTreeView.d.ts +20 -22
- package/dist/components/CustomTreeView.js +168 -157
- package/dist/index.d.ts +22 -22
- package/dist/index.js +48 -48
- package/package.json +44 -43
- package/readme.md +9 -9
@@ -1,243 +1,259 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
3
|
-
__assign = Object.assign || function(t) {
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
-
s = arguments[i];
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
-
t[p] = s[p];
|
8
|
-
}
|
9
|
-
return t;
|
10
|
-
};
|
11
|
-
return __assign.apply(this, arguments);
|
12
|
-
};
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
-
if (k2 === undefined) k2 = k;
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
18
|
-
}
|
19
|
-
Object.defineProperty(o, k2, desc);
|
20
|
-
}) : (function(o, m, k, k2) {
|
21
|
-
if (k2 === undefined) k2 = k;
|
22
|
-
o[k2] = m[k];
|
23
|
-
}));
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
26
|
-
}) : function(o, v) {
|
27
|
-
o["default"] = v;
|
28
|
-
});
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
30
|
-
if (mod && mod.__esModule) return mod;
|
31
|
-
var result = {};
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
33
|
-
__setModuleDefault(result, mod);
|
34
|
-
return result;
|
35
|
-
};
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
43
|
-
});
|
44
|
-
};
|
45
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
47
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
48
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
49
|
-
function step(op) {
|
50
|
-
if (f) throw new TypeError("Generator is already executing.");
|
51
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
52
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
53
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
54
|
-
switch (op[0]) {
|
55
|
-
case 0: case 1: t = op; break;
|
56
|
-
case 4: _.label++; return { value: op[1], done: false };
|
57
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
58
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
59
|
-
default:
|
60
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
61
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
62
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
63
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
64
|
-
if (t[2]) _.ops.pop();
|
65
|
-
_.trys.pop(); continue;
|
66
|
-
}
|
67
|
-
op = body.call(thisArg, _);
|
68
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
69
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
70
|
-
}
|
71
|
-
};
|
72
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
73
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
74
|
-
};
|
75
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
76
|
-
exports.ElementType = exports.CustomForm = void 0;
|
77
|
-
//CustomForm.tsx
|
78
|
-
var react_1 = __importStar(require("react"));
|
79
|
-
var react_toastify_1 = require("react-toastify");
|
80
|
-
var CustomButton_1 = __importDefault(require("./CustomButton"));
|
81
|
-
var CustomInput_1 = __importDefault(require("./CustomInput"));
|
82
|
-
var CustomTextarea_1 = __importDefault(require("./CustomTextarea"));
|
83
|
-
var CustomCheckbox_1 = __importDefault(require("./CustomCheckbox"));
|
84
|
-
var CustomRadioButton_1 = __importDefault(require("./CustomRadioButton"));
|
85
|
-
var CustomSelect_1 = __importDefault(require("./CustomSelect"));
|
86
|
-
var CustomSimpleSelect_1 = __importDefault(require("./CustomSimpleSelect"));
|
87
|
-
var CustomDateTimePicker_1 = __importDefault(require("./CustomDateTimePicker"));
|
88
|
-
var CustomText_1 = __importDefault(require("./CustomText"));
|
89
|
-
var CustomDivider_1 = __importDefault(require("./CustomDivider"));
|
90
|
-
var CustomRichTextbox_1 = __importDefault(require("./CustomRichTextbox"));
|
91
|
-
var CustomTreeView_1 = __importDefault(require("./CustomTreeView"));
|
92
|
-
var CustomAutocompleteInput_1 = __importDefault(require("./CustomAutocompleteInput"));
|
93
|
-
var CustomFileUploader_1 = __importDefault(require("./CustomFileUploader"));
|
94
|
-
var CustomPhoneInput_1 = __importDefault(require("./CustomPhoneInput"));
|
95
|
-
var ElementType;
|
96
|
-
(function (ElementType) {
|
97
|
-
ElementType["INPUT"] = "input";
|
98
|
-
ElementType["TEXTAREA"] = "textarea";
|
99
|
-
ElementType["CHECKBOX"] = "checkbox";
|
100
|
-
ElementType["RADIO"] = "radio";
|
101
|
-
ElementType["SELECT"] = "select";
|
102
|
-
ElementType["SIMPLESELECT"] = "simpleselect";
|
103
|
-
ElementType["DATETIMEPICKER"] = "datetimepicker";
|
104
|
-
ElementType["TEXT"] = "text";
|
105
|
-
ElementType["DIVIDER"] = "divider";
|
106
|
-
ElementType["RICHTEXTBOX"] = "richtextbox";
|
107
|
-
ElementType["TREEVIEW"] = "treeview";
|
108
|
-
ElementType["BUTTON"] = "button";
|
109
|
-
ElementType["AUTOCOMPLETEINPUT"] = "autocompleteinput";
|
110
|
-
ElementType["PHONE"] = "phone";
|
111
|
-
ElementType["FILEUPLOADER"] = "fileuploader";
|
112
|
-
})(ElementType || (ElementType = {}));
|
113
|
-
exports.ElementType = ElementType;
|
114
|
-
var CustomForm = function (_a) {
|
115
|
-
var elements = _a.elements, innerRowCustomClass = _a.innerRowCustomClass, onSubmit = _a.onSubmit, _b = _a.confirmLabel, confirmLabel = _b === void 0 ? "Confirm" : _b, // Varsayılan değer
|
116
|
-
_c = _a.cancelLabel, // Varsayılan değer
|
117
|
-
cancelLabel = _c === void 0 ? "Cancel" : _c, // Varsayılan değer
|
118
|
-
handleCancel = _a.handleCancel, _d = _a.showConfirmButton, showConfirmButton = _d === void 0 ? true : _d, // Varsayılan olarak görünür
|
119
|
-
_e = _a.showCancelButton, // Varsayılan olarak görünür
|
120
|
-
showCancelButton = _e === void 0 ? false : _e;
|
121
|
-
var formRef = (0, react_1.useRef)(null);
|
122
|
-
var _f = (0, react_1.useState)(false), isLoading = _f[0], setIsLoading = _f[1];
|
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];
|
125
|
-
var handleConfirm = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
126
|
-
var form, customSelectValid, isValid, formValues_1, error_1;
|
127
|
-
return __generator(this, function (_a) {
|
128
|
-
switch (_a.label) {
|
129
|
-
case 0:
|
130
|
-
e.preventDefault();
|
131
|
-
setSubmitted(true); // Form gönderimi tetiklendi
|
132
|
-
form = formRef.current;
|
133
|
-
if (!form)
|
134
|
-
return [2 /*return*/];
|
135
|
-
customSelectValid = true;
|
136
|
-
elements.forEach(function (element) {
|
137
|
-
if (element.type === ElementType.SELECT &&
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
}
|
177
|
-
else
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
case
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
react_1.default.createElement("div", { className: "
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
1
|
+
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
+
if (k2 === undefined) k2 = k;
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
18
|
+
}
|
19
|
+
Object.defineProperty(o, k2, desc);
|
20
|
+
}) : (function(o, m, k, k2) {
|
21
|
+
if (k2 === undefined) k2 = k;
|
22
|
+
o[k2] = m[k];
|
23
|
+
}));
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
26
|
+
}) : function(o, v) {
|
27
|
+
o["default"] = v;
|
28
|
+
});
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
30
|
+
if (mod && mod.__esModule) return mod;
|
31
|
+
var result = {};
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
33
|
+
__setModuleDefault(result, mod);
|
34
|
+
return result;
|
35
|
+
};
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
43
|
+
});
|
44
|
+
};
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
49
|
+
function step(op) {
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
52
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
54
|
+
switch (op[0]) {
|
55
|
+
case 0: case 1: t = op; break;
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
59
|
+
default:
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
64
|
+
if (t[2]) _.ops.pop();
|
65
|
+
_.trys.pop(); continue;
|
66
|
+
}
|
67
|
+
op = body.call(thisArg, _);
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
70
|
+
}
|
71
|
+
};
|
72
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
73
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
74
|
+
};
|
75
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
76
|
+
exports.ElementType = exports.CustomForm = void 0;
|
77
|
+
//CustomForm.tsx
|
78
|
+
var react_1 = __importStar(require("react"));
|
79
|
+
var react_toastify_1 = require("react-toastify");
|
80
|
+
var CustomButton_1 = __importDefault(require("./CustomButton"));
|
81
|
+
var CustomInput_1 = __importDefault(require("./CustomInput"));
|
82
|
+
var CustomTextarea_1 = __importDefault(require("./CustomTextarea"));
|
83
|
+
var CustomCheckbox_1 = __importDefault(require("./CustomCheckbox"));
|
84
|
+
var CustomRadioButton_1 = __importDefault(require("./CustomRadioButton"));
|
85
|
+
var CustomSelect_1 = __importDefault(require("./CustomSelect"));
|
86
|
+
var CustomSimpleSelect_1 = __importDefault(require("./CustomSimpleSelect"));
|
87
|
+
var CustomDateTimePicker_1 = __importDefault(require("./CustomDateTimePicker"));
|
88
|
+
var CustomText_1 = __importDefault(require("./CustomText"));
|
89
|
+
var CustomDivider_1 = __importDefault(require("./CustomDivider"));
|
90
|
+
var CustomRichTextbox_1 = __importDefault(require("./CustomRichTextbox"));
|
91
|
+
var CustomTreeView_1 = __importDefault(require("./CustomTreeView"));
|
92
|
+
var CustomAutocompleteInput_1 = __importDefault(require("./CustomAutocompleteInput"));
|
93
|
+
var CustomFileUploader_1 = __importDefault(require("./CustomFileUploader"));
|
94
|
+
var CustomPhoneInput_1 = __importDefault(require("./CustomPhoneInput"));
|
95
|
+
var ElementType;
|
96
|
+
(function (ElementType) {
|
97
|
+
ElementType["INPUT"] = "input";
|
98
|
+
ElementType["TEXTAREA"] = "textarea";
|
99
|
+
ElementType["CHECKBOX"] = "checkbox";
|
100
|
+
ElementType["RADIO"] = "radio";
|
101
|
+
ElementType["SELECT"] = "select";
|
102
|
+
ElementType["SIMPLESELECT"] = "simpleselect";
|
103
|
+
ElementType["DATETIMEPICKER"] = "datetimepicker";
|
104
|
+
ElementType["TEXT"] = "text";
|
105
|
+
ElementType["DIVIDER"] = "divider";
|
106
|
+
ElementType["RICHTEXTBOX"] = "richtextbox";
|
107
|
+
ElementType["TREEVIEW"] = "treeview";
|
108
|
+
ElementType["BUTTON"] = "button";
|
109
|
+
ElementType["AUTOCOMPLETEINPUT"] = "autocompleteinput";
|
110
|
+
ElementType["PHONE"] = "phone";
|
111
|
+
ElementType["FILEUPLOADER"] = "fileuploader";
|
112
|
+
})(ElementType || (ElementType = {}));
|
113
|
+
exports.ElementType = ElementType;
|
114
|
+
var CustomForm = function (_a) {
|
115
|
+
var elements = _a.elements, innerRowCustomClass = _a.innerRowCustomClass, onSubmit = _a.onSubmit, _b = _a.confirmLabel, confirmLabel = _b === void 0 ? "Confirm" : _b, // Varsayılan değer
|
116
|
+
_c = _a.cancelLabel, // Varsayılan değer
|
117
|
+
cancelLabel = _c === void 0 ? "Cancel" : _c, // Varsayılan değer
|
118
|
+
handleCancel = _a.handleCancel, _d = _a.showConfirmButton, showConfirmButton = _d === void 0 ? true : _d, // Varsayılan olarak görünür
|
119
|
+
_e = _a.showCancelButton, // Varsayılan olarak görünür
|
120
|
+
showCancelButton = _e === void 0 ? false : _e;
|
121
|
+
var formRef = (0, react_1.useRef)(null);
|
122
|
+
var _f = (0, react_1.useState)(false), isLoading = _f[0], setIsLoading = _f[1];
|
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];
|
125
|
+
var handleConfirm = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
126
|
+
var form, customSelectValid, customTreeViewValid, isValid, formValues_1, error_1;
|
127
|
+
return __generator(this, function (_a) {
|
128
|
+
switch (_a.label) {
|
129
|
+
case 0:
|
130
|
+
e.preventDefault();
|
131
|
+
setSubmitted(true); // Form gönderimi tetiklendi
|
132
|
+
form = formRef.current;
|
133
|
+
if (!form)
|
134
|
+
return [2 /*return*/];
|
135
|
+
customSelectValid = true;
|
136
|
+
elements.forEach(function (element) {
|
137
|
+
if (element.type === ElementType.SELECT &&
|
138
|
+
element.required) {
|
139
|
+
var selectElement = element;
|
140
|
+
// Eğer değer boş (string) veya boş array ise geçersiz kabul edin
|
141
|
+
if ((Array.isArray(selectElement.value) &&
|
142
|
+
selectElement.value.length === 0) ||
|
143
|
+
(!Array.isArray(selectElement.value) && !selectElement.value)) {
|
144
|
+
customSelectValid = false;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
});
|
148
|
+
customTreeViewValid = true;
|
149
|
+
elements.forEach(function (element) {
|
150
|
+
if (element.type === ElementType.TREEVIEW && element.required) {
|
151
|
+
var val = element.value;
|
152
|
+
var arr = Array.isArray(val) ? val : val ? [val] : [];
|
153
|
+
if (arr.length === 0) {
|
154
|
+
customTreeViewValid = false;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
});
|
158
|
+
isValid = form.checkValidity() && customSelectValid && customTreeViewValid;
|
159
|
+
if (!isValid) return [3 /*break*/, 6];
|
160
|
+
setIsLoading(true);
|
161
|
+
_a.label = 1;
|
162
|
+
case 1:
|
163
|
+
_a.trys.push([1, 3, 4, 5]);
|
164
|
+
formValues_1 = {};
|
165
|
+
Array.from(form.elements).forEach(function (element) {
|
166
|
+
if (element instanceof HTMLInputElement ||
|
167
|
+
element instanceof HTMLTextAreaElement ||
|
168
|
+
element instanceof HTMLSelectElement) {
|
169
|
+
if (element.id) {
|
170
|
+
var name_1 = element.name || element.id;
|
171
|
+
if (element instanceof HTMLInputElement &&
|
172
|
+
element.type === ElementType.RADIO) {
|
173
|
+
if (element.checked) {
|
174
|
+
formValues_1[name_1] = element.value;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
else if (element instanceof HTMLInputElement &&
|
178
|
+
element.type === ElementType.CHECKBOX) {
|
179
|
+
formValues_1[name_1] = element.checked;
|
180
|
+
}
|
181
|
+
else if (element instanceof HTMLSelectElement &&
|
182
|
+
element.multiple) {
|
183
|
+
var selectedOptions = Array.from(element.selectedOptions).map(function (option) { return option.value; });
|
184
|
+
formValues_1[name_1] = selectedOptions;
|
185
|
+
}
|
186
|
+
else if (element instanceof HTMLSelectElement) {
|
187
|
+
formValues_1[name_1] = [element.value];
|
188
|
+
}
|
189
|
+
else {
|
190
|
+
formValues_1[name_1] = element.value;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
});
|
195
|
+
// Özel elemanlar için (örneğin RichTextbox) değerleri ekleyin
|
196
|
+
elements.forEach(function (element) {
|
197
|
+
if ("value" in element && element.type === ElementType.RICHTEXTBOX) {
|
198
|
+
formValues_1[element.id] = element.value;
|
199
|
+
}
|
200
|
+
});
|
201
|
+
return [4 /*yield*/, onSubmit(formValues_1)];
|
202
|
+
case 2:
|
203
|
+
_a.sent();
|
204
|
+
return [3 /*break*/, 5];
|
205
|
+
case 3:
|
206
|
+
error_1 = _a.sent();
|
207
|
+
react_toastify_1.toast.error("Form gönderimi sırasında bir hata oluştu.");
|
208
|
+
return [3 /*break*/, 5];
|
209
|
+
case 4:
|
210
|
+
setIsLoading(false);
|
211
|
+
return [7 /*endfinally*/];
|
212
|
+
case 5: return [3 /*break*/, 7];
|
213
|
+
case 6:
|
214
|
+
react_toastify_1.toast.error("Gerekli tüm alanları doldurunuz.");
|
215
|
+
form.classList.add("was-validated");
|
216
|
+
_a.label = 7;
|
217
|
+
case 7: return [2 /*return*/];
|
218
|
+
}
|
219
|
+
});
|
220
|
+
}); };
|
221
|
+
// Elemanları satır, sütun ve iç satıra göre gruplama
|
222
|
+
var groupedElements = elements.reduce(function (acc, el) {
|
223
|
+
var row = el.rowId || 0;
|
224
|
+
var col = el.colId || 0;
|
225
|
+
var innerRow = el.innerRowId || 0;
|
226
|
+
if (!acc[row])
|
227
|
+
acc[row] = {};
|
228
|
+
if (!acc[row][col])
|
229
|
+
acc[row][col] = {};
|
230
|
+
if (!acc[row][col][innerRow])
|
231
|
+
acc[row][col][innerRow] = [];
|
232
|
+
acc[row][col][innerRow].push(el);
|
233
|
+
return acc;
|
234
|
+
}, {});
|
235
|
+
return (react_1.default.createElement("form", { ref: formRef, noValidate: true, className: "needs-validation", autoComplete: "off" },
|
236
|
+
Object.entries(groupedElements).map(function (_a) {
|
237
|
+
var rowId = _a[0], columns = _a[1];
|
238
|
+
return (react_1.default.createElement("div", { className: "row", key: "row-".concat(rowId) }, Object.entries(columns).map(function (_a) {
|
239
|
+
var colId = _a[0], innerRows = _a[1];
|
240
|
+
return (react_1.default.createElement("div", { className: "col", key: "col-".concat(rowId, "-").concat(colId) }, Object.entries(innerRows).map(function (_a) {
|
241
|
+
var innerRowId = _a[0], elements = _a[1];
|
242
|
+
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)
|
243
|
+
? element.value[0] || ""
|
244
|
+
: "", onChange: function (val) {
|
245
|
+
return element.onChange(val);
|
246
|
+
} }))) : 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 ? (
|
247
|
+
// FILEUPLOADER elemanı için CustomFileUploader'ı render ediyoruz
|
248
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
249
|
+
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)); })));
|
250
|
+
})));
|
251
|
+
})));
|
252
|
+
}),
|
253
|
+
(showConfirmButton || showCancelButton) && (react_1.default.createElement("div", { className: "card-footer mt-3" },
|
254
|
+
react_1.default.createElement("div", { className: "form-actions mt-3", style: { display: "flex", justifyContent: "flex-end", gap: "10px" } },
|
255
|
+
showCancelButton && (react_1.default.createElement(CustomButton_1.default, { label: cancelLabel, className: "btn btn-secondary", onClick: handleCancel || (function () { }), isLoading: isLoading || isUploading })),
|
256
|
+
showConfirmButton && (react_1.default.createElement(CustomButton_1.default, { label: confirmLabel, className: "btn btn-primary", onClick: handleConfirm, isLoading: isLoading || isUploading })))))));
|
257
|
+
};
|
258
|
+
exports.CustomForm = CustomForm;
|
259
|
+
exports.default = CustomForm;
|
@@ -1,37 +1,37 @@
|
|
1
|
-
import React from "react";
|
2
|
-
declare enum InputType {
|
3
|
-
TEXT = "text",
|
4
|
-
NUMBER = "number",
|
5
|
-
TEL = "tel",
|
6
|
-
PASSWORD = "password",
|
7
|
-
EMAIL = "email",
|
8
|
-
FILE = "file"
|
9
|
-
}
|
10
|
-
interface CustomInputProps {
|
11
|
-
id?: string;
|
12
|
-
name?: string;
|
13
|
-
label?: string;
|
14
|
-
inputType?: InputType;
|
15
|
-
value: string;
|
16
|
-
placeholder?: string;
|
17
|
-
required?: boolean;
|
18
|
-
errorMessage?: string;
|
19
|
-
conditionalErrorVisible?: boolean;
|
20
|
-
conditionalErrorMessage?: string;
|
21
|
-
disabled?: boolean;
|
22
|
-
readOnly?: boolean;
|
23
|
-
buttonIcon?: React.ReactNode;
|
24
|
-
buttonClass?: string;
|
25
|
-
buttonTooltip?: string;
|
26
|
-
description?: string | null;
|
27
|
-
tooltip?: string;
|
28
|
-
style?: React.CSSProperties;
|
29
|
-
mainClass?: string;
|
30
|
-
className?: string;
|
31
|
-
buttonOnClick?: () => void;
|
32
|
-
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
33
|
-
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
34
|
-
}
|
35
|
-
declare const CustomInput: React.FC<CustomInputProps>;
|
36
|
-
export { CustomInput, InputType };
|
37
|
-
export default CustomInput;
|
1
|
+
import React from "react";
|
2
|
+
declare enum InputType {
|
3
|
+
TEXT = "text",
|
4
|
+
NUMBER = "number",
|
5
|
+
TEL = "tel",
|
6
|
+
PASSWORD = "password",
|
7
|
+
EMAIL = "email",
|
8
|
+
FILE = "file"
|
9
|
+
}
|
10
|
+
interface CustomInputProps {
|
11
|
+
id?: string;
|
12
|
+
name?: string;
|
13
|
+
label?: string;
|
14
|
+
inputType?: InputType;
|
15
|
+
value: string;
|
16
|
+
placeholder?: string;
|
17
|
+
required?: boolean;
|
18
|
+
errorMessage?: string;
|
19
|
+
conditionalErrorVisible?: boolean;
|
20
|
+
conditionalErrorMessage?: string;
|
21
|
+
disabled?: boolean;
|
22
|
+
readOnly?: boolean;
|
23
|
+
buttonIcon?: React.ReactNode;
|
24
|
+
buttonClass?: string;
|
25
|
+
buttonTooltip?: string;
|
26
|
+
description?: string | null;
|
27
|
+
tooltip?: string;
|
28
|
+
style?: React.CSSProperties;
|
29
|
+
mainClass?: string;
|
30
|
+
className?: string;
|
31
|
+
buttonOnClick?: () => void;
|
32
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
33
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
34
|
+
}
|
35
|
+
declare const CustomInput: React.FC<CustomInputProps>;
|
36
|
+
export { CustomInput, InputType };
|
37
|
+
export default CustomInput;
|