Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Commit

Permalink
chore: rename to form-render
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony committed Apr 30, 2019
1 parent 6d474f8 commit ec88bda
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 38 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# form-renderer
# form-render

> Yet another form render solution for vue
[![NPM version](https://badgen.net/npm/v/form-renderer)](https://npmjs.com/package/form-renderer)
[![NPM download](https://badgen.net/npm/dm/form-renderer)](https://npmjs.com/package/form-renderer)
[![License](https://badgen.net/npm/license/form-renderer)](./LICENSE)
[![buy me a coffee](https://badgen.net/badge/buy%20me%20a/coffee/a71)](https://patreon.com/evillt)
[![NPM version](https://badgen.net/npm/v/form-render)](https://npmjs.com/package/form-render)
[![NPM download](https://badgen.net/npm/dm/form-render)](https://npmjs.com/package/form-render)
[![License](https://badgen.net/npm/license/form-render)](./LICENSE)
[![$donate](https://badgen.net/badge/$/donate/f2a)](https://patreon.com/evillt)

## Getting started

Expand All @@ -23,11 +23,11 @@ yarn example

## Config type check

FormRenderer expose the `Config` type you can use to type-check your form config:
FormRender expose the `Config` type you can use to type-check your form config:

```ts
// form-config.ts
import { Config } from 'form-renderer'
import { Config } from 'form-render'

const config: Config = {
props: {},
Expand All @@ -40,7 +40,7 @@ export default config
It also works in `.js` file:

```js
/** @type {import('form-renderer').Config} */
/** @type {import('form-render').Config} */
const config = {
props: {},
items: [...]
Expand All @@ -59,10 +59,10 @@ export default config

## Credits

This repo(form-renderer) won't exist without the inspirations from following projects or articles:
This repo(form-render) won't exist without the inspirations from following projects or articles:

- Form-renderer itself
- [@femessage/el-form-renderer](https://github.com/femessage/el-form-renderer)
- Form-render itself
- [@femessage/el-form-render](https://github.com/femessage/el-form-render)
- [elv-form](https://github.com/evillt/elv-form)
- [NoForm](https://github.com/alibaba/nopage/tree/master/packages/form) and [Article](https://zhuanlan.zhihu.com/p/44120143?utm_source=wechat_timeline&utm_medium=social&from=timeline)
- [再也不想写表单了](https://zhuanlan.zhihu.com/p/48241645)
Expand All @@ -71,8 +71,8 @@ This repo(form-renderer) won't exist without the inspirations from following pro

## Author

**form-renderer** © [EVILLT](https://github.com/evillt), Released under the [MIT](./LICENSE) License.
**form-render** © [EVILLT](https://github.com/evillt), Released under the [MIT](./LICENSE) License.

Authored and maintained by **EVILLT** with help from contributors ([list](https://github.com/evillt/form-renderer/contributors)).
Authored and maintained by **EVILLT** with help from contributors ([list](https://github.com/evillt/form-render/contributors)).

> [evila.me](https://evila.me) · GitHub [@evillt](https://github.com/evillt) · Twitter [@evillt](https://twitter.com/evillt)
2 changes: 1 addition & 1 deletion bili.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Config } from 'bili'

const config: Config = {
output: {
fileName: 'form-renderer.cjs.js',
fileName: 'form-render.cjs.js',
minify: true
},
plugins: {
Expand Down
4 changes: 2 additions & 2 deletions example/src/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import FormRenderer from '../../dist/form-renderer.cjs'
import FormRender from '../../dist/form-render.cjs'
import ui from '../../lib/ElementUI'

Vue.use(ElementUI)
Vue.use(FormRenderer, { ui })
Vue.use(FormRender, { ui })
19 changes: 16 additions & 3 deletions example/src/views/index.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<template>
<div class="">
<FormRenderer :config="config">
<FormRender :config="config">
<el-form-item>
<el-button type="primary">Create</el-button>
<el-button type="primary" @click="setValue">Set Value</el-button>
<el-button type="primary" @click="printVal">Print Value</el-button>
<el-button>Cancel</el-button>
</el-form-item>
</FormRenderer>
</FormRender>
</div>
</template>

<script>
import { store } from '../../../dist/form-render.cjs'
export default {
name: 'Basic',
Expand Down Expand Up @@ -94,6 +96,17 @@ export default {
]
}
}
},
methods: {
setValue() {
store.updateValue({
name: 'evillt'
})
},
printVal() {
console.log(store.getValue())
}
}
}
</script>
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "form-renderer",
"name": "form-render",
"description": "Yet another form render solution for vue",
"version": "0.0.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "evillt/form-renderer"
"url": "evillt/form-render"
},
"author": "evillt <ijoec123@gmail.com> (https://evila.me)",
"files": [
"dist",
"lib"
],
"main": "dist/form-renderer.cjs.js",
"main": "dist/form-render.cjs.js",
"types": "types.d.ts",
"scripts": {
"lint": "xo",
Expand Down
4 changes: 2 additions & 2 deletions src/core/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import store from './store'
import Item from './item'

export default {
name: 'FormRenderer',
name: 'FormRender',

render(h) {
const {
$FormRendererUI: { form: Form }
$FormRenderUI: { form: Form }
} = this
const { props, items = [] } = this.config

Expand Down
8 changes: 4 additions & 4 deletions src/core/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { warning } from '../utils'
import store from './store'

export default {
name: 'FormRendererItem',
name: 'FormRenderItem',

render(h) {
const { item, $FormRendererUI } = this
const Item = $FormRendererUI.item || {}
const Widget = $FormRendererUI[item.component] || {
const { item, $FormRenderUI } = this
const Item = $FormRenderUI.item || {}
const Widget = $FormRenderUI[item.component] || {
component: item.component
}

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Form.install = (Vue, { ui } = {}) => {

Vue.mixin({
computed: {
$FormRendererUI() {
$FormRenderUI() {
return ui
}
}
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4786,14 +4786,14 @@ lint-staged@^7.2.0:
string-argv "^0.0.2"
stringify-object "^3.2.2"

listr-silent-renderer@^1.1.1:
listr-silent-render@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e"
resolved "https://registry.npmjs.org/listr-silent-render/-/listr-silent-render-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e"
integrity sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=

listr-update-renderer@^0.5.0:
listr-update-render@^0.5.0:
version "0.5.0"
resolved "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz#4ea8368548a7b8aecb7e06d8c95cb45ae2ede6a2"
resolved "https://registry.npmjs.org/listr-update-render/-/listr-update-render-0.5.0.tgz#4ea8368548a7b8aecb7e06d8c95cb45ae2ede6a2"
integrity sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA==
dependencies:
chalk "^1.1.3"
Expand All @@ -4805,9 +4805,9 @@ listr-update-renderer@^0.5.0:
log-update "^2.3.0"
strip-ansi "^3.0.1"

listr-verbose-renderer@^0.5.0:
listr-verbose-render@^0.5.0:
version "0.5.0"
resolved "https://registry.npmjs.org/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz#f1132167535ea4c1261102b9f28dac7cba1e03db"
resolved "https://registry.npmjs.org/listr-verbose-render/-/listr-verbose-render-0.5.0.tgz#f1132167535ea4c1261102b9f28dac7cba1e03db"
integrity sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw==
dependencies:
chalk "^2.4.1"
Expand All @@ -4824,9 +4824,9 @@ listr@^0.14.1:
is-observable "^1.1.0"
is-promise "^2.1.0"
is-stream "^1.1.0"
listr-silent-renderer "^1.1.1"
listr-update-renderer "^0.5.0"
listr-verbose-renderer "^0.5.0"
listr-silent-render "^1.1.1"
listr-update-render "^0.5.0"
listr-verbose-render "^0.5.0"
p-map "^2.0.0"
rxjs "^6.3.3"

Expand Down

0 comments on commit ec88bda

Please sign in to comment.