whale-plus
Version:
A Component Library for Vue 3
1 lines • 3.46 kB
Source Map (JSON)
{"version":3,"file":"index.full.min.mjs","sources":["../../../packages/utils/vue/install.ts","../../../packages/components/erm-form/src/form.ts","../../../internal/build/src/plugin-vue:export-helper","../../../packages/components/erm-form/src/form.vue","../../../packages/components/erm-form/index.ts"],"sourcesContent":["import { NOOP } from '@vue/shared';\nimport type { App, Directive } from 'vue';\nimport type { SFCInstallWithContext, SFCWithInstall } from './typescript';\n\nexport const withInstall = <T, E extends Record<string, any>>(\n main: T,\n extra?: E\n) => {\n (main as SFCWithInstall<T>).install = (app: App): void => {\n for (const comp of [main, ...Object.values(extra ?? {})]) {\n app.component(comp.name, comp);\n }\n };\n\n if (extra) {\n for (const [key, comp] of Object.entries(extra)) {\n (main as any)[key] = comp;\n }\n }\n return main as SFCWithInstall<T> & E;\n};\n\nexport const withInstallFunction = <T>(fn: T, name: string) => {\n (fn as SFCWithInstall<T>).install = (app: App) => {\n (fn as SFCInstallWithContext<T>)._context = app._context;\n app.config.globalProperties[name] = fn;\n };\n\n return fn as SFCInstallWithContext<T>;\n};\n\nexport const withInstallDirective = <T>(directive: T, name: string) => {\n (directive as SFCWithInstall<T>).install = (app: App): void => {\n app.directive(name, directive as Directive);\n };\n\n return directive as SFCWithInstall<T>;\n};\n\nexport const withNoopInstall = <T>(component: T) => {\n (component as SFCWithInstall<T>).install = NOOP;\n\n return component as SFCWithInstall<T>;\n};\n","// 这里主要放置的是组件的props,及一些公共的方法\nimport type { ExtractPropTypes } from 'vue';\n\nexport const formProps = {\n title: {\n type: String,\n default: '',\n },\n};\nexport type FormProps = ExtractPropTypes<typeof formProps>;\n","\nexport default (sfc, props) => {\n const target = sfc.__vccOpts || sfc;\n for (const [key, val] of props) {\n target[key] = val;\n }\n return target;\n}\n","<script lang=\"ts\" setup>\nimport { formProps } from './form';\ndefineOptions({\n name: 'WlErmForm',\n});\nconst props = defineProps(formProps);\n</script>\n<template>\n <div id=\"test\">{{ props.title }}</div>\n</template>\n","import { withInstall } from '@whale/utils';\nimport form from './src/form.vue';\n\nexport const WlErmForm = withInstall(form);\nexport default WlErmForm;\nexport * from './src/form';\n"],"names":[],"mappings":";;;;AACO,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK;AAC5C,EAAE,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK;AAC1B,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,EAAE;AAC7E,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,IAAI,KAAK,EAAE;AACb,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACrD,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AACvB,KAAK;AACL,GAAG;AACH,EAAE,OAAO,IAAI,CAAC;AACd,CAAC;;ACbW,MAAC,SAAS,GAAG;AACzB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH;;ACJA,kBAAe,CAAC,GAAG,EAAE,KAAK,KAAK;AAC/B,EAAE,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC;AACtC,EAAE,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,KAAK,EAAE;AAClC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACtB,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;;;;;;;;;ACFA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;;;;;;;;;;;;;ACHF,MAAC,SAAS,GAAG,WAAW,CAAC,IAAI;;;;"}