/*! form-create v1.5.4 | github https://github.com/xaboy/form-create | author xaboy */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("vue"),require("iview")):"function"==typeof define&&define.amd?define("formCreate",["vue","iview"],e):"object"==typeof exports?exports.formCreate=e(require("vue"),require("iview")):t.formCreate=e(t.Vue,t.iview)}("undefined"!=typeof self?self:this,function(t,e){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e._toString=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.$nt=function(t){r.default.nextTick(t)},e.$set=o,e.$del=function(t,e){r.default.delete(t,e)},e.toRawType=function(t){return a.call(t).slice(8,-1)},e.isUndef=function(t){return void 0===t||null===t},e.toString=function(t){return null==t?"":"object"===(void 0===t?"undefined":i(t))?JSON.stringify(t,null,2):String(t)},e.extend=function(t,e){for(var n in e)o(t,n,e[n]);return t},e.debounce=function(t,e){var n=null;return function(){for(var i=this,r=arguments.length,o=Array(r),a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i=!1;for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var a=n[r];if((i=Array.isArray(a))||u(a)){var s=void 0===e[r];i?(i=!1,s&&o(e,r,[])):s&&o(e,r,{}),t(e[r],a)}else o(e,r,a)}return e},e.uniqueId=function(){return++s},e.dateFormat=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(var i in n)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("00"+n[i]).substr((""+n[i]).length)));return t},e.errMsg=function(){return"\ngithub:https://github.com/xaboy/form-create\ndocument:http://www.form-create.com"};var r=function(t){return t&&t.__esModule?t:{default:t}}(n(5));function o(t,e,n){r.default.set(t,e,n)}var a=e._toString=Object.prototype.toString;function u(t){return"[object Object]"===a.call(t)}var s=0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n0&&i.forEach(function(e){return a(this,t),!(0,r.isString)(e)&&e.__handler__.mounted()}.bind(this))}}]),t}();function s(){return{validate:[],event:{},col:{},emit:[],props:[],on:{},options:[],title:"",value:"",field:"",className:""}}function l(t,e,n){var i=this,o={validate:[],event:{},col:{},emit:[],props:[],on:{},options:[],title:"",value:"",field:"",className:""};Object.keys(o).forEach(function(e){a(this,i),(0,r.isUndef)(t[e])&&(0,r.$set)(t,e,o[e])}.bind(this));var u={col:v(t.col),props:d(t.props),emitEvent:h(t.field,t.emitPrefix,t.emit,e),validate:f(t.validate),options:f(t.options)};return u.event=(0,r.extend)(p(t.event),u.emitEvent),u.on=c(t.on,u.emitEvent),Object.keys(u).forEach(function(e){a(this,i),(0,r.$set)(t,e,u[e])}.bind(this)),t.field||n||console.error("规则的 field 字段不能空"+(0,r.errMsg)()),t}function c(t,e){return Object.keys(e).length>0&&(0,r.extend)(t,e),t}function f(t){return Array.isArray(t)?t:[]}function h(t,e,n,i){var o=this,u={};return Array.isArray(n)?(n.forEach(function(n){a(this,o);var s=(0,r.toLine)(String(t)+"-"+String(n)).replace("_","-"),l=e?(String(e)+"-").toLowerCase()+(0,r.toLine)(n):e;u["on-"+String(n)]=u[n]=function(){for(var t=arguments.length,e=Array(t),n=0;n2&&void 0!==arguments[2]?arguments[2]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.vm=e,this.handler=n,this.options=i,this.vNode=new a.default(e),this.vData=new u.default,this.cache=null,this.$tickEvent=[],this.init()}return r(t,[{key:"init",value:function(){}},{key:"cacheParse",value:function(t,e){var n=this,i=this.handler,r=i.noValue,a=i.noCache;this.cache&&!0!==r&&!0!==a||(this.cache=e?e.parse.call(this,t):this.parse(t));var u=[].concat(f(this.$tickEvent));return this.$tickEvent=[],u.length&&(0,o.$nt)(function(){c(this,n),u.forEach(function(t){return c(this,n),t()}.bind(this))}.bind(this)),this.cache}},{key:"sync",value:function(t){(0,o.isFunction)(t)&&this.$tickEvent.push(t),this.clearCache(),this.vm._sync()}},{key:"clearCache",value:function(){var t=this;this.cache=null;var e=this.handler.rule.children;Array.isArray(e)&&e.length>0&&e.forEach(function(e){return c(this,t),!(0,o.isString)(e)&&e.__handler__.render.clearCache()}.bind(this))}},{key:"parse",value:function(t){var e=this,n=this.handler,r=n.type,a=n.rule,u=n.refName,l=n.key,h=n.noValue,p=n.origin,d=n.root,v=n.vm;if("template"===a.type){if(void 0!==s.default.compile){(0,o.isUndef)(a.vm)&&(a.vm=new s.default);var y=s.default.compile(a.template,{}).render.call(a.vm);return void 0===y.data&&(y.data={}),(0,o.extend)(y.data,a),y.key=l,[y]}return console.error("使用的 Vue 版本不支持 compile"+(0,o.errMsg)()),[]}if(h){a.ref=u,(0,o.isUndef)(a.key)&&(a.key="def"+(0,o.uniqueId)());var b=this.vNode.make(r,i({},a),function(){c(this,e);var n=[],i=a.children||[];return Array.isArray(i)&&i.length>0&&(n=i.map(function(n){return c(this,e),(0,o.isString)(n)?[n]:(n.__handler__||v._fComponent.createHandler([n],!0),n.__handler__.render.cacheParse(t,this))}.bind(this))),n}.bind(this));return b.key=l,[b]}return p.forEach(function(t){c(this,e),-1===d.indexOf(t)&&v._fComponent.removeField(t.__field__)}.bind(this)),this.handler.origin=[].concat(f(d)),t.makeComponent(this.handler.render)}},{key:"inputProps",value:function(){var t=this,e=this.handler,n=e.refName,i=e.key,r=e.field,a=e.rule,u=a.props,s=a.event,l=this.vData.props(u).props({value:this.vm._formData(r)}).ref(n).key(i+"fc"+r).on(s).on("input",function(e){c(this,t),this.onInput(e)}.bind(this));return(0,o.isUndef)(u.size)&&l.props({size:this.options.form.size}),l}},{key:"onInput",value:function(t){this.vm._changeFormData(this.handler.field,t)}}]),t}();e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:{};return a(this,e),new s(t,n,i,r,o)}.bind(this)},e.creatorTypeFactory=function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return function(o,u,l){var c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};a(this,n);var f=new s(t,o,u,l,c);return(0,r.isFunction)(e)?e(f):f.props(i,e),f}.bind(this)};var r=n(0),o=function(t){return t&&t.__esModule?t:{default:t}}(n(6));function a(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}function u(){return{event:{},validate:[],options:[],col:{},children:[],emit:[],template:null,emitPrefix:null}}var s=function(t){function e(t,n,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var u=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return u.rule=(0,r.extend)({event:{},validate:[],options:[],col:{},children:[],emit:[],template:null,emitPrefix:null},{type:t,title:n,field:i,value:o}),u.props({hidden:!1,visibility:!1}),(0,r.isPlainObject)(a)&&u.props(a),u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o.default),i(e,[{key:"type",value:function(t){return this.props("type",t),this}},{key:"get",value:function(){return this._data}},{key:"getRule",value:function(){return(0,r.extend)(this.rule,this.get())}},{key:"setValue",value:function(t){return(0,r.$set)(this.rule,"value",t),this}}]),e}();e.default=s;["emitPrefix","className","defaultSlot"].forEach(function(t){a(void 0,void 0),s.prototype[t]=function(e){return(0,r.$set)(this.rule,t,e),this}}.bind(void 0));["event","col"].forEach(function(t){a(void 0,void 0),s.prototype[t]=function(e){return(0,r.$set)(this.rule,t,(0,r.extend)(this.rule[t],e)),this}}.bind(void 0));["validate","options","children","emit"].forEach(function(t){a(void 0,void 0),s.prototype[t]=function(e){return Array.isArray(e)||(e=[e]),(0,r.$set)(this.rule,t,this.rule[t].concat(e)),this}}.bind(void 0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.componentCommon=e.getGlobalApi=e.formCreateStyle=e.iviewConfig=e.iview3=e.iview2=void 0;var i=Object.assign||function(t){for(var e=1;e1&&void 0!==arguments[1])||arguments[1];t?Array.isArray(t)||(t=[t]):t=this.fields(),t.forEach(function(t){c(this,e),o.$set(o._trueData(t).rule.props,"hidden",!!n)}.bind(this))},visibility:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t?Array.isArray(t)||(t=[t]):t=this.fields(),t.forEach(function(t){c(this,e),o.$set(o._trueData(t).rule.props,"visibility",!!n)}.bind(this))},model:function(t){var e=this,n={},i=this.fields();return t?Array.isArray(t)||(t=[t]):t=i,t.forEach(function(t){if(c(this,e),-1===i.indexOf(t))return console.error(String(t)+"字段不存在"+(0,r.errMsg)());n[t]=o._trueData(t)}.bind(this)),n},component:function(){return i({},o.components)},bind:function(t){var e=this,n={},i={},a=this.fields();return t?Array.isArray(t)||(t=[t]):t=a,t.forEach(function(t){if(c(this,e),-1===a.indexOf(t))return console.error(String(t)+"字段不存在"+(0,r.errMsg)());var n=o._trueData(t);i[t]={get:function(){return n.value},set:function(t){o.$set(n,"value",t)},enumerable:!0,configurable:!0}}.bind(this)),Object.defineProperties(n,i),n},submitStatus:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c(this,e),o._buttonProps(t)}.bind(this),resetStatus:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c(this,e),o._resetProps(t)}.bind(this),btn:{loading:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];c(this,n),o._buttonProps({loading:t})}.bind(this),finish:function(){this.loading(!1)},disabled:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];c(this,n),o._buttonProps({disabled:t})}.bind(this)},resetBtn:{loading:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];c(this,n),o._resetProps({loading:t})}.bind(this),finish:function(){this.loading(!1)},disabled:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];c(this,n),o._resetProps({disabled:t})}.bind(this)},closeModal:function(){c(this,n),o.$Modal.remove()}.bind(this),set:function(t,e,i){c(this,n),o.$set(t,e,i)}.bind(this),reload:function(e){return c(this,n),t.reload(e)}.bind(this),options:function(e){c(this,n),(0,r.deepExtend)(t.options,e),o._sync()}.bind(this),onSuccess:function(t){this.onSubmit(t)},onSubmit:function(t){this.options({onSubmit:t})},sync:function(e,i){if(c(this,n),!t.handlers[e])throw new Error(String(e)+"字段不存在"+(0,r.errMsg)());t.handlers[e].render.sync(i)}.bind(this),refresh:function(){c(this,n),o._refresh()}.bind(this)}};e.componentCommon={data:function(){return c(void 0,void 0),{rules:{},components:{},cptData:{},buttonProps:{},resetProps:{},trueData:{},jsonData:{},$f:{},isShow:!0,watchs:[],unique:1}}.bind(void 0),methods:{_formField:function(){return Object.keys(this.trueData)},_changeFormData:function(t,e){-1!==Object.keys(this.cptData).indexOf(t)&&this.$set(this.cptData,t,e)},_changeValue:function(t,e){this.$set(this.trueData[t],"value",e)},_value:function(t){return void 0===this.trueData[t]?void 0:this.trueData[t].value},_trueData:function(t){return this.trueData[t]},_formData:function(t){return this.cptData[t]},_removeField:function(t){(0,r.$del)(this.cptData,t),(0,r.$del)(this.trueData,t),(0,r.$del)(this.jsonData,t),void 0!==this.components[t]&&(0,r.$del)(this.components,t)},_buttonProps:function(t){this.$set(this,"buttonProps",(0,r.deepExtend)(this.buttonProps,t))},_resetProps:function(t){this.$set(this,"resetProps",(0,r.deepExtend)(this.resetProps,t))},init:function(){var t=this,e=this._fComponent._type;this[e].forEach(function(n,i){c(this,t);var r=this.$watch(String(e)+"."+String(i)+".value",function(e){if(c(this,t),void 0===this.trueData[n.field])return r();this._changeValue(n.field,e)}.bind(this));this.watchs.push(r)}.bind(this))},_unWatch:function(){var t=this;this.watchs.forEach(function(e){return c(this,t),e()}.bind(this)),this.watchs=[]},_refresh:function(){this.unique+=1},_sync:function(){this.unique+=1,this._fComponent.fRender.cacheUnique=this.unique},_change:function(t,e){return this.jsonData[t]!==e&&(this.jsonData[t]=e,!0)}}}},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1])||arguments[1];return(0,r.isUndef)(t)?this:(Array.isArray(t)?t.forEach(function(t){o(this,e),(0,r.$set)(this._data.class,(0,r.toString)(t),!0)}.bind(this)):(0,r.isPlainObject)(t)?(0,r.$set)(this._data,"class",(0,r.extend)(this._data.class,t)):(0,r.$set)(this._data.class,(0,r.toString)(t),void 0===n||n),this)}},{key:"directives",value:function(t){return(0,r.isUndef)(t)?this:((0,r.$set)(this._data,"directives",this._data.directives.concat((0,r.toArray)(t))),this)}},{key:"init",value:function(){return this._data={class:{},style:{},attrs:{},props:{},domProps:{},on:{},nativeOn:{},directives:[],scopedSlots:{},slot:void 0,key:void 0,ref:void 0},this}},{key:"get",value:function(){return this._prev=this._data,this.init(),this._prev}}]),t}();e.default=u;["ref","key","slot"].forEach(function(t){o(void 0,void 0),u.prototype[t]=function(e){return(0,r.$set)(this._data,t,e),this}}.bind(void 0)),["scopedSlots","nativeOn","on","domProps","props","attrs","style"].forEach(function(t){o(void 0,void 0),u.prototype[t]=function(e,n){return(0,r.isUndef)(e)?this:((0,r.isPlainObject)(e)?(0,r.$set)(this._data,t,(0,r.extend)(this._data[t],e)):(0,r.$set)(this._data[t],(0,r.toString)(e),n),this)}}.bind(void 0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=v(i),this.rules=Array.isArray(e)?e:[],this.origin=[].concat(p(this.rules)),this.handlers={},this.fRender={},this.formData={},this.validate={},this.trueData={},this.components={},this.fieldList=[],this.switchMaker=this.options.switchMaker,this.id=(0,r.uniqueId)(),m(),this.$tick=(0,r.debounce)(function(t){return h(this,n),t()}.bind(this),150)}return i(t,[{key:"init",value:function(t){this.vm=t,this.createHandler(this.rules),t.$set(t,"cptData",this.formData),t.$set(t,"trueData",this.trueData),t.$set(t,"buttonProps",this.options.submitBtn),t.$set(t,"resetProps",this.options.resetBtn),t.$set(t,"rules",this.rules),t.$set(t,"components",this.components),void 0===this.fCreateApi&&(this.fCreateApi=(0,o.getGlobalApi)(this)),this.fCreateApi.rule=this.rules,this.fRender=new a.default(this)}},{key:"setHandler",value:function(t){var e=t.rule,n=t.field,i=t.isDef;this.handlers[n]=t,!0!==t.noValue?((0,r.$set)(this.formData,n,t.parseValue),(0,r.$set)(this.validate,n,e.validate),(0,r.$set)(this.trueData,n,{value:t.rule.value,rule:e})):!0===i&&(0,r.$set)(this.components,n,e)}},{key:"notField",value:function(t){return void 0===this.handlers[t]}},{key:"createHandler",value:function(t,e){var n=this;t.forEach(function(i,a){if(h(this,n),!e||!(0,r.isString)(i)){if(!i.type)return console.error("未定义生成规则的 type"+(0,r.errMsg)());var u=y(i),s=i.__handler__||(0,o.getComponent)(this.vm,u,this.options),l=s.rule.children;if(!this.notField(s.field))return console.error(String(u.field)+" 字段已存在"+(0,r.errMsg)());this.switchMaker&&(t[a]=u,e||(this.origin[a]=u),i=u),this.setHandler(s),i.__handler__||b(i,s),Array.isArray(l)&&l.length>0&&this.createHandler(l,!0),e||this.fieldList.push(s.field)}}.bind(this)),t.forEach(function(e){h(this,n),e.__handler__.root=t,e.__handler__.origin=[].concat(p(t))}.bind(this))}},{key:"create",value:function(t){var e=(new(t.extend(this.component()))).$mount();return this.options.el.appendChild(e.$el),e}},{key:"mounted",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.vm=t;var i=this.options,o=i.mounted,a=i.onReload;setTimeout(function(){h(this,e),(0,r.$nt)(function(){h(this,e),Object.keys(this.handlers).forEach(function(n){h(this,e);var i=this.handlers[n];void 0!==t._formData(n)&&this.addHandlerWatch(i),i.mounted()}.bind(this)),n&&o&&o(this.fCreateApi),a&&a(this.fCreateApi)}.bind(this))}.bind(this))}},{key:"component",value:function(){return(0,u.default)(this)}},{key:"removeField",value:function(t){var e=this;if(void 0===this.handlers[t])throw new Error(String(t)+"字段不存在"+(0,r.errMsg)());var n=this.handlers[t].watch,i=this.fieldList.indexOf(t);(0,r.$del)(this.handlers,t),(0,r.$del)(this.validate,t),-1!==i&&this.fieldList.splice(i,1),n&&n.forEach(function(t){return h(this,e),t()}.bind(this)),this.vm._removeField(t)}},{key:"addHandlerWatch",value:function(t){var e=this;if(!0!==t.noValue){var n=t.field,i=this.vm,o=i.$watch("cptData."+String(n),function(r){if(h(this,e),void 0!==this.handlers[n]){var a=t.toValue(r),u=JSON.stringify(a);i._change(n,u)&&(t.setValue(a),t.watchFormValue(r))}else o()}.bind(this),{deep:!0}),a=i.$watch("trueData."+String(n)+".value",function(o){if(h(this,e),void 0!==o)if(void 0!==this.handlers[n]){var u=JSON.stringify(o);i._change(n,u)&&(t.watchValue(o),(0,r.$nt)(function(){return h(this,e),t.render.sync()}.bind(this)))}else a()}.bind(this),{deep:!0});t.watch.push(o,a);var u=function(){h(this,e),void 0!==this.handlers[n]&&this.$tick(function(){return h(this,e),t.render.sync()}.bind(this))}.bind(this);Object.keys(i._trueData(n).rule).forEach(function(r){h(this,e),"value"!==r&&t.watch.push(i.$watch("trueData."+String(n)+".rule."+String(r),u,{deep:!0}))}.bind(this))}}},{key:"isNotChange",value:function(t){var e=this;return t.reduce(function(t,n,i){return h(this,e),t&&n===this.origin[i]}.bind(this),!0)&&this.origin.reduce(function(n,i,r){return h(this,e),n&&i===t[r]}.bind(this),!0)}},{key:"reload",value:function(t){var e=this,n=this.vm;if(t){if(this.isNotChange(t))return void this.fCreateApi.refresh();this.origin.length||this.fCreateApi.refresh(),this.origin=[].concat(p(t)),n._unWatch(),Object.keys(this.handlers).forEach(function(t){return h(this,e),this.removeField(t)}.bind(this)),this.constructor(t,this.options),this.init(n),n.init(),(0,r.$nt)(function(){h(this,e),this.mounted(n,!1)}.bind(this))}else this.reload(this.rules);n.$f=this.fCreateApi}},{key:"getFormRef",value:function(){return this.vm.$refs[this.fRender.refName]}}],[{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.default,o=new t(e,(0,r.isElement)(n)?{el:n}:n);o.create(i);return o.fCreateApi}},{key:"install",value:function(e){e.prototype.$formCreate=function(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.create(n,i,e)},e.prototype.$formCreate.version="1.5.4",e.prototype.$formCreate.maker=l.default,e.component(s.formCreateName,e.extend((0,s.$FormCreate)()))}}]),t}();e.default=g,g.maker=l.default,g.version="1.5.4"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;nr.length;return o.push(this.makeUploadBtn(n,a)),[this.vNode.make("div",{key:"div4"+String(n),class:{"fc-upload":!0,"fc-hide-btn":!a}},o)]}},{key:"cacheParse",value:function(t){return this.cache=null,o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"cacheParse",this).call(this,t)}},{key:"makeUploadView",value:function(t,e,n){var i=this;return this.vNode.make("div",{key:"div1"+String(e),class:{"fc-files":!0}},function(){h(this,i);var r=[];return"image"===this.handler.rule.props.uploadType?r.push(this.vNode.make("img",{key:"img"+String(e),attrs:{src:t}})):r.push(this.vNode.icon({key:"file"+String(e),props:{type:l.iviewConfig.fileIcon,size:40}})),this.issetIcon&&r.push(this.makeIcons(t,e,n)),r}.bind(this))}},{key:"makeIcons",value:function(t,e,n){var i=this;return this.vNode.make("div",{key:"div2"+String(e),class:{"fc-upload-cover":!0}},function(){h(this,i);var r=[];return this.uploadOptions.handleIcon&&r.push(this.makeHandleIcon(t,e,n)),!0===this.uploadOptions.allowRemove&&r.push(this.makeRemoveIcon(t,e,n)),r}.bind(this))}},{key:"makeProgress",value:function(t,e){return this.vNode.make("div",{key:"div3"+String(e),class:{"fc-files":!0}},[this.vNode.progress({key:"upp"+String(e),props:{percent:t.percentage,hideInfo:!0},style:{width:"90%"}})])}},{key:"makeUploadBtn",value:function(t,e){return this.vNode.upload(this.propsData,!0===e?[this.vNode.make("div",{key:"div5"+String(t),class:{"fc-upload-btn":!0}},[this.vNode.icon({key:"upi"+String(t),props:{type:"file"===this.handler.rule.props.uploadType?"ios-cloud-upload-outline":l.iviewConfig.imgUpIcon,size:20}})])]:[])}},{key:"makeRemoveIcon",value:function(t,e,n){var i=this;return this.vNode.icon({key:"upri"+String(e)+String(n),props:{type:"ios-trash-outline"},nativeOn:{click:function(){h(this,i);var t=this.handler.el.fileList,e=t[n];t.splice(n,1),this.onRemove(e,t)}.bind(this)}})}},{key:"makeHandleIcon",value:function(t,e,n){var i=this;return this.vNode.icon({key:"uphi"+String(e)+String(n),props:{type:(0,s.toString)(this.uploadOptions.handleIcon)},nativeOn:{click:function(){h(this,i),this.onHandle(t)}.bind(this)}})}}]),e}(),_={image:["image",0],file:["file",0],uploadFileOne:["file",1],uploadImageOne:["image",1]},w=Object.keys(_).reduce(function(t,e){return h(void 0,void 0),t[e]=(0,c.creatorTypeFactory)("upload",function(t){return h(void 0,void 0),t.props({uploadType:_[e][0],maxLength:_[e][1]})}.bind(void 0)),t}.bind(void 0),{});w.uploadImage=w.image,w.uploadFile=w.file,e.default={handler:m,render:g,maker:w,name:"upload"}},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.formCreateName=e.$FormCreate=void 0;var i=function(t){return t&&t.__esModule?t:{default:t}}(n(7)),r=n(4);function o(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}var a=function(){return o(void 0,void 0),{name:"FormCreate",props:{rule:{type:Array,required:!0,default:function(){return o(void 0,void 0),{}}.bind(void 0)},option:{type:Object,default:function(){return o(void 0,void 0),{}}.bind(void 0),required:!1},value:Object},data:r.componentCommon.data,methods:r.componentCommon.methods,render:function(){return this._fComponent.fRender.render(this._fComponent.vm)},created:function(){this._fComponent=new i.default(this.rule,this.option),this._fComponent._type="rule",this._fComponent.init(this),this.$emit("input",this._fComponent.fCreateApi)},mounted:function(){var t=this;this._fComponent.mounted(this),this.$f=this._fComponent.fCreateApi,this.$watch("rule",function(e){o(this,t),this._fComponent.reload(e),this.$emit("input",this.$f)}.bind(this)),this.$emit("input",this.$f),this.init()}}}.bind(void 0);e.$FormCreate=a,e.formCreateName="FormCreate"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.install=r;var i=function(t){return t&&t.__esModule?t:{default:t}}(n(7));function r(t){!0!==t._installedFormCreate&&(t._installedFormCreate=!0,t.use(i.default))}"undefined"!=typeof window&&window.Vue&&r(Vue),t.exports.default=t.exports=i.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n0&&this.handler.parseValue.length>=e.maxLength)){var n=this.handler.unique;return this.vNode.make("div",{key:"ifbd3"+String(n),class:{"fc-upload-btn":!0},on:{click:function(){p(this,t),this.showModel()}.bind(this)}},[this.vNode.icon({key:"ifbi3"+String(n),props:{type:this._props.icon,size:20}})])}}},{key:"makeSpin",value:function(){if(!0===this._props.spin){var t=this.handler.unique;return this.vNode.make("Spin",{props:{fix:!0},key:"ifsp"+t,class:{"fc-spin":!0}},[this.vNode.icon({props:{type:"load-c",size:18},class:{"fc-spin-icon-load":!0},key:"ifspi"+t}),this.vNode.make("div",{domProps:{innerHTML:"加载中..."},key:"ifspd"+t})])}}},{key:"makeIcons",value:function(t,e,n){var i=this;if(!0===this.issetIcon)return this.vNode.make("div",{key:"ifis"+String(e)+String(n),class:{"fc-upload-cover":!0}},function(){p(this,i);var r=[];return!1!==this._props.handleIcon&&r.push(this.makeHandleIcon(t,e,n)),!0===this._props.allowRemove&&r.push(this.makeRemoveIcon(t,e,n)),r}.bind(this))}},{key:"makeRemoveIcon",value:function(t,e,n){var i=this;return this.vNode.icon({key:"ifri"+String(e)+String(n),props:{type:"ios-trash-outline"},nativeOn:{click:function(){p(this,i),!1!==this.onRemove(t)&&(this.handler.parseValue.splice(n,1),this.sync())}.bind(this)}})}},{key:"makeHandleIcon",value:function(t,e,n){var i=this,r=this._props;return this.vNode.icon({key:"ifhi"+String(e)+String(n),props:{type:toString(r.handleIcon)},nativeOn:{click:function(){p(this,i),this.onHandle(t)}.bind(this)}})}},{key:"onRemove",value:function(t){var e=this.handler.rule.event["on-remove"];if(e)return e(t,this.handler.getValue())}},{key:"onHandle",value:function(t){var e=this.handler.rule.event["on-handle"];if(e)return e(t);this.defaultOnHandle(t)}},{key:"valid",value:function(t){if(t!==this.handler.field)throw new Error("无效的表单字段"+(0,u.errMsg)())}},{key:"showModel",value:function(){var t=this,e=!1!==this.onOpen(),n=this._props,i=n.width,r=n.height,o=n.src,a=n.title;e&&(this.vm.$Modal.remove(),setTimeout(function(){p(this,t),this.vm.$Modal.confirm({title:a,render:function(){return p(this,t),[this.makeSpin(),this.vNode.make("iframe",{attrs:{src:o},style:{height:r,border:"0 none",width:"100%"},on:{load:function(e){if(p(this,t),!0===this._props.spin){var n=document.getElementsByClassName("fc-spin")[0];n&&n.parentNode.removeChild(n)}try{if(!0===this.options.iframeHelper){var i=e.path[0].contentWindow;i[String(this.handler.field)+"_change"]=function(e){p(this,t),this.handler.setValue(e)}.bind(this),i.form_create_helper={close:function(e){p(this,t),this.valid(e),f.default.Modal.remove()}.bind(this),set:function(e,n){p(this,t),this.valid(e),i[String(e)+"_change"](n)}.bind(this),get:function(e){return p(this,t),this.valid(e),this.handler.rule.value}.bind(this)}}}catch(e){}}.bind(this)},key:"ifmd"+(0,u.uniqueId)()})]}.bind(this),onOk:function(){return p(this,t),this.onOk()}.bind(this),onCancel:function(){return p(this,t),this.onCancel()}.bind(this),showCancel:!0,closable:!0,scrollable:!0,width:i})}.bind(this),301))}}]),e}();_.prototype.defaultOnHandle=s.default.render.prototype.defaultOnHandle,Object.keys(g).forEach(function(t){p(void 0,void 0),_.prototype[t]=function(){var e=this.handler.rule.event[g[t]];if(e)return e(this.handler.getValue())}}.bind(void 0));var w={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]},k=Object.keys(w).reduce(function(t,e){return p(void 0,void 0),t[e]=(0,c.creatorTypeFactory)("frame",function(t){return p(void 0,void 0),t.props({type:w[e][0],maxLength:w[e][1]})}.bind(void 0)),t}.bind(void 0),{});k.frameInput=k.frameInputs,k.frameFile=k.frameFiles,k.frameImage=k.frameImages,e.default={handler:m,render:_,name:"frame",maker:k}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n0&&i.push(this.makeFormBtn(n)),this.vNode.form(this.propsData,[this.vNode.row((0,r.extend)({props:this.options.row||{}},{key:"row"+n}),i)])}}},{key:"makeComponent",value:function(t){return this.makeFormItem(t.handler,t.cacheParse(this),"fItem"+String(t.handler.key)+String(this.unique))}},{key:"makeFormItem",value:function(t,e,n){var i=t.rule,r=t.unique,o=t.field,a=t.refName,u=i.className,s=this.vData.props({prop:o,label:i.title,labelFor:r,rules:i.validate,labelWidth:i.col.labelWidth,required:i.props.required}).key(n).ref("fItem"+a).class(u).get(),l=this.vNode.formItem(s,e);return!0===this.propsData.props.inline?[l]:this.makeCol(i,n,[l])}},{key:"makeCol",value:function(t,e,n){return this.vNode.col({props:t.col,class:{__fc_h:!0===t.props.hidden,__fc_v:!0===t.props.visibility},key:String(e)+"col1"},n)}},{key:"makeFormBtn",value:function(t){var e=[],n=!1!==this.vm.buttonProps&&!1!==this.vm.buttonProps.show,i=!1!==this.vm.resetProps&&!1!==this.vm.resetProps.show;return n&&e.push(this.makeSubmitBtn(t,i?19:24)),i&&e.push(this.makeResetBtn(t,4)),this.vNode.col({props:{span:24},key:String(this.unique)+"col2"},e)}},{key:"makeResetBtn",value:function(t,e){var n=this,i=(0,r.isUndef)(this.options.resetBtn.col)?{span:e,push:1}:this.options.resetBtn.col;return this.vNode.col({props:i,key:String(this.unique)+"col3"},[this.vNode.button({key:"frsbtn"+String(t),props:this.vm.resetProps,on:{click:function(){s(this,n),this.fCreateApi.resetFields()}.bind(this)}},[this.vm.resetProps.innerText])])}},{key:"makeSubmitBtn",value:function(t,e){var n=this,i=(0,r.isUndef)(this.options.submitBtn.col)?{span:e}:this.options.submitBtn.col;return this.vNode.col({props:i,key:String(this.unique)+"col4"},[this.vNode.button({key:"fbtn"+String(t),props:this.vm.buttonProps,on:{click:function(){s(this,n),this.fCreateApi.submit()}.bind(this)}},[this.vm.buttonProps.innerText])])}}]),t}();e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=this;return{name:String(i.formCreateName)+"Core",data:r.componentCommon.data,render:function(){return o(this,e),t.fRender.render(t.vm)}.bind(this),methods:r.componentCommon.methods,created:function(){this._fComponent=t,this._fComponent._type="rules",t.init(this)},mounted:function(){var e=this;t.mounted(this),this.$f=t.fCreateApi,this.init(),this.$watch("rules",function(t){o(this,e),this._fComponent.reload(t)}.bind(this))}}};var i=n(12),r=n(4);function o(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),r=function(t){return t&&t.__esModule?t:{default:t}}(n(9)),o=n(0);function a(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}var u=function(){a(void 0,void 0);var t={};Object.keys(r.default).forEach(function(e){a(void 0,void 0);var n=r.default[e],u=(0,o.isUndef)(n.maker);(u||void 0===n.maker[n.name])&&(t[n.name]=(0,i.creatorFactory)(n.name)),u||(0,o.extend)(t,n.maker)}.bind(void 0));var e=(0,i.creatorFactory)("");return(0,o.extend)(t,{create:function(t,n){var i=e("",n);return i.rule.type=t,i},createTmp:function(t,n,i){var r=e("",i);return r.rule.type="template",r.rule.template=t,r.rule.vm=n,r}}),t.template=t.createTmp,t}.bind(void 0)();e.default=u}])});