Code Monkey home page Code Monkey logo

json-schema-editor-visual's Introduction

json-schema-editor-visual

A json-schema editor of high efficient and easy-to-use, base on React.

avatar

Usage

npm install json-schema-editor-visual
const option = {}
import 'antd/dist/antd.css'
require('json-schema-editor-visual/dist/main.css')
const schemaEditor = require("json-schema-editor-visual/dist/main.js");
const SchemaEditor = schemaEditor(option)

render(
    <SchemaEditor />,
  document.getElementById('root')
)

Option Object

name desc default
lang language, support en_US or zh_CN en_US

SchemaEditor Props

name type default desc
data string null the data of editor
onChange function null
showEditor boolean false

Links

https://github.com/zyqwst/json-schema-editor-vue

json-schema-editor-visual's People

Contributors

coopercoder avatar gaoxiaomumu avatar hellosean1025 avatar jdz321 avatar zpider666 avatar zwfun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

json-schema-editor-visual's Issues

基于 React 的组件可视化拖拽页面搭建代码生成工具

基于 React 的组件可视化拖拽页面搭建代码生成工具,组件自由拖拽,dom实时追踪,组件无限制嵌套组合,不添加多余节点,所见即所得,可完美还原UI设计,多平台支持,代码生成,实时预览,核心功能已抽取为单独组件不依赖任何组件库,并支持任何组件库的拖拽搭建页面,项目开源,欢迎有兴趣的一起开发。
https://github.com/anye931123/react-visual-editor

没测试就发布了吧?

1.1.1 在react上跑步起来

error in ./node_modules/json-schema-editor-visual/package/index.js

Module parse failed: Unexpected token (31:11)

不能设置默认值

有的时候,我们可能需要设置下skeme的默认值,比如说 默认让 key为必填项,能加入这种设置默认值的配置么

欢迎使用全新版的json-schema-editor

https://github.com/wibetter/json-schema-editor

相比当前的json-schema-editor-visual有以下特点:

  • 代码清晰有注释
  • 全新的数据流管控(使用mobx实现)
  • 支持拖拽排序、复杂嵌套、复制等高级功能
  • 有配套的json-editor对生成的schema数据进行渲染和交互(表单可视化操作)

新版json-schema-editor有以下功能:

  1. 支持11种基础类型组件(input、boolean、 date、date-time、 time、 url、 textarea、number、color、radio、 select)
  2. 支持8个特殊类型组件(Object、Array、Json、datasource、Event、CodeArea、htmlArea、quantity)
  3. 拖拽排序
  4. 复制功能
  5. 复杂嵌套
  6. 高级配置功能

代码已开源,欢迎使用!

build时候错误

SG:json-schema-editor-visual siguang.liu$ yarn build
yarn run v1.7.0
warning package.json: License should be a valid SPDX license expression
$ NODE_ENV=production webpack
/Users/siguang.liu/Downloads/json/json-schema-editor-visual/node_modules/webpack-cli/bin/config-yargs.js:89
describe: optionsSchema.definitions.output.properties.path.description,
^

TypeError: Cannot read property 'properties' of undefined
at module.exports (/Users/siguang.liu/Downloads/json/json-schema-editor-visual/node_modules/webpack-cli/bin/config-yargs.js:89:48)
at /Users/siguang.liu/Downloads/json/json-schema-editor-visual/node_modules/webpack-cli/bin/webpack.js:60:27
at Object. (/Users/siguang.liu/Downloads/json/json-schema-editor-visual/node_modules/webpack-cli/bin/webpack.js:515:3)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

修改节点的名称错误

修改节点的名称的时候,会自动多输出一个字符"1"。
看了一下源代码,在package/components/SchemaComponents/SchemaJson.js文件 316行有内容:value={name+'1'},是不是这个地方出了问题?
还请查看一下。多谢

刚才看了一下,版本1.0.11没有这个问题

mock 文档

基本书写方式为 mock 的数据占位符@xxx, 具体字段详见 Mockjs 官网

如果不是以@字符开头的话或者匹配不到Mockjs中的占位符就会直接生成输入
image

