infinity-forge 0.3.6 → 0.3.8
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.
|
@@ -69,6 +69,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
73
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
|
+
if (ar || !(i in from)) {
|
|
75
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
76
|
+
ar[i] = from[i];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
|
+
};
|
|
72
81
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
82
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
74
83
|
var react_1 = require("react");
|
|
@@ -79,7 +88,7 @@ var S = __importStar(require("../styles.js"));
|
|
|
79
88
|
function FormElement(_a) {
|
|
80
89
|
var button = _a.button, children = _a.children, onSucess = _a.onSucess, customSubmit = _a.customSubmit, onChangeForm = _a.onChangeForm;
|
|
81
90
|
var _b = (0, react_1.useState)({ state: '', message: '' }), stateForm = _b[0], setStateForm = _b[1];
|
|
82
|
-
var _c = (0, formik_1.useFormikContext)(), values = _c.values, setErrors = _c.setErrors
|
|
91
|
+
var _c = (0, formik_1.useFormikContext)(), values = _c.values, setErrors = _c.setErrors;
|
|
83
92
|
function onSubmit(action) {
|
|
84
93
|
return __awaiter(this, void 0, void 0, function () {
|
|
85
94
|
var _a, err_1;
|
|
@@ -113,8 +122,8 @@ function FormElement(_a) {
|
|
|
113
122
|
onSubmit(action);
|
|
114
123
|
}
|
|
115
124
|
(0, react_1.useEffect)(function () {
|
|
116
|
-
onChangeForm && onChangeForm(values);
|
|
117
|
-
}, [values]);
|
|
125
|
+
onChangeForm && onChangeForm.callbackResult(values);
|
|
126
|
+
}, __spreadArray([values], (onChangeForm.additionalDependencies || []), true));
|
|
118
127
|
return ((0, jsx_runtime_1.jsxs)(S.FormHandler, { children: [stateForm.state === 'error' && (0, jsx_runtime_1.jsx)("span", { className: 'errorForm', children: stateForm.message }), children, (0, jsx_runtime_1.jsxs)("div", { className: 'form-button', children: [button && ((0, jsx_runtime_1.jsx)(ui_1.Button, __assign({}, button, { type: 'button', onClick: function () { return handleSubmit(); }, loading: stateForm.state === 'loading' }))), customSubmit &&
|
|
119
128
|
customSubmit.length > 0 &&
|
|
120
129
|
customSubmit.map(function (custom, index) { return ((0, jsx_runtime_1.jsx)(custom_submit_1.CustomSubmitButton, __assign({}, custom, { stateForm: stateForm, onSubmit: handleSubmit }), index)); })] })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/components/form/handler/form-handler/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/components/form/handler/form-handler/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,iCAAyC;AAEzC,2BAA6B;AAC7B,kDAAyE;AAIzE,2CAA8B;AAE9B,SAAwB,WAAW,CAAC,EAAwE;QAAtE,MAAM,YAAA,EAAE,QAAQ,cAAA,EAAE,QAAQ,cAAA,EAAE,YAAY,kBAAA,EAAE,YAAY,kBAAA;IACpF,IAAA,KAA4B,IAAA,gBAAQ,EAAC,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,EAA/D,SAAS,QAAA,EAAE,YAAY,QAAwC,CAAA;IAEhE,IAAA,KAAwB,IAAA,yBAAgB,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AAS,CAAC,KAAK,KAAK,SAAS,IAAI,CAC5G,EAEA,YAAY;wBACX,YAAY,CAAC,MAAM,GAAG,CAAC;wBACvB,YAAY,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,KAAK,IAAK,OAAA,CAClC,uBAAC,kCAAkB,eAAiB,MAAM,IAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,KAA/D,KAAK,CAA8D,CAC7F,EAFmC,CAEnC,CAAC,IACA,IACQ,CACjB,CAAA;AACH,CAAC;AAjDD,8BAiDC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from
|
|
3
|
-
import { ICustomSubmitProps } from
|
|
2
|
+
import { ButtonProps } from '../../../../ui/index.js';
|
|
3
|
+
import { ICustomSubmitProps } from './custom-submit/index.js';
|
|
4
4
|
export interface IFormHandler {
|
|
5
5
|
ref?: any;
|
|
6
6
|
onSucess?: (data: any) => void;
|
|
7
7
|
schema?: any;
|
|
8
8
|
button?: ButtonProps;
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
-
onChangeForm?:
|
|
10
|
+
onChangeForm?: {
|
|
11
|
+
callbackResult: (dataForm: any) => void;
|
|
12
|
+
additionalDependencies?: any[];
|
|
13
|
+
};
|
|
11
14
|
initialData?: {
|
|
12
15
|
[key: string]: any;
|
|
13
16
|
};
|