foxit-component 0.0.1-alpha.32 → 0.0.1-alpha.33
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/es/Form/FormItem.d.ts +2 -1
- package/es/Form/FormItem.js +3 -3
- package/package.json +1 -1
package/es/Form/FormItem.d.ts
CHANGED
package/es/Form/FormItem.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import React, { useContext, useEffect, useCallback } from 'react';
|
|
4
4
|
import { FormContext } from './FormContext.js';
|
|
5
5
|
|
|
6
6
|
var FormItem = function (_a) {
|
|
7
7
|
var _b, _c, _d;
|
|
8
|
-
var name = _a.name, label = _a.label, _e = _a.rules, rules = _e === void 0 ? [] : _e, children = _a.children;
|
|
8
|
+
var name = _a.name, label = _a.label, extra = _a.extra, _e = _a.rules, rules = _e === void 0 ? [] : _e, children = _a.children;
|
|
9
9
|
var _f = useContext(FormContext), form = _f.form, formFields = _f.formFields;
|
|
10
10
|
// Register field when component mounts
|
|
11
11
|
useEffect(function () {
|
|
@@ -23,7 +23,7 @@ var FormItem = function (_a) {
|
|
|
23
23
|
var newValue = ((_b = e === null || e === void 0 ? void 0 : e.target) === null || _b === void 0 ? void 0 : _b.value) !== undefined ? e.target.value : e;
|
|
24
24
|
form.setFieldsValue((_a = {}, _a[name] = newValue, _a));
|
|
25
25
|
}, [form, name]);
|
|
26
|
-
return (jsxs("div", __assign({ className: "foxit-form-item" }, { children: [label && (jsxs("label", { children: [label, rules.some(function (rule) { return rule.required; }) && jsx("span", __assign({ className: "foxit-form-required" }, { children: "*" }))] })), jsx("span", __assign({ className: "".concat(error ? 'foxit-form-error-component' : warning ? 'foxit-form-warning-component' : '') }, { children: React.Children.map(children, function (child) {
|
|
26
|
+
return (jsxs("div", __assign({ className: "foxit-form-item" }, { children: [label && (jsxs("label", { children: [label, rules.some(function (rule) { return rule.required; }) && jsx("span", __assign({ className: "foxit-form-required" }, { children: "*" })), extra && jsx(Fragment, { children: extra })] })), jsx("span", __assign({ className: "".concat(error ? 'foxit-form-error-component' : warning ? 'foxit-form-warning-component' : '') }, { children: React.Children.map(children, function (child) {
|
|
27
27
|
return React.cloneElement(child, {
|
|
28
28
|
value: value,
|
|
29
29
|
onChange: handleChange
|