albinasoft-ui-package 1.0.92 → 1.0.93
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/AlbinaForm.d.ts +23 -0
- package/dist/components/AlbinaForm.js +77 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from "react";
|
2
|
+
interface AlbinaFormProps {
|
3
|
+
/** Başlangıç form değerleri */
|
4
|
+
initialValues?: Record<string, any>;
|
5
|
+
/** Form elemanları konfigürasyonu (CustomForm’un elements prop’una verilecek) */
|
6
|
+
elements: any[];
|
7
|
+
/** İç satırın sınıfı */
|
8
|
+
innerRowCustomClass?: string;
|
9
|
+
/** Onay buton etiketi */
|
10
|
+
confirmLabel?: string;
|
11
|
+
/** İptal buton etiketi */
|
12
|
+
cancelLabel?: string;
|
13
|
+
/** Onay butonu görünürlüğü */
|
14
|
+
showConfirmButton?: boolean;
|
15
|
+
/** İptal butonu görünürlüğü */
|
16
|
+
showCancelButton?: boolean;
|
17
|
+
/** Form gönderme işlemi */
|
18
|
+
onSubmit: (values: Record<string, any>) => void;
|
19
|
+
/** İptal işlemi */
|
20
|
+
onCancel?: () => void;
|
21
|
+
}
|
22
|
+
declare const AlbinaForm: React.FC<AlbinaFormProps>;
|
23
|
+
export default AlbinaForm;
|
@@ -0,0 +1,77 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
37
|
+
var react_1 = __importStar(require("react"));
|
38
|
+
var CustomForm_1 = __importStar(require("./CustomForm"));
|
39
|
+
var AlbinaForm = function (_a) {
|
40
|
+
var _b = _a.initialValues, initialValues = _b === void 0 ? {} : _b, elements = _a.elements, _c = _a.innerRowCustomClass, innerRowCustomClass = _c === void 0 ? "justify-content-evenly" : _c, _d = _a.confirmLabel, confirmLabel = _d === void 0 ? "Gönder" : _d, _e = _a.cancelLabel, cancelLabel = _e === void 0 ? "İptal" : _e, _f = _a.showConfirmButton, showConfirmButton = _f === void 0 ? true : _f, _g = _a.showCancelButton, showCancelButton = _g === void 0 ? false : _g, onSubmit = _a.onSubmit, onCancel = _a.onCancel;
|
41
|
+
var _h = (0, react_1.useState)(initialValues), formValues = _h[0], setFormValues = _h[1];
|
42
|
+
var handleInputChange = function (id) { return function (e) {
|
43
|
+
if (e instanceof Date || e === null) {
|
44
|
+
setFormValues(function (prev) {
|
45
|
+
var _a;
|
46
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[id] = e, _a)));
|
47
|
+
});
|
48
|
+
}
|
49
|
+
else if (e.target) {
|
50
|
+
var _a = e.target, type_1 = _a.type, checked_1 = _a.checked, value_1 = _a.value;
|
51
|
+
setFormValues(function (prev) {
|
52
|
+
var _a;
|
53
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[id] = type_1 === "checkbox" ? checked_1 : value_1, _a)));
|
54
|
+
});
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
setFormValues(function (prev) {
|
58
|
+
var _a;
|
59
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[id] = e, _a)));
|
60
|
+
});
|
61
|
+
}
|
62
|
+
}; };
|
63
|
+
var enhancedElements = elements.map(function (element) {
|
64
|
+
if (element.id && element.type === CustomForm_1.ElementType.SELECT) {
|
65
|
+
return __assign(__assign({}, element), { value: formValues[element.id] || [], onChange: handleInputChange(element.id) });
|
66
|
+
}
|
67
|
+
else if (element.id) {
|
68
|
+
return __assign(__assign({}, element), { value: formValues[element.id] || "", onChange: handleInputChange(element.id) });
|
69
|
+
}
|
70
|
+
return element;
|
71
|
+
});
|
72
|
+
var handleFormSubmit = function (values) {
|
73
|
+
onSubmit(formValues);
|
74
|
+
};
|
75
|
+
return (react_1.default.createElement(CustomForm_1.default, { elements: enhancedElements, innerRowCustomClass: innerRowCustomClass, confirmLabel: confirmLabel, cancelLabel: cancelLabel, showConfirmButton: showConfirmButton, showCancelButton: showCancelButton, onSubmit: handleFormSubmit, handleCancel: onCancel }));
|
76
|
+
};
|
77
|
+
exports.default = AlbinaForm;
|
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import AlbinaForm from './components/AlbinaForm';
|
1
2
|
import CustomButton from './components/CustomButton';
|
2
3
|
import CustomCheckbox from './components/CustomCheckbox';
|
3
4
|
import CustomDateTimePicker from './components/CustomDateTimePicker';
|
@@ -16,4 +17,4 @@ import CustomAutocompleteInput from './components/CustomAutocompleteInput';
|
|
16
17
|
import CustomProgressBar from './components/CustomProgressBar';
|
17
18
|
import CustomTimeline from './components/CustomTimeline';
|
18
19
|
import CustomDatatable from './components/CustomDatatable';
|
19
|
-
export { CustomButton, CustomCheckbox, CustomDateTimePicker, CustomDivider, CustomForm, CustomInput, CustomModal, CustomRadioButton, CustomRichTextbox, CustomSelect, CustomTab, CustomText, CustomTextarea, CustomTreeView, CustomAutocompleteInput, CustomProgressBar, CustomTimeline, CustomDatatable, };
|
20
|
+
export { AlbinaForm, CustomButton, CustomCheckbox, CustomDateTimePicker, CustomDivider, CustomForm, CustomInput, CustomModal, CustomRadioButton, CustomRichTextbox, CustomSelect, CustomTab, CustomText, CustomTextarea, CustomTreeView, CustomAutocompleteInput, CustomProgressBar, CustomTimeline, CustomDatatable, };
|
package/dist/index.js
CHANGED
@@ -3,7 +3,9 @@ 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.CustomDatatable = exports.CustomTimeline = exports.CustomProgressBar = exports.CustomAutocompleteInput = exports.CustomTreeView = exports.CustomTextarea = exports.CustomText = exports.CustomTab = exports.CustomSelect = exports.CustomRichTextbox = exports.CustomRadioButton = exports.CustomModal = exports.CustomInput = exports.CustomForm = exports.CustomDivider = exports.CustomDateTimePicker = exports.CustomCheckbox = exports.CustomButton = void 0;
|
6
|
+
exports.CustomDatatable = exports.CustomTimeline = exports.CustomProgressBar = exports.CustomAutocompleteInput = exports.CustomTreeView = exports.CustomTextarea = exports.CustomText = exports.CustomTab = exports.CustomSelect = exports.CustomRichTextbox = exports.CustomRadioButton = exports.CustomModal = exports.CustomInput = exports.CustomForm = exports.CustomDivider = exports.CustomDateTimePicker = exports.CustomCheckbox = exports.CustomButton = exports.AlbinaForm = void 0;
|
7
|
+
var AlbinaForm_1 = __importDefault(require("./components/AlbinaForm"));
|
8
|
+
exports.AlbinaForm = AlbinaForm_1.default;
|
7
9
|
var CustomButton_1 = __importDefault(require("./components/CustomButton"));
|
8
10
|
exports.CustomButton = CustomButton_1.default;
|
9
11
|
var CustomCheckbox_1 = __importDefault(require("./components/CustomCheckbox"));
|