chunk-5a8d42e5.1fdcc22f.js 6.8 KB

12
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5a8d42e5"],{"469f":function(t,e,r){r("6c1c"),r("1654"),t.exports=r("7d7b")},"4aab":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("el-card",{staticClass:"create",scopedSlots:t._u([{key:"header",fn:function(){return[r("content-header")]},proxy:!0}])},[r("el-row",{attrs:{type:"flex",justify:"center"}},[r("configs-form")],1)],1)},i=[],o=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("lz-form",{ref:"form",attrs:{"get-data":t.getData,submit:t.onSubmit,errors:t.errors,form:t.form,"disable-stay":"","disable-redirect":"","edit-mode":""},on:{"update:errors":function(e){t.errors=e},"update:form":function(e){t.form=e}}},t._l(t.configs,function(e){return r("el-form-item",{key:e.id,attrs:{prop:e.slug,label:e.name,helper:e.desc}},[r("type-input",{attrs:{type:e.type,options:e.options},model:{value:t.form[e.slug],callback:function(r){t.$set(t.form,e.slug,r)},expression:"form[i.slug]"}})],1)}),1)},a=[],s=(r("8e6e"),r("456d"),r("ac6a"),r("96cf"),r("3b8d")),u=r("bd86"),c=r("ada3"),l=r("282a"),p=r("df78"),f=r("5d7e");function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(r,!0).forEach(function(e){Object(u["a"])(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var m={name:"ConfigsForm",components:{TypeInput:p["a"],LzForm:c["a"]},data:function(){return{form:{},errors:{},configs:[]}},computed:b({},Object(f["e"])(["CONFIG_TYPES"]),{category:function(){return this.$route.params.categorySlug}}),methods:{getData:function(){var t=Object(s["a"])(regeneratorRuntime.mark(function t(){var e,r,n;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(this.category){t.next=2;break}throw new Error("无法获取到 [ category ]");case 2:return t.next=4,Object(l["e"])(this.category);case 4:e=t.sent,r=e.data,this.configs=r,n={},r.forEach(function(t){n[t.slug]=t.value}),this.form=n;case 10:case"end":return t.stop()}},t,this)}));function e(){return t.apply(this,arguments)}return e}(),onSubmit:function(){var t=Object(s["a"])(regeneratorRuntime.mark(function t(){var e,r;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(l["l"])(this.form);case 2:e=t.sent,r=e.data,this.$store.commit("SET_CONFIG",{path:f["d"].SLUG,value:r});case 5:case"end":return t.stop()}},t,this)}));function e(){return t.apply(this,arguments)}return e}()}},y=m,d=r("2877"),O=Object(d["a"])(y,o,a,!1,null,null,null),v=O.exports,g={name:"ConfigValuesForm",components:{ConfigsForm:v}},E=g,j=Object(d["a"])(E,n,i,!1,null,null,null);e["default"]=j.exports},"5d73":function(t,e,r){t.exports=r("469f")},"768b":function(t,e,r){"use strict";var n=r("a745"),i=r.n(n);function o(t){if(i()(t))return t}var a=r("5d73"),s=r.n(a);function u(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=s()(t);!(n=(a=u.next()).done);n=!0)if(r.push(a.value),e&&r.length===e)break}catch(c){i=!0,o=c}finally{try{n||null==u["return"]||u["return"]()}finally{if(i)throw o}}return r}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function l(t,e){return o(t)||u(t,e)||c()}r.d(e,"a",function(){return l})},"7d7b":function(t,e,r){var n=r("e4ae"),i=r("7cd6");t.exports=r("584a").getIterator=function(t){var e=i(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return n(e.call(t))}},df78:function(t,e,r){"use strict";r("8e6e"),r("456d");var n=r("7618"),i=r("768b"),o=(r("ac6a"),r("28a5"),r("bd86")),a=r("5d7e"),s=r("8e5b"),u=r("b047c"),c=r.n(u);function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(r,!0).forEach(function(e){Object(o["a"])(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var f,h,b={name:"TypeInput",components:{FilePicker:s["a"]},inject:{elForm:{default:""},elFormItem:{default:""}},data:function(){return{filePickerKey:1}},props:{type:String,value:null,options:Object},computed:p({},Object(a["e"])(["CONFIG_TYPES"]),{selectOptions:function(){if(this.type!==this.CONFIG_TYPES.SINGLE_SELECT&&this.type!==this.CONFIG_TYPES.MULTIPLE_SELECT)return[];var t=this.options.options.split("\n"),e=[];return t.forEach(function(t){var r=t.split("=>").map(function(t){return t.trim()}),n=Object(i["a"])(r,2),o=n[0],a=n[1];a&&e.push({value:o,label:a})}),e}}),methods:{onInput:function(t){this.$emit("input",t)},initValue:function(){this.type===this.CONFIG_TYPES.FILE?this.options.max>1&&!Array.isArray(this.value)?this.onInput(this.value?[this.value]:[]):this.options.max<=1&&Array.isArray(this.value)&&this.onInput(this.value[0]||null):this.type===this.CONFIG_TYPES.MULTIPLE_SELECT?!Array.isArray(this.value)&&this.onInput([]):-1===["string","boolean","number"].indexOf(Object(n["a"])(this.value))&&this.onInput(null)},updateFilePicker:c()(function(){this.filePickerKey++},200)},watch:{type:{handler:function(){this.initValue()},immediate:!0},"options.max":function(t,e){t>1&&e>1||this.updateFilePicker(),this.initValue(),t>1&&t<e&&this.onInput(this.value.slice(0,t))},"options.ext":function(){this.updateFilePicker()}},render:function(t){var e=null,r={props:{value:this.value},on:{input:this.onInput}},n=null,i=this.CONFIG_TYPES;switch(this.type){case i.INPUT:case i.OTHER:e="el-input";break;case i.TEXTAREA:e="el-input",Object.assign(r.props,{rows:4,type:"textarea"});break;case i.FILE:e="file-picker",Object.assign(r.props,{max:this.options.max,ext:this.options.ext,multiple:this.options.max>1}),r.key=this.filePickerKey;break;case i.SINGLE_SELECT:case i.MULTIPLE_SELECT:var o=this.type===i.MULTIPLE_SELECT;"input"===this.options.type?(e=o?"el-checkbox-group":"el-radio-group",n=this.selectOptions.map(function(e){return t(o?"el-checkbox":"el-radio",{props:{key:e.value,label:e.value}},e.label)})):"select"===this.options.type&&(e="el-select",Object.assign(r.props,{multiple:o,clearable:o}),n=this.selectOptions.map(function(e){return t("el-option",{key:e.value,attrs:{value:e.value,label:e.label}})}));break;default:}return t(e,r,n)}},m=b,y=r("2877"),d=Object(y["a"])(m,f,h,!1,null,null,null);e["a"]=d.exports}}]);
  2. //# sourceMappingURL=chunk-5a8d42e5.1fdcc22f.js.map