# @feizheng/react-ant-form-schema3

> React basic ant form builder.

Latest version **1.0.3** (published 2020-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @feizheng/react-ant-form-schema3
pnpm add @feizheng/react-ant-form-schema3
yarn add @feizheng/react-ant-form-schema3
bun add @feizheng/react-ant-form-schema3
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-09-03 |
| First published | 2020-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 32 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | afei |
| Maintainers | afeiship |
| Keywords | react, component |

## Links

- npm: https://www.npmjs.com/package/@feizheng/react-ant-form-schema3
- Repository: https://github.com/afeiship/react-ant-form-schema
- Homepage: https://github.com/afeiship/react-ant-form-schema#readme
- Issues: https://github.com/afeiship/react-ant-form-schema/issues
- npm.io page: https://npm.io/package/@feizheng/react-ant-form-schema3

## Dependencies (6)

- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [autoprefixer](https://npm.io/package/autoprefixer.md) ^9.8.6
- [object-assign](https://npm.io/package/object-assign.md) ^4.1.1
- [@feizheng/noop](https://npm.io/package/@feizheng/noop.md) ^1.0.0
- [@feizheng/react-list](https://npm.io/package/@feizheng/react-list.md) ^1.0.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-09-03
- 1.0.2 — 2020-08-29
- 1.0.1 — 2020-08-29
- 1.0.0 — 2020-08-24

## README

# react-ant-form-schema
> Antd form builder for react.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## llms.txt
- https://github.com/afeiship/react-ant-form-schema/blob/main/llms.txt

## installation
```shell
npm install -S @jswork/react-ant-form-schema
```

## usage
  ```js
  import ReactAntdFormSchema, { GroupsMode } from '@jswork/react-ant-form-schema';
  import React, { useEffect } from 'react';
  import { Button, Card, Form, Space } from 'antd';
  import NiceForm, { NiceFormMeta } from '@ebay/nice-form-react';

  function App() {
    const [form] = Form.useForm();
    const [form2] = Form.useForm();
    const [form3] = Form.useForm();
    const [loading, setLoading] = React.useState(false);

    // Standard mode example
    const meta: NiceFormMeta = {
      columns: 1,
      viewMode: false,
      rowGap: 10,
      initialValues: {
        username: 'admin-init',
        password: '123456-initial',
        cities: [],
      },
      fields: [
        { key: 'username', label: 'User Name', help: 'Please enter your username', required: true },
        { key: 'password', label: 'Password', widget: 'password' },
        {
          key: 'cities',
          label: 'Cities',
          widget: 'form-list',
          listItemMeta: {
            widget: 'select',
            options: ['Beijing', 'Shanghai', 'Nanjing'],
          },
        },
      ],
    };

    // Shared groups data
    const groupsData = [
      {
        title: 'Personal Information',
        meta: {
          fields: [
            { key: 'firstName', label: 'First Name', required: true },
            { key: 'lastName', label: 'Last Name', required: true },
          ],
        } as NiceFormMeta,
      },
      {
        title: 'Account Information',
        meta: {
          fields: [
            { key: 'email', label: 'Email', type: 'email', required: true },
            { key: 'phone', label: 'Phone Number' },
          ],
        } as NiceFormMeta,
      },
      {
        title: 'Contact Information',
        meta: {
          fields: [
            { key: 'address', label: 'Address' },
            { key: 'city', label: 'City' },
          ],
        } as NiceFormMeta,
      },
    ];

    // Groups mode (fieldset)
    const metaWithGroups = {
      columns: 1,
      rowGap: 10,
      initialValues: {
        firstName: 'John',
        lastName: 'Doe',
        email: 'john@example.com',
        phone: '1234567890',
        address: '123 Main St',
        city: 'New York',
      },
      groups: groupsData,
    };

    // Groups mode (tabs)
    const metaWithTabs = {
      columns: 1,
      rowGap: 10,
      groupsMode: GroupsMode.Tabs,
      tabProps: {
        type: 'card',
        size: 'large',
        tabBarStyle: { marginBottom: 16 },
      } as const,
      initialValues: {
        firstName: 'Jane',
        lastName: 'Smith',
        email: 'jane@example.com',
        phone: '9876543210',
        address: '456 Oak Ave',
        city: 'Los Angeles',
      },
      groups: groupsData,
    };

    useEffect(() => {
      // simulate async fetch data
      setLoading(true);
      setTimeout(() => {
        form.setFieldsValue({
          username: 'admin-aric',
          password: '123456-update',
        });
        form2.setFieldsValue({
          firstName: 'John',
          lastName: 'Doe',
        });
        form3.setFieldsValue({
          firstName: 'Jane',
          lastName: 'Smith',
        });
        setLoading(false);
      }, 500);
    }, []);

    return (
      <div className="mx-auto wp-8 mt-10">
        <div className="badge badge-warning absolute right-0 top-0 m-4">Build Time: {BUILD_TIME}</div>
        <Space direction="vertical" size="large" style={{ width: '100%' }}>
          {/* Standard Mode */}
          <Card
            title="Standard Mode"
            classNames={{ body: 'bg-gray-100' }}
            loading={loading}>
            <ReactAntdFormSchema
              className="p-5"
              form={form}
              meta={meta}
              onFinish={(values) => console.log('Standard form:', values)}>
              <NiceForm
                meta={{
                  fields: [{ key: 'ext-single-field', widgetProps: { placeholder: 'Single Field' } }],
                }}
              />
              <Button type="primary" htmlType="submit">
                Submit
              </Button>
            </ReactAntdFormSchema>
          </Card>
          {/* Groups Mode - Fieldset */}
          <Card
            title="Groups Mode (Fieldset)"
            classNames={{ body: 'bg-gray-100' }}
            loading={loading}>
            <ReactAntdFormSchema
              className="p-5"
              form={form2}
              meta={metaWithGroups}
              onFinish={(values) => console.log('Fieldset form:', values)}>
              <Button type="primary" htmlType="submit">
                Submit
              </Button>
            </ReactAntdFormSchema>
          </Card>
          {/* Groups Mode - Tabs */}
          <Card
            title="Groups Mode (Tabs)"
            classNames={{ body: 'bg-gray-100' }}
            loading={loading}>
            <ReactAntdFormSchema
              className="p-5"
              form={form3}
              meta={metaWithTabs}
              onFinish={(values) => console.log('Tabs form:', values)}>
              <Button type="primary" htmlType="submit">
                Submit
              </Button>
            </ReactAntdFormSchema>
          </Card>
        </Space>
      </div>
    );
  }

  export default App;
  ```

## preview
- https://afeiship.github.io/react-ant-form-schema/

## license
Code released under [the MIT license](https://github.com/afeiship/react-ant-form-schema/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-ant-form-schema
[version-url]: https://npmjs.org/package/@jswork/react-ant-form-schema

[license-image]: https://img.shields.io/npm/l/@jswork/react-ant-form-schema
[license-url]: https://github.com/afeiship/react-ant-form-schema/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-ant-form-schema
[size-url]: https://github.com/afeiship/react-ant-form-schema/blob/master/dist/react-ant-form-schema.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-ant-form-schema
[download-url]: https://www.npmjs.com/package/@jswork/react-ant-form-schema

---
_Source: https://npm.io/package/@feizheng/react-ant-form-schema3 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
