| 123456789 |
- /*!
- * FormCreate 低代码表单渲染器
- * @form-create/component-subform v2.6.2
- * (c) 2018-2024 xaboy
- * Github https://github.com/xaboy/form-create
- * Site https://form-create.com/
- * Released under the MIT License.
- */
- (function(i,s){typeof exports=="object"&&typeof module!="undefined"?module.exports=s():typeof define=="function"&&define.amd?define(s):(i=typeof globalThis!="undefined"?globalThis:i||self,i.FcSubForm=s())})(this,function(){"use strict";var A=Object.defineProperty;var l=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var f=(i,s,o)=>s in i?A(i,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[s]=o,h=(i,s)=>{for(var o in s||(s={}))M.call(s,o)&&f(i,o,s[o]);if(l)for(var o of l(s))R.call(s,o)&&f(i,o,s[o]);return i};function i(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function s(){return s=Object.assign?Object.assign.bind():function(n){for(var t,r=1;r<arguments.length;r++)for(var e in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n},s.apply(this,arguments)}var o=["attrs","props","domProps"],c=["class","style","directives"],d=["on","nativeOn"],p=function(n){return n.reduce(function(t,r){for(var e in r)if(!t[e])t[e]=r[e];else if(o.indexOf(e)!==-1)t[e]=s({},t[e],r[e]);else if(c.indexOf(e)!==-1){var v=t[e]instanceof Array?t[e]:[t[e]],O=r[e]instanceof Array?r[e]:[r[e]];t[e]=[].concat(v,O)}else if(d.indexOf(e)!==-1)for(var a in r[e])if(t[e][a]){var j=t[e][a]instanceof Array?t[e][a]:[t[e][a]],$=r[e][a]instanceof Array?r[e][a]:[r[e][a]];t[e][a]=[].concat(j,$)}else t[e][a]=r[e][a];else if(e==="hook")for(var u in r[e])t[e][u]=t[e][u]?m(t[e][u],r[e][u]):r[e][u];else t[e]=r[e];return t},{})},m=function(n,t){return function(){n&&n.apply(this,arguments),t&&t.apply(this,arguments)}},y=p;const g=i(y);return{name:"fcSubForm",props:{rule:Array,options:Object,formCreateInject:{type:Object,required:!0},value:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0}},data(){return{cacheRule:{},cacheValue:{},type:void 0}},watch:{value(n){this.setValue(n)}},methods:{formData(n){this.cacheValue=JSON.stringify(n),this.$emit("input",n),this.$emit("change",n)},setValue(n){const t=JSON.stringify(n);this.cacheValue!==t&&(this.cacheValue=t,this.cacheRule.$f.coverValue(n||{}))},addRule(){const n=this.options?this.options:{submitBtn:!1,resetBtn:!1};n.formData=h({},this.value||{}),this.cacheRule={rule:this.rule,options:n}},add$f(n){this.cacheRule.$f=n,this.$nextTick(()=>{this.$emit("itemMounted",n)})},emitEvent(n,...t){this.$emit(n,...t)}},created(){this.addRule(),this.type=this.formCreateInject.form.$form()},render(){const n=arguments[0],{rule:t,options:r}=this.cacheRule,e=this.type;return n(e,g([{},{on:{"update:value":this.formData,"emit-event":this.emitEvent,input:this.add$f}},{},{props:{rule:t,option:r,disabled:this.disabled,extendOption:!0}}]))}}});
|