Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fr-design

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fr-design

### 安装

  • 1.0.0-beta.3
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

如何使用

安装

npm i fr-generator

代码演示

/**
 * transform: true
 * defaultShowCode: true
 */
import React from 'react';
import Generator from 'fr-generator';

const defaultValue = {
  type: 'object',
  properties: {
    inputName: {
      title: '简单输入框',
      type: 'string',
    },
  },
};

const Demo = () => {
  return (
    <div style={{ height: '80vh' }}>
      <Generator defaultValue={defaultValue} />
    </div>
  );
};

export default Demo;

API

Props

参数说明类型默认值
hideId隐藏组件 IDbooleanfalse
defaultValue默认表单 schemaobjectDEFAULT_SCHEMA
transformerschema 双向转换object{ fromFormRender, toFormRender }
extraButtons操作栏按钮arrayextraButton[]
controlButtons选中项操作按钮arraycontrolButton[]
settings左右侧栏配置arraydefaultSettings
commonSettings通用配置objectdefaultCommonSettings
globalSettings全局配置objectdefaultGlobalSettings
widgets自定义组件object{}
mapping组件和 schema 的映射规则object{}
extraButton
属性说明类型
text按钮文案string
onClick按钮点击回调函数(event) => void

数组前四项为布尔值,决定默认按钮是否展示。 支持 antd 按钮组件的所有其他属性 https://ant.design/components/button-cn/#API

controlButton
属性说明类型
text按钮文案string
onClick按钮点击回调函数(event, schema) => void

数组前两项为布尔值或函数,决定默认按钮是否展示,函数入参为选中项 schema。

Events

事件名说明回调参数
onChange表单 data 变化回调表单的 data
onSchemaChange表单 schema 变化回调导出的 schema

Methods

事件名说明入参
getValue获取导出的 schema 值-
setValue从外部强制修改 schemaschema
copyValue将现有 schema 拷贝到剪贴板-

案例演示

https://xrender.fun/generator/demo

常见问题

1、如何控制编辑器高度

给组件外层要包裹的 div 设置高度即可,否则为默认值 min-height: 30vh

FAQs

Package last updated on 30 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc