UNPKG

yanzhen-design-vue

Version:

39 lines (38 loc) 1.31 kB
import { defineAsyncComponent } from "vue"; import { defineComponent, withInstall } from "@yanzhen-lowcode/core"; import { buildProps, buildEmits } from "@yanzhen-libs/utils-vue"; import { mergeWith, omit } from "lodash-es"; import { textPreviewProps, textPreviewEmits } from "./src/text-preview.mjs"; function defaultTextPreviewOptions(options) { return { props: buildProps({ ...(options == null ? void 0 : options.props) ?? {}, ...textPreviewProps }), emits: buildEmits({ ...(options == null ? void 0 : options.emits) ?? {}, ...textPreviewEmits }), apis: mergeWith({}, options == null ? void 0 : options.apis) }; } function defineTextPreviewComponent(name, options) { const defaultOptions = defaultTextPreviewOptions(options); return defineComponent(name, { ...defaultOptions, ...omit(options, ...Object.keys(defaultOptions)), component: (options == null ? void 0 : options.component) ?? defineAsyncComponent({ loader: () => import("./src/text-preview.vue.mjs"), delay: 300, onError() { } }) }); } const TextPreview = defineTextPreviewComponent("text-preview"); const YzSchemaTextPreview = withInstall(TextPreview); export { YzSchemaTextPreview, YzSchemaTextPreview as default, defineTextPreviewComponent };