Giter VIP home page Giter VIP logo

el-form-renderer's People

Contributors

2nthony avatar allcontributors[bot] avatar alvin-liu avatar cjfff avatar colmugx avatar dependabot-preview[bot] avatar donaldshen avatar eviiit avatar gd4ark avatar jbguy avatar leezng avatar levy9527 avatar lianghx-319 avatar ouzuyu avatar snowlocked avatar xrr2016 avatar yolofit avatar zhn4 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

el-form-renderer's Issues

增加请求参数配置

如果我想做一个联动的select组件 A、B。B请求函数依赖A的value,如何去做?

目前我是通过props传入一个map参数合集,对应id字段,如果参数合集更新则重新调用接口,根据change事件手动更新参数,如果在复杂一点则用了slot代替了content里的组件,如何有更好的做法?

type=group的用法

Describe the bug

尝试了一下group,但是报错

Screenshots

content: [
                {
                    id: "person",
                    type: "group",
                    items: [
                        {
                            id: "name1",
                            label: "name1",
                            type: "input",
                        },
                        {
                            id: "name2",
                            label: "name2",
                            type: "input",
                        }
                    ]
                }
            ]

To Reproduce

Steps to reproduce the behavior:
返回报错“Cannot read property 'name1' of undefined"”

Expected behavior

能不能给个group的相关示例,谢谢

environment information

  • Version [e.g. 22]
  • OS: MAC
  • Browser chrome

1.2.0版本后 enableWhen不生效

使用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>

[误会]: 调用 `updateForm` 时 `inputFormat` 导致产生异常.

Describe the bug

TODO

Screenshots

image

To Reproduce

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>

Expected behavior

保持已被format的值, TODO

environment information

  • 1.12.1
  • Windows
  • Chrome

支持 v-model

Is your feature request related to a problem? Please describe.
且不说 updateForm & getFormValue 的繁琐;
常见的场景是 el-dialog 里套一个 el-form-renderer。如果希望 form 有默认值,那当前的做法是:

  1. elDialog.visible = true,然后层 nextTick 后调用 updateForm(一层不保险,有反馈过
  2. 监听 el-dialog 的 opened 事件,然后 updateForm

两种都很丑。且易触发 rule 校验等各种奇怪问题
image

Describe the solution you'd like
v-model,别让用户关心 updateForm 和 getFormValue 的时机

[bug]: 独立设置的 `disabled` 失效

Describe the bug

如题

Screenshots

1

image

2

image

image

Expected behavior

  • 期待回复生效
  • 影响到项目, 但曲线办法是部门开始使用 readonly;

environment information

  • Version 1.13.1
  • OS: macOS
  • Browser: ever-green

Support inline form items?

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.

增加自定义label内容

Is your feature request related to a problem? Please describe.
增加自定义label内容
Describe the solution you'd like
A clear and concise description of what you want to happen.
表单label中可能会有一些自定义内容,如帮助信息等

Describe alternatives you've considered
对表单内的lable都可以添加自定义内容slot

Additional context
image

回填时,保留model的数据

Describe the solution you'd like
数据回填时,model经transformOutputValue处理之后,只保留content内的id作为form的属性

期望

其他字段也保留

场景:

form表单的其他字段,可能会在其他的地方使用,如下代码。
实际上model经transformOutputValue处理之后已丢失了。

在线demo

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>

content 表单下的 disabled 失效

Describe the bug

content 表单下数组里面传入的 disabled 失效
传入的 disabled 为 true
image

Screenshots

image


image

Expected behavior

environment information

clone 值时, file 对象会丢失

Describe the bug

使用自定义组件时,若model 值包含 File 对象,会丢失

我的用例,封装了 el-upload 组件,需要拿到 file 对象,
结果经过 getFormValueclone 值后, file 对象丢失了

Screenshots

这个是 `getFormValue` 得到的值
{
  "status": "ready",
  "name": "idea-settings-190507 - 副本.bin",
  "size": 12047,
  "percentage": 0,
  "uid": 1569289372447,
  "raw": {
    "uid": 1569289372447
  }
}

raw 是 File 的原始对象,结果只剩 element-ui 赋的 uid 字段了。。

Expected behavior

正常返回 file 对象

environment information

  • v1.11.2

改变 content 时 remote 会重新请求

To Reproduce

在使用了 remote 的 content 中插入一项,remote 重新发出请求

Expected behavior

可以在 watch 里比对一下:如果前后的 url 或 request 函数的引用相同,则不发出请求

Not allowing to add space and word at the end of textbox and textarea

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
events whilte typing

updateValue $emit by

please can anyone help to solve this issue.

add api: getForm

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

有两个英文README

Describe the bug
有两个英文README

Screenshots
image

Expected behavior
删掉旧的?

关于组建中 dialog的使用问题

现有问题:在table 中如果除了 新增 修改 查看的dialog之外,还有其他的dialog,要怎么配置呢,或者说能否在demo里面增加一个说明

期望能够设置切换radio,动态控制同级input的状态类似于隐藏显示.

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.
first-tesee-1

场景: 一个表单新增页面、一个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的校验方法,如下图。这种触发方式有实践过
image

readonly 模式改进

input & textarea 的 readonly 模式只考虑了 label 在 左侧的定位;当 label 在其他位置时就会很丑陋了。

建议用回 input & textarea,使用原生 readonly 属性。然后用如下 css 固定样式

textarea[readonly] {
  border: 1px solid #dcdee6; // 只读状态不要有 focus 状态
}

image

期望能够设置表单项目的顺序

Is your feature request related to a problem? Please describe.
no

Describe the solution you'd like
期望能对渲染的表单项目进行排序

Describe alternatives you've considered
例如以下的表单,现在是分成了左右两行;我需要按照这个顺序来显示,但是我现在必须使用2个form-renderer来显示;期望只使用一个来配置;
image

Additional context
如题
现在的代码结构如下
image

updateValue do not call inputFormatter Default

Version

1.3.0

OS/Browsers version

Windows 10 - Chrome 73

Framework

nuxt

Questions

my formContent item has set inputFormat, there is nothing wrong when call updateForm. But when i call updateVaule which setted inputFormat, error occurred.
updateForm
Here will call the inpueFormat inside!
image
But updateVaule didn't.

What is Expected?

Maybe write the default inputFormat code in the function updateValue, because updateForm just calls updateValue Iteratively

field 组件类型为 Boolean , 值为 false 时, inputFormat 不生效

Describe the bug

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 时,还是使用原来的值

Expected behavior

绑定 inputFormat 返回的值,包括 false, "" 这些

environment information

  • 1.11.0

[Feature]: 支持 label 接受 vnode 定义

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

表单联动

场景如下
package需要以groupId为前缀
希望可以自动补充前缀

image

table的searchForm通过component传自定义组件,希望可以传prop给该自定义组件

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.

el-cascader 级联组件的异步设值支持

Version

1.3.0

OS/Browsers version

Windows 10 - Chrome 73

Framework

nuxt

Questions

I want to use the el-cascader in my project, but my props options is asynchronous, now i not found the api in the document
image

What is Expected?

Get asynchronous support of props data

怎么实现动态增减表单项,点击按钮动态增加删除

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 点击 label 后,不会触发 change 事件

{
  type: "checkbox",
  id: "id",
  label: 'checkbox'
}
  1. label 和 checkbox 的顺序是反的。正确的应该是 checkbox label。使用组件渲染出来的是 label checkbox
  2. 最终渲染出来的 checkbox,点击 label 后,不会触发 change 事件修改 checkbox 的值

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.