
/* eslint-disable */
// sd-skip-auto-import
import startCase from"lodash.startcase";import runtimeUtil from"./runtime-util";let promiseImportJs;function pascalCase(n){return startCase(n).replace(/ /g,"")}function codeExport(n){if(!promiseImportJs)promiseImportJs=Promise.all([import(/* webpackChunkName: "src-code-export" */"jszip"),import(/* webpackChunkName: "src-code-export" */"file-saver")]);return promiseImportJs.then((e=>{doExport(n,e[0].default,e[1].default)}))}function doExport(n,e,o){const t=[];if(!Array.isArray(n))n=[n];t.push(getIndexJs(n));n.forEach((n=>{t.push(getWebflowVue(n,n.head.tableName))}));savaAsZip(n[0].head.modulePkg,t,e,o)}function showFiles(n){n.forEach((n=>{console.log("--------------"+n.name+"--------------");console.log(n.content)}))}function savaAsZip(n,e,o,t){var r=new o;var s=r.folder(n);e.forEach((n=>{s.file(n.name,n.content)}));r.generateAsync({type:"blob"}).then((function(e){t(e,n+".zip")}))}function getIndexJs(n){const e=`import flowService from '@/webflow/flow-service'\n  ${n.map((n=>`flowService.addFlowForm('vue:${n.head.modulePkg}/${n.head.businessPkg}/${n.head.className}', './${n.head.tableName}.vue')`)).join("\n")}`;return{name:"index.js",content:e}}function getWebflowVue(n,e){const o=runtimeUtil.getTableInfo(n.fields,n.head.attrFD);const t=n.head.attrFD.columns;const r=`${e}`;const s=`<template>\n  <sd-webflow>\n    <template v-slot:form="{ model, fields, FlowData }">\n      <table>\n        <sd-form-colgroup :columns="${2*t}"/>\n        ${o.map((n=>`<tr>\n          ${n.map((n=>`<sd-form-item-td${getTdProps(n)}/>`)).join(`\n          `)}\n        </tr>`)).join(`\n        `)}\n      </table>\n    </template>\n  </sd-webflow>\n</template>\n\n<script>\nimport { componentLibraryMixin } from '@/form-designer/runtime-util'\nimport components from './_import-components/${r}-import'\n\nexport default {\n  name: '${pascalCase(r)}',\n  components,\n  mixins: [componentLibraryMixin],\n  data() {\n    return {}\n  },\n  methods: {},\n}\n<\/script>\n\n<style module lang="scss">\n@use '@/common/design' as *;\n</style>`;return{name:`${r}.vue`,content:s}}function getTdProps(n){const{columns:e,component:o,componentForDisplay:t,cid:r,...s}=n;const i={...s};const a=2*e-(null===i.label?0:1);if(1!==a)i.colspan=a;let m="";for(const n in i){const e=i[n];if(void 0===e)continue;if("string"!==typeof e)m+=` :${n}='${JSON.stringify(e)}'`;else m+=` ${n}="${e}"`}if(void 0!==o)if("string"!==typeof o)m+=` :component="componentLibrary['${r}']" `;else m+=` component="${o}"`;if(void 0!==t)if("string"!==typeof t)m+=` :componentForDisplay="componentLibraryForDisplay['${r}']" `;else m+=` componentForDisplay="${t}"`;return m}export default codeExport;