x-ui-design 0.6.23 → 0.6.25
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/esm/types/components/Form/Form.d.ts +6 -4
- package/dist/esm/types/types/form.d.ts +0 -1
- package/dist/index.esm.js +9 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -10
- package/dist/index.js.map +1 -1
- package/lib/components/Form/Form.tsx +1 -1
- package/lib/components/Form/Item/Item.tsx +2 -2
- package/lib/hooks/useForm.ts +6 -4
- package/lib/types/form.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormInstance, FormProps } from '../../types/form';
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { FormInstance, FormItemProps, FormProps } from '../../types/form';
|
|
3
3
|
export declare const FormContext: React.Context<FormInstance | null>;
|
|
4
|
-
declare const
|
|
5
|
-
|
|
4
|
+
declare const Form: FC<FormProps> & {
|
|
5
|
+
Item: FC<FormItemProps>;
|
|
6
|
+
};
|
|
7
|
+
export default Form;
|
|
@@ -108,7 +108,6 @@ export interface FormInstance {
|
|
|
108
108
|
setFieldInstance: (fieldName: string, fieldRef: FieldInstancesRef | null) => void;
|
|
109
109
|
setScrollToFirstError: (value: boolean) => void;
|
|
110
110
|
scrollToFirstError?: boolean;
|
|
111
|
-
isReseting: boolean;
|
|
112
111
|
setOnFieldsChange?: (onFieldsChange?: (changedFields: FieldData[]) => void) => void;
|
|
113
112
|
setOnFinish?: (onFinish?: ((values: Record<string, RuleTypes>) => void) | undefined) => void;
|
|
114
113
|
setOnValuesChange?: (onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void) => void;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$1 from 'react/jsx-runtime';
|
|
2
|
-
import React, { useRef,
|
|
2
|
+
import React, { useRef, Children, isValidElement, Fragment, Suspense, memo, useContext, useState, useMemo, useEffect, createContext, useCallback, useImperativeHandle, useLayoutEffect } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import ReactDOMServer from 'react-dom/server';
|
|
5
5
|
|
|
@@ -618,7 +618,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
|
|
|
618
618
|
...initialValues
|
|
619
619
|
});
|
|
620
620
|
const fieldInstancesRef = useRef({});
|
|
621
|
-
const [isReseting, setIsReseting] = useState(false);
|
|
621
|
+
// const [isReseting, setIsReseting] = useState(false);
|
|
622
622
|
const errorsRef = useRef({});
|
|
623
623
|
const fieldSubscribers = useRef({});
|
|
624
624
|
const formSubscribers = useRef([]);
|
|
@@ -804,7 +804,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
|
|
|
804
804
|
});
|
|
805
805
|
}
|
|
806
806
|
formSubscribers.current.forEach(callback => callback(getFieldsValue()));
|
|
807
|
-
setIsReseting(prev => !prev);
|
|
807
|
+
// setIsReseting(prev => !prev);
|
|
808
808
|
}
|
|
809
809
|
async function submit() {
|
|
810
810
|
const formData = getFormFields();
|
|
@@ -879,7 +879,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
|
|
|
879
879
|
subscribeToFields,
|
|
880
880
|
setScrollToFirstError,
|
|
881
881
|
scrollToFirstError,
|
|
882
|
-
isReseting,
|
|
882
|
+
// isReseting,
|
|
883
883
|
setOnFinish,
|
|
884
884
|
setOnFieldsChange,
|
|
885
885
|
setOnValuesChange,
|
|
@@ -992,7 +992,7 @@ const FormItem$1 = /*#__PURE__*/memo(({
|
|
|
992
992
|
throw new Error('FormItem must be used within a Form');
|
|
993
993
|
}
|
|
994
994
|
const {
|
|
995
|
-
isReseting,
|
|
995
|
+
// isReseting,
|
|
996
996
|
registerField,
|
|
997
997
|
getFieldInstance,
|
|
998
998
|
setFieldInstance
|
|
@@ -1024,10 +1024,9 @@ const FormItem$1 = /*#__PURE__*/memo(({
|
|
|
1024
1024
|
}, "*")), Children.map(childrenList, (child, key) => {
|
|
1025
1025
|
if (/*#__PURE__*/isValidElement(child)) {
|
|
1026
1026
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormItemChildComponent, _extends({}, props, {
|
|
1027
|
-
key
|
|
1027
|
+
// key={`${key}_${isReseting}`}
|
|
1028
1028
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1029
1029
|
// @ts-expect-error
|
|
1030
|
-
,
|
|
1031
1030
|
ref: fieldRef,
|
|
1032
1031
|
name: name,
|
|
1033
1032
|
child: child,
|
|
@@ -1247,12 +1246,11 @@ const Form$1 = ({
|
|
|
1247
1246
|
}, Children.map(childrenList, child => injectPropsIntoFinalLeaf(child))));
|
|
1248
1247
|
};
|
|
1249
1248
|
Form$1.Item = FormItem$1;
|
|
1250
|
-
var Form$2 = /*#__PURE__*/memo(Form$1);
|
|
1251
1249
|
|
|
1252
|
-
var Form$
|
|
1250
|
+
var Form$2 = /*#__PURE__*/Object.freeze({
|
|
1253
1251
|
__proto__: null,
|
|
1254
1252
|
FormContext: FormContext,
|
|
1255
|
-
default: Form$
|
|
1253
|
+
default: Form$1
|
|
1256
1254
|
});
|
|
1257
1255
|
|
|
1258
1256
|
const useWatch = ({
|
|
@@ -1304,7 +1302,7 @@ const RangePicker$2 = dynamic$1(() => Promise.resolve().then(function () { retur
|
|
|
1304
1302
|
const TimePicker$2 = dynamic$1(() => Promise.resolve().then(function () { return TimePicker$1; }), {
|
|
1305
1303
|
ssr: false
|
|
1306
1304
|
});
|
|
1307
|
-
const Form = dynamic$1(() => Promise.resolve().then(function () { return Form$
|
|
1305
|
+
const Form = dynamic$1(() => Promise.resolve().then(function () { return Form$2; }), {
|
|
1308
1306
|
ssr: false
|
|
1309
1307
|
});
|
|
1310
1308
|
const FormItem = dynamic$1(() => Promise.resolve().then(function () { return Item; }), {
|