`npm install`的文件能否是bulid过的?

感谢开源这个项目!

不过我尝试使用时发现你们的source code和我的project配置有冲突,所以想请问一下,能不能publish build过的文件到npm而不是source code?

以下是详细版本:


react/babel/webpack这一套配置太烦人了,尤其是一大堆插件动不动就有兼容性问题,然后大家又喜欢再封装一层自己的东西。。

结果就是,我打算在某个project用这个库,但是因为配置问题失败了。

在我的project里,transform-class-propertiesreact-hot-loader疑似有冲突,当然也可能是其它问题,总之症状就是hot load的时候class里的static xxx = {}这种code过不了编译,debug了好久也没能解决。

当然,这不是这个project的问题。不过,如果你们publish到npm的code是build过的,就万事大吉了:laughing:

加入外部引用和内部引用的功能

针对规范的讲解中,有针对引用的要求。
https://www.jianshu.com/p/ddf23d33f8a1 查看2.3 和2.4 章节。
需求:比如全国区划编码有数千个枚举,如果应用提交的json中有好几个字段项均使用这个来进行验证,我们应该使用枚举的引用方式来设计schema。希望在后续版本能够加强这个功能,感谢!
同时需要注意引发问题的一些坑点:
https://stackoverflow.com/questions/17595377/json-schema-regarding-use-of-ref
http://www.itkeyword.com/doc/9494815983831951x835/json-schema-regarding-use-of-ref
https://blog.csdn.net/zhangge3663/article/details/89213296

字段检查的问题

比如,

  1. 前面的字段名称是“变动”,后面想输入“变动原因”就非常麻烦;
  2. 前面的字段名称是“变动”,后面输入想从“变动原因”改成“变动历史”就非常麻烦
    image

添加 Object 模板

例如我希望用户能一键创建一个:

{
  name: string,
  width: number,
}

这样的 object 。

我希望能够注册自己的自定义 object 类型 mycustomformtype 到菜单里:

屏幕快照 2019-08-06 下午2 51 16

1.0.10版本问题

1.0.10版本的输入框的onchange事件有问题,不能实时更新

建议增加validator

建议增加一个prop,用于规定用户输入的json存在错误时,是否允许点击确定按钮。

当前的设计,如果json存在错误,点击确定按钮时,已输入的信息会全部丢失。

编译打包文件

我在代码库的基础上修改了一些东西,怎么才能打包像prd里面的index.js和index.css一样,直接在html引用就能打开编辑器

本地部署运行不起来........

按照步骤运行
npm install && npm run start

打开http://127.0.0.1:8082/ 是可以的

jietu20180316-232747

但是点击index.html就没有反应了,空白页面了,您可以试一下,控制台有报错了,报的错我就不贴了

但是如果我不起服务,直接用浏览器打开index.html页面 是可以的没有问题的

安装完依赖, npm start 还是不能正常运行, npm run build 也报错

克隆项目, npm安装后, npm run start(直接跳到ykit.js) 和 npm run build( Cannot read property 'properties' of undefined)均不行.
npm install -g ykit 还是不行.
image

我全局安装了 ykit , npm start 还是只打开 ykit.js. 进程就终止了.
$ npm run build 也是报错. 我是windows 平台. 和平台有关系吗?

不能单独启动看效果吗?

克隆项目,npm安装后,npm run start(直接跳到ykit.js)和npm run build( Cannot read property 'properties' of undefined)均不行

在import 进去的时候用SchemaEditor就会报下面的错误

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

界面样式直接乱的

上线之前测了吗,如果我引用"/prd/src/index.css"样式是正常了,但是这组件样式直接覆盖了antd的官方样式是怎么个意思,官方的组件的样式表现都不正常了,加一个class名字只定义组件内部的样式很复杂么?
引用方式:
import 'json-schema-editor-visual/dist/main.css';
import schemaEditor from 'json-schema-editor-visual/dist/main.js';
const App = (props) => {
const SchemaEditor = schemaEditor(props.option);
return (
<>
<SchemaEditor {...props} />
</>
);
};
export default App;
sd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.