UNPKG

@sepveneto/mpd-core

Version:

## 安装 ```cmd pnpm i @sepveneto/mpd-core npm i @sepveneto/mpd-core yarn add @sepveneto/mpd-core ```

93 lines (90 loc) 2.55 kB
import { MicroAppConfig } from '@micro-app/types'; import { CSSProperties } from 'vue-demi'; import { UploadRequestOptions } from 'element-plus'; export { CoreDataV1, TabbarRecord, upgrade } from './upgrade/index.cjs'; declare type EditorConfig = { version?: string; globalConfig: Record<PropertyKey, unknown>; body: Record<PropertyKey, unknown>; tabbars?: Record<PropertyKey, unknown>; }; declare type WidgetType = 'input' | 'number' | 'checkbox' | 'image' | 'colorPicker' | 'select' | 'radioGroup' | 'editor'; interface ISchema { type: WidgetType | string; label: string; key: string; link?: Record<string, ISchema[]>; [attr: string]: any; } declare type EditorSchema = { globalConfig: ISchema[]; [key: string]: ISchema[]; }; declare type EditorWidget = { _name: string; _view: string; _schema: string; _inContainer?: 'outer' | 'inner'; style?: Partial<CSSProperties>; [key: string]: unknown; }; declare type DisabledRules = boolean | Partial<{ delete: boolean; custom: boolean; sort: boolean; }>; declare type DisabledItemFn = (widget: EditorWidget) => DisabledRules; declare type EditorWidgets = { name: string; group: EditorWidget[]; }[]; declare type EditorSettings = { disabledItem?: DisabledItemFn; disabledAdd?: boolean; }; declare type EditorRoute = { name: string; path: string; meta?: Record<PropertyKey, unknown> & { title?: string; }; }; declare type EditorData = { upload?: (data: UploadRequestOptions) => Promise<string>; /** * 组件视图的可访问地址 */ remoteUrl?: string; /** * 编辑器数据 */ config: EditorConfig; /** * 组件的配置项 */ schema?: EditorSchema; /** * 可配置的组件列表 */ widgets?: { name: string; group: EditorWidget[]; }[]; /** * 编辑器的路由 */ routes?: EditorRoute[]; /** * 编辑器配置 */ settings?: EditorSettings; }; declare type DesignOptions = { url: string; name: string; inline: boolean; data?: EditorData; mounted?: () => void; } & MicroAppConfig; declare function useDesign(dom: string | Element, options: DesignOptions): [() => (EditorConfig | null), (data: EditorData) => void, Promise<boolean>]; export { type DesignOptions, type DisabledItemFn, type EditorConfig, type EditorData, type EditorRoute, type EditorSchema, type EditorSettings, type EditorWidget, type EditorWidgets, useDesign };