UNPKG

k-form-design

Version:

基于vue、ant-design-vue的表单设计器,可视化开发表单

1 lines 7.15 kB
(("undefined"!==typeof self?self:this)["webpackJsonpk_form_design"]=("undefined"!==typeof self?self:this)["webpackJsonpk_form_design"]||[]).push([[26],{"44e6":function(t,e,n){"use strict";var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.record.options.noFormItem?n(t.componentItem,t._b({tag:"component"},"component",t.getComponentProps,!1)):n("a-form-model-item",{attrs:{prop:"domains."+t.index+"."+t.record.model,rules:t.record.rules}},[n(t.componentItem,t._b({ref:"inputItem",tag:"component",on:{change:t.handleChange}},"component",t.getComponentProps,!1))],1)},i=[],r=(n("8e6e"),n("ac6a"),n("cadf"),n("456d"),n("ade3")),a=n("e74d");function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){Object(r["a"])(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var d=n("a6fb"),l=a["d"].getComponents(),p={name:"KFormModelItem",props:["record","domains","index","value","parentDisabled","dynamicData","config"],computed:{getComponentProps:function(){var t=this.record,e=c(c({record:t},this.componentOption),{},{config:this.config,disabled:this.disabled||t.options.disabled,parentDisabled:this.disabled||t.options.disabled,allowClear:t.options.clearable,mode:t.options.multiple?"multiple":"",value:this.value||t.options.defaultValue,style:t.options.width&&"width:".concat(t.options.width),height:"undefined"!==typeof t.options.height?t.options.height:"",dynamicData:this.dynamicData,options:t.options.dynamic?this.dynamicData[t.options.dynamicKey]?this.dynamicData[t.options.dynamicKey]:[]:t.options.options});return"textarea"===this.record.type&&(e.autoSize={minRows:t.options.minRows,maxRows:t.options.maxRows}),"alert"===this.record.type&&(e.message=t.label),"number"===this.record.type&&(e.min=t.options.min||0===t.options.min?t.options.min:-1/0,e.max=t.options.max||0===t.options.max?t.options.max:1/0,e.precision=t.options.precision>50||!t.options.precision&&0!==t.options.precision?null:t.options.precision),"select"===this.record.type&&(e.filterOption=!!t.options.showSearch&&function(t,e){return e.componentOptions.children[0].text.toLowerCase().indexOf(t.toLowerCase())>=0}),e.value&&e.value!==this.value&&this.$emit("input",e.value),e},componentItem:function(){return l[this.record.type].component},componentOption:function(){return d.omit(this.record.options,["defaultValue","disabled"])}},methods:{handleChange:function(t){var e=t;t.target&&(e=t.target.value),this.$emit("input",e)}}},m=p,u=n("2877"),f=Object(u["a"])(m,o,i,!1,null,null,null);e["a"]=f.exports},9803:function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("a-form-model",{ref:"dynamicValidateForm",attrs:{layout:"inline",model:t.dynamicValidateForm}},[n("a-table",{staticClass:"batch-table",attrs:{pagination:!1,rowKey:function(t){return t.key},columns:t.columns,dataSource:t.dynamicValidateForm.domains,bordered:"",scroll:{x:190*t.listLength+80+(t.record.options.hideSequence?0:60),y:t.record.options.scrollY}},scopedSlots:t._u([t._l(t.record.list,(function(e){return{key:e.key,fn:function(o,i,r){return[n("KFormModelItem",{key:e.key+"1",attrs:{record:e,config:t.config,parentDisabled:t.disabled,index:r,domains:t.dynamicValidateForm.domains,dynamicData:t.dynamicData},on:{input:t.handleInput},model:{value:i[e.model],callback:function(n){t.$set(i,e.model,n)},expression:"row[item.model]"}})]}}})),{key:"dynamic-opr-button",fn:function(e,o){return[n("div",{staticStyle:{witdh:"130px"}},[t.disabled?t._e():n("a-icon",{staticClass:"dynamic-opr-button",attrs:{title:"复制添加",type:"copy-o"},on:{click:function(e){return t.copyDomain(o)}}}),!t.disabled&&t.record.options.minLimit<t.dynamicValidateForm.domains.length?n("a-icon",{staticClass:"dynamic-opr-button",attrs:{title:"删除该行",type:"minus-circle-o"},on:{click:function(e){return t.removeDomain(o)}}}):t._e()],1)]}}],null,!0)}),n("Button",{attrs:{type:"dashed",disabled:t.disabled},on:{click:t.addDomain}},[n("a-icon",{attrs:{type:"plus"}}),t._v("增加 ")],1)],1)},i=[],r=(n("8e6e"),n("cadf"),n("456d"),n("ac6a"),n("ade3")),a=n("2909"),s=n("44e6"),c=n("e74d");function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function l(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?d(Object(n),!0).forEach((function(e){Object(r["a"])(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var p=c["d"].getComponent("aButton").component,m={name:"KBatch",props:["record","value","dynamicData","config","parentDisabled"],components:{KFormModelItem:s["a"],Button:p},watch:{value:{handler:function(t){this.dynamicValidateForm.domains=t||[]},immediate:!0,deep:!0}},data:function(){return{dynamicValidateForm:{domains:[]}}},computed:{listLength:function(){return this.record.list.filter((function(t){return!t.options.hidden})).length},columns:function(){var t=this,e=[];return this.record.options.hideSequence||e.push({title:"序号",dataIndex:"sequence_index_number",width:"60px",align:"center",customRender:function(t,e,n){return n+1}}),e.push.apply(e,Object(a["a"])(this.record.list.filter((function(t){return!t.options.hidden})).map((function(e,n){return{title:e.label,dataIndex:e.key,width:n===t.record.list.length-1?"":"190px",scopedSlots:{customRender:e.key}}})))),e.push({title:"操作",dataIndex:"dynamic-opr-button",fixed:"right",width:"80px",align:"center",scopedSlots:{customRender:"dynamic-opr-button"}}),e},disabled:function(){return this.record.options.disabled||this.parentDisabled}},methods:{validationSubform:function(){var t;return this.$refs.dynamicValidateForm.validate((function(e){t=e})),t},resetForm:function(){this.$refs.dynamicValidateForm.resetFields()},removeDomain:function(t){var e=this.dynamicValidateForm.domains.indexOf(t);-1!==e&&this.dynamicValidateForm.domains.splice(e,1)},copyDomain:function(t){this.dynamicValidateForm.domains.push(l(l({},t),{},{key:Object(c["a"])()})),this.handleInput()},addDomain:function(){var t={};this.record.list.forEach((function(e){t[e.model]=e.options.defaultValue})),this.dynamicValidateForm.domains.push(l(l({},t),{},{key:Object(c["a"])()})),this.handleInput()},handleInput:function(){this.$emit("change",this.dynamicValidateForm.domains)}},created:function(){if(this.record.options.minLimit)for(var t=0;t<this.record.options.minLimit;t++)this.addDomain()}},u=m,f=n("2877"),h=Object(f["a"])(u,o,i,!1,null,null,null),y=h.exports;e["default"]=y}}]);