import React, { useState, useLayoutEffect, useEffect, useRef } from 'react'; import { Button, Form } from '../../index'; import { BasicDemoWithInit, LinkFieldForm, DifferentDeclareUsage } from './demo'; const { Input, Select, DatePicker, Switch, Slider, CheckboxGroup, Checkbox, RadioGroup, Radio, TimePicker, } = Form; import { UseFormApiDemo, UseFormStateDemo, UseFieldApiDemo, UseFieldStateDemo, WithFormStateDemo, WithFormApiDemo, ComponentUsingFormState, CustomStringify, } from './Hook/hookDemo'; // layout import { LayoutDemo, InsetLabelDemo } from './Layout/layoutDemo'; import { AssistComponent } from './Layout/slotDemo'; import { ModalFormDemo } from './Layout/modalFormDemo'; import { WithFieldDemo, CustomFieldDemo, NumberRange } from './HOC/withFieldDemo'; import { CustomValidateDemo, ValidateFieldsDemo, PartValidAndResetDemo, RulesValidateDemo, SetBugDemo, UnmountedLeafDemo, RulesExample, RaceAsyncDemo, } from './Validate/validateDemo'; // field props import { ConvertDemo } from './FieldProps/convert'; import { NameDemo } from './FieldProps/name'; import { HelpAndExtra, ExtraPositionDemo } from './FieldProps/helpAndExtra'; import { BigNumberFieldDemo } from './FieldProps/bigNumberFieldPath'; import { UpdateDemo, RuleupdateDemo } from './FieldProps/rulesUpdateDemo'; import { FieldRefDemo } from './FieldProps/fieldRef'; import { LableOptionalDemo } from './FieldProps/labelOptional'; // form inputGroup import { InputGroupDemo } from './InputGroup/groupProps'; // arrayField import { ArrayFieldCollapseDemo, ArrayFieldDemo, ArrayFieldWithFormInitValues, ArrayFieldWithInitValue, ArrayFieldSetValues, AsyncSetArrayField, } from './DynamicField/arrayFieldDemo'; import { NestArrayField } from './DynamicField/nestArrayField'; import { ArrayDemo } from './FormApi/arrayDemo'; // performance import { ManyFieldDemo, EffectDemo, ModalFormSelectWithObject, } from './Performance/performanceDemo'; import { SetValuesDemo, SetValuesWithArrayField } from './FormApi/setValuesDemo'; import { SetValueUsingParentPath } from './FormApi/formApiDemo'; import { FieldPathWithArrayDemo } from './Debug/bugDemo'; import ChildDidMount from './Debug/childDidMount'; export { default as FormSubmit } from './FormSubmit'; export * from './ArrayField'; export default { title: 'Form' } const Option = Select.Option; export const FormDeclareUsage = () => ; FormDeclareUsage.story = { name: 'Form declare usage', }; export const BasicDemo = () => ; BasicDemo.story = { name: 'BasicDemo', }; export const LayoutFormWrapperColLabelCol = () => ; LayoutFormWrapperColLabelCol.story = { name: 'Layout-Form wrapperCol/labelCol', }; export const LayoutInsetLabel = () => ; LayoutInsetLabel.story = { name: 'Layout-insetLabel', }; export const LableOptional = () => ; LableOptional.story = { name: 'Layout-label show optional', }; export const LayoutSlotErrorMessageLabel = () => ; LayoutSlotErrorMessageLabel.story = { name: 'Layout-Slot/ErrorMessage/Label', }; export const LayoutModalDemo = () => ; LayoutModalDemo.story = { name: 'Layout-ModalDemo', }; export const GroupProp = () => GroupProp.story = { name: 'Layout-InputGroup Prop - basic' }; export const FormApiSetValuesOverride = () => ; FormApiSetValuesOverride.story = { name: 'formApi-setValues(override)', }; export const FormApiValidate = () => ; FormApiValidate.story = { name: 'formApi-validate', }; export const FormApiSetValueUsingFieldParentPath = () => ; FormApiSetValueUsingFieldParentPath.story = { name: 'formApi-setValue using field parent path', }; export const UseFormApiSetValueUpdateArray = () => ; UseFormApiSetValueUpdateArray.story = { name: 'formApi-setValue set array', }; export const DynamicAddRemoveField = () => (
{({ formState }) => ( yes no {formState.values.married === 'yes' ? : null} )}
); DynamicAddRemoveField.story = { name: 'Dynamic Add / Remove Field', }; export const ArrayFieldBasicUsage = () => ; ArrayFieldBasicUsage.story = { name: 'ArrayField-basic usage', }; export const _ArrayFieldWithFormInitValues = () => ; _ArrayFieldWithFormInitValues.story = { name: 'ArrayField-with form initValues', }; export const ArrayFieldWithArrayFieldInitValue = () => ; ArrayFieldWithArrayFieldInitValue.story = { name: 'ArrayField-with arrayField initValue', }; export const ArrayFieldSetValuesDemo = () => ; ArrayFieldSetValuesDemo.story ={ name: 'ArrayField-setValues didMount' } export const AsyncSetArrayFieldDemo = () => ; AsyncSetArrayFieldDemo.story = { name: 'ArrayField-update async' } export const ArrayFieldNestUsage = () => ; ArrayFieldNestUsage.story = { name: 'ArrayField-Nest Usage', }; export const _ArrayFieldCollapseDemo = () => ; _ArrayFieldCollapseDemo.story = { name: 'ArrayField-CollapseDemo', }; export const LinkField = () => ; LinkField.story = { name: 'LinkField', }; export const ValidateFormLevel = () => ; ValidateFormLevel.story = { name: 'Validate-FormLevel', }; export const ValidateFieldValel = () => ; ValidateFieldValel.story = { name: 'Validate-FieldValel', }; export const ValidateUseRules = () => ; ValidateUseRules.story = { name: 'Validate-use rules', }; export const RaceAsync = () => ; RaceAsync.story = { name: 'Validate-race async' } export const HooksUseFormApi = () => ; HooksUseFormApi.story = { name: 'Hooks-useFormApi', }; export const HooksUseFormState = () => ; HooksUseFormState.story = { name: 'Hooks-useFormState', }; export const HooksUseFieldApi = () => ; HooksUseFieldApi.story = { name: 'Hooks-useFieldApi', }; export const HooksUseFieldState = () => ; HooksUseFieldState.story = { name: 'Hooks-useFieldState', }; export const HocWithFormApi = () => ; HocWithFormApi.story = { name: 'Hoc-withFormApi', }; export const HocWithFormState = () => ; HocWithFormState.story = { name: 'Hoc-withFormState', }; export const WithField = () => ; WithField.story = { name: 'withField', }; export const WithFieldWithStatefulComponent = () => ; WithFieldWithStatefulComponent.story = { name: 'withField- with stateful component', }; export const WithFieldNumberRange = () => (
console.log(v)}>
); WithFieldNumberRange.story = { name: 'withField - NumberRange', }; export const PerformanceManyField = () => ; PerformanceManyField.story = { name: 'Performance-ManyField', }; export const PerformanceModalFormSelectWithObject = () => ; PerformanceModalFormSelectWithObject.story = { name: 'Performance-ModalFormSelectWithObject', }; export const FiledPropConvert = () => ; FiledPropConvert.story = { name: 'Filed Prop-convert', }; export const FieldPropsName = () => ; FieldPropsName.story = { name: 'Filed Prop-name', }; export const FiledPropHelpTextExtraTextExtraTextPosition = () => ( <> ); FiledPropHelpTextExtraTextExtraTextPosition.story = { name: 'Filed Prop-helpText / extraText / extraTextPosition', }; export const FieldPropsDynamicUpdateRulesRequired = () => ; FieldPropsDynamicUpdateRulesRequired.story = { name: 'Field Props-dynamic update rules.required', }; export const FieldPropInitValue = () => ; FieldPropInitValue.story = { name: 'Field Prop-initValue=""', }; export const FieldPropBigNumberFieldSubmit = () => ; FieldPropBigNumberFieldSubmit.story = { name: 'Field prop-big number field submit', }; export const FieldPropPure = () => (
); FieldPropPure.story = { name: 'Field Prop-pure', }; export const FieldPropRef = () => ; FieldPropRef.story = { name: 'Field Prop-ref', }; const InitEmptyStringDemo = () => { return (
); }; export const DebugSetBugDemo = () => ( <> ); DebugSetBugDemo.story = { name: 'Debug-SetBugDemo', }; export const DebugSetValuesWithArrayField = () => ( <> ); DebugSetValuesWithArrayField.story = { name: 'Debug-SetValuesWithArrayField', }; import { SetValuesArray, DoubleRerender } from './Debug/bugDemo'; export const DebugArrayFieldPath = () => ; DebugArrayFieldPath.story = { name: 'Debug-数组类fieldPath', }; export const DebugSetValuesDemo = () => ( <> ); DebugSetValuesDemo.story = { name: 'Debug-SetValuesDemo', }; export const DebugRerenderTwice = () => ( <> ); DebugRerenderTwice.story = { name: 'Debug-RerenderTwice', }; export const _ChildDidMount = () => ; _ChildDidMount.story = { name: 'child did mount', };