femessage / el-form-renderer Goto Github PK
View Code? Open in Web Editor NEW🎩A data-driven dynamic and complex form solution
Home Page: https://femessage.github.io/el-form-renderer/
License: MIT License
🎩A data-driven dynamic and complex form solution
Home Page: https://femessage.github.io/el-form-renderer/
License: MIT License
1.3.0
Windows 10 - Chrome 73
nuxt
my formContent item has set inputFormat, there is nothing wrong when call updateForm. But when i call updateVaule which setted inputFormat, error occurred.
Here will call the inpueFormat inside!
But updateVaule didn't.
Maybe write the default inputFormat code in the function updateValue, because updateForm just calls updateValue Iteratively
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Hello, is it possible to do inline forms using this library? Or inline specific form items?
Describe the solution you'd like
Add support for inline form items.
field 类型为 Boolean , 值为 false 时, inputFormat 不生效
比如, el-switch
使用 inputFormat
var value = item.type === GROUP ? updateValue(item.items) : item.inputFormat && item.inputFormat(values) || values[item.id];
inputFormat 返回 false 时,还是使用原来的值
绑定 inputFormat 返回的值,包括 false
, ""
这些
使用enableWhen来进行表单表单联动 发现在更新了1.2版本后 enableWhen不生效了
具体表现为 两个form-item都有 enableWhen 只显示了最后的form-item
代码如下
<template>
<el-form-renderer :content="form" ref="detailForm"></el-form-renderer>
</template>
<script>
export default {
data() {
return {
form: [
{
$type: 'select',
$id: 'dialect',
label: '数据源类型',
$options: [
{
label: 'mysql',
value: 'mysql'
},
{
label: 'oracle',
value: 'oracle'
}
],
},
{
$type: 'select',
$id: 'className',
label: '数据库驱动',
$options: [
{
label: 'com.mysql.jdbc.Driver',
value: 'com.mysql.jdbc.Driver'
},
{
label: 'com.mysql.cj.jdbc.Driver',
value: 'com.mysql.cj.jdbc.Driver'
}
],
$enableWhen: {
dialect: 'mysql'
}
},
{
$type: 'select'
$id: 'className',
label: '数据库驱动',
$el: {
disabled: visible
},
$default: '',
$options: [
{
label: 'oracle.jdbc.driver.OracleDriver',
value: 'oracle.jdbc.driver.OracleDriver'
}
],
$enableWhen: {
dialect: 'oracle'
}
},
]
}
}
}
</script>
使用自定义组件时,若model 值包含 File 对象,会丢失
我的用例,封装了 el-upload 组件,需要拿到 file 对象,
结果经过 getFormValue
的 clone
值后, file 对象丢失了
这个是 `getFormValue` 得到的值
{
"status": "ready",
"name": "idea-settings-190507 - 副本.bin",
"size": 12047,
"percentage": 0,
"uid": 1569289372447,
"raw": {
"uid": 1569289372447
}
}
raw 是 File 的原始对象,结果只剩 element-ui 赋的 uid 字段了。。
正常返回 file 对象
Is your feature request related to a problem? Please describe.
场景: 一个表单新增页面、一个save按钮(save第一步是执行表单的validate方法)
步骤:
1.在el-from-renderer中使用 el-cascader[官方]级联选择组件、upload-to-ali组件。
2.页面初次渲染后,直接点击save按钮,此时表单的validate方法执行,各个组件的校验error提示出现。
3.在el-cascader中选中到数据,el-cascader的校验提示不消失;在upload-to-ali选择中图片,其校验提示也不消失。
4.使用trigger: change/blur ,都不理想/无效。
5.el-input、el-select好像无此问题。目前不知道还有没有其他element官方组件校验不能即时触发。
Describe the solution you'd like
期望:
在表单中组件(upload-to-ali、el-cascader...)的值变动时,能够使校验提示正常的显隐藏(或者触发校验方法8 ^_^).
Describe alternatives you've considered
使用者的不成熟想法:
1.针对el-cascader[官方]级联选择组件,这种校验可能需要在el-form-renderer中进行改进;
2.针对upload-to-ali这种企业/个人封装的组件,建议在v-model的值变动时手动触发el-form-item的校验方法,如下图。这种触发方式有实践过
Describe the bug
见图
To Reproduce
Expected behavior
参看element的select相同功能实现
https://codepen.io/anon/pen/gJaGdx?&editable=true
Is your feature request related to a problem? Please describe.
且不说 updateForm & getFormValue 的繁琐;
常见的场景是 el-dialog 里套一个 el-form-renderer。如果希望 form 有默认值,那当前的做法是:
Describe the solution you'd like
v-model,别让用户关心 updateForm 和 getFormValue 的时机
Describe the solution you'd like
数据回填时,model经transformOutputValue处理之后,只保留content内的id作为form的属性
其他字段也保留
form表单的其他字段,可能会在其他的地方使用,如下代码。
实际上model经transformOutputValue处理之后已丢失了。
this.form = {
name: 'tom',
age: 8
}
<el-form-renderer v-model="form" :content="[{id: 'name', label:'姓名'}]" >
<template>
{{form.age}} 改变form.name,会导致form.age变成undefined
</template>
</el-form-renderer>
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
{
type: "checkbox",
id: "id",
label: 'checkbox'
}
尝试了一下group,但是报错
content: [
{
id: "person",
type: "group",
items: [
{
id: "name1",
label: "name1",
type: "input",
},
{
id: "name2",
label: "name2",
type: "input",
}
]
}
]
Steps to reproduce the behavior:
返回报错“Cannot read property 'name1' of undefined"”
能不能给个group的相关示例,谢谢
Is your feature request related to a problem? Please describe.
无
Describe the solution you'd like
如标题
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
options里的value如果是number的0,在form-renderer会被转成undefined
Expected behavior
允许 value: 0
.
**environment information: **
TODO
1.复制下面代码, 覆盖这个demo的代码(https://femessage.github.io/el-form-renderer/#/Demo/value-format)
2. 点击 set value
, 再点击 log value
, 表单值会正常被打印
3. 点击 updater
会出现错误, 再点击 log value
会打印 { startDate: undefined, endDate: undefined }
<template>
<div class="format">
<el-form-renderer :content="content" inline ref="formRender">
<el-form-item>
<el-button @click="setValue">set value</el-button>
<el-button type="primary" @click="getValue">log value</el-button>
<el-button type="warning" @click="updater">updater</el-button>
</el-form-item>
</el-form-renderer>
</div>
</template>
<script>
export default {
name: 'format',
data() {
return {
content: [
{
id: 'name',
label: 'name',
type: 'input',
},
{
el: {
type: 'daterange',
valueFormat: 'yyyy-MM-dd'
},
type: 'date-picker',
id: 'date',
label: 'date',
inputFormat: (row) => {
return [row.startDate, row.endDate]
},
outputFormat: (val) => {
if (!val) {
return {startDate: '', endDate: ''}
}
return {
startDate: val[0],
endDate: val[1]
}
}
}
]
}
},
methods: {
getValue () {
const value = this.$refs.formRender.getFormValue()
console.log(value) // 输出为对应id 和值组成的对象
},
setValue () {
this.$refs.formRender.updateForm({
startDate: '2019-01-01',
endDate: '2019-01-02'
})
},
updater() {
this.$refs.formRender.updateForm({
name: 'I\'m a KING!'
})
}
}
}
</script>
保持已被format的值, TODO
期望支持自定义布局
有个自定义组件,其没有 v-model 而是使用了两个 sync 属性与外界同步信息。
现有问题:在table 中如果除了 新增 修改 查看的dialog之外,还有其他的dialog,要怎么配置呢,或者说能否在demo里面增加一个说明
用组合 api 似乎失去了响应式。
I am currently playing with demo page of url
i entered firstname in textbox then right after that trying to write space and then lastname.
but it won't allow me to add space and lastname at the end. it will trim the space and reset the cursor.
here is the event called while writing the text
updateValue $emit by
please can anyone help to solve this issue.
Is your feature request related to a problem? Please describe.
很多场景希望使用 el-form-item 原生的 label slot 功能。但目前不支持
Describe the solution you'd like
当识别 label 为 vnode 时,将其当做 slot 传入 el-form-item
在使用了 remote 的 content 中插入一项,remote 重新发出请求
可以在 watch 里比对一下:如果前后的 url 或 request 函数的引用相同,则不发出请求
el-tree的数据用的key是data,与el-form-renderer中冲突
如果我想做一个联动的select组件 A、B。B请求函数依赖A的value,如何去做?
目前我是通过props传入一个map参数合集,对应id字段,如果参数合集更新则重新调用接口,根据change事件手动更新参数,如果在复杂一点则用了slot代替了content里的组件,如何有更好的做法?
当使用 slot 的时候,我们希望 slot 中的值也出现在 v-model 中,这样提交表单时直接提交整个 model 即可
since update el-form-renderer value using api updateForm
,
then get value from el-form-renderer named getForm
may be more consistently.
suggestion: add api getForm
, getting same result with getFormValue
, add deprecated api getFormValue
Describe the bug
当新建用户的时候期望的是能够使用空的表单,但是谷歌浏览器自动填充了
To Reproduce
谷歌浏览器,点击http://xpaas-test.deepexi.io/xpaas-staff-console/index.html#/user-management 选择其他应用,添加用户,这时候用户名和密码都自动填充了
Expected behavior
期望能够给与用户是否让表单的值自动填充
**environment information: **
win10 chrome 70+
{
$id: '',
component: 自定义组件,
label: ''
},
希望也可以把方法也传给 自定义组件 ,自定义组件内部就可以通过emit触发传过来的方法了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.