import { IPlatformDataset, IPlatformListener } from '../../types/platform/common'; import { IAttributes, IPlatformApp, IPageComponent, IPlatformComponent, IDataSourceVariable, IDataVarMethod, // 勿删,为了生成d.ts IPlatformDataSource, IDependencies, LCDS } from '../../types'; import { IDynamicValue, PropBindType } from '../expression'; import { IEventFlow } from '../../types/platform/eventFlow'; import { IHandler, IPlatformSubApp, IPlatformComponentExtra } from '../../utils'; import { IBlockTemplate, ICalsReferenceContext } from './utils/block/index'; export { getUsedComps, generateCustomLoginConfigPathname, replaceGloalIdentifier } from './utils/common'; export { generateDefaultCode } from './utils/template'; interface IDeserializeContext { app?: IPlatformApp; dependencies?: any[]; dependenciesMap?: any; page?: IPageComponent; dereference?: boolean; } interface ISerializeContext { app?: any; page?: { id: string; }; component?: { id: string; module?: string; component?: string; }; /** * 依赖描述 * map 由 数组处理得到 */ dependencies?: any[]; dependenciesMap?: any; streamlineDefaultValue?: boolean; streamlineModuleName?: boolean; dereference?: boolean; } export declare function serializeValue({ ctx, key, dynamicValue, scope, streamlineDefaultValue, }: { ctx: ISerializeContext; key: string; dynamicValue: IDynamicValue; scope?: 'page' | 'component'; streamlineDefaultValue?: boolean; }): { key: string; value: any; extra?: any; }; export declare function deserializeValue(ctx: { page?: IDeserializeContext['page']; }, key: string, value: any, extra?: any): { key: string; value: { type: PropBindType; value: any; extra: any; }; }; interface ISerializeDynamicMapProps { ctx: ISerializeContext; map: { [key: string]: IDynamicValue; }; scope?: 'page' | 'component'; streamlineDefaultValue?: boolean; } export declare function serializeDynamicMap(props: ISerializeDynamicMapProps): { [key: string]: any; }; export declare function deserializeDynamicMap(ctx: IDeserializeContext, map: { [key: string]: string | any; }, extraMap?: { [key: string]: any; }): { [key: string]: IDynamicValue; }; export declare function serializeAttributes(ctx: ISerializeContext, scope: 'page' | 'component', attributes?: { [key: string]: IDynamicValue; }): { [key: string]: any; }; export declare function deserializeAttributes(ctx: IDeserializeContext, attributes?: IAttributes, attributesExtraData?: {}): { [key: string]: IDynamicValue; }; /** * 将dataset({state: {}, params: {}})从 weapp 结构转换为cals结构 * 目前仅转换 state 中的 initMethod.params 和 updateMethod.params */ export declare function serializeDataset(ctx: ISerializeContext, dataset: any): any; /** * 反序列化布局模板 * @param ctx * @param templates */ export declare function deserializeTemplates(ctx: IDeserializeContext, templates: any): {}; /** * 将dataset({state: {}, params: {}})从 cals 结构转换为weapp结构 * 目前仅转换 state 中的 initMethod.params 和 updateMethod.params */ export declare function deserializeDataset(ctx: IDeserializeContext, dataset: IPlatformDataset): any; export declare function normalizeQuery(query: any): any; export declare function deserializeDataVariables(_: any, data: IDataSourceVariable): { title: string; name: string; varType: "datasource"; dataType?: "object" | "array" | "record-collection" | "new-record" | "single-record" | "single-record-edit"; dataSourceName: string; initMethod?: IDataVarMethod; updateMethod?: IDataVarMethod; properties?: { [key: string]: any; }; }; export declare function serializeComponent(ctx: ISerializeContext & ({ page: Required['page']; } | { component: Required['component']; }), component: { xComponent?: { moduleName: string; name: string; }; xProps?: { data: { [prop: string]: IDynamicValue; }; directives?: { waIf?: IDynamicValue; waDisplay?: IDynamicValue; waFor?: IDynamicValue; waForKey?: IDynamicValue; }; listeners?: any[]; style: any; styleBind: IDynamicValue; classList: string[]; classListBind: IDynamicValue; commonStyle: any; scopedStyle?: string; styleBindPath?: string; staticResourceAttribute: string[]; }; xIndex?: number; properties?: { [key: string]: any; }; } & { id: string; label?: string; } & Pick, scope?: 'page' | 'component'): IPlatformComponent; export declare function deserializeComponent(ctx: IDeserializeContext, components: IPlatformComponent[]): { [key: string]: object; }; export declare function serializePage(ctx: Pick, page: any): IPageComponent; /** * 序列化布局 */ export declare function serializeLayouts(ctx: ISerializeContext, layouts?: { [key: string]: { data?: string; name?: string; label?: string; }; }): { name: string; label: string; data: {}; id: string; items?: IPlatformComponent[]; dataset?: IPlatformDataset; module?: string; ':class'?: string; ':style'?: string; scopedStyle?: string; }[]; export declare function deserializePage(ctx: { dependencies: IDeserializeContext['dependencies']; homePageId: string; }, page: IPageComponent): { isHome: boolean; vars: { data: { title: string; name: string; varType: "datasource"; dataType?: "object" | "array" | "record-collection" | "new-record" | "single-record" | "single-record-edit"; dataSourceName: string; initMethod?: IDataVarMethod; updateMethod?: IDataVarMethod; properties?: { [key: string]: any; }; }[]; }; data: { [key: string]: IDynamicValue; }; style: object; commonStyle: object; staticResourceAttribute: string[]; hideAdminPortalMenu: boolean; styleBindPath: any; id: string; dataset: any; componentInstances: { [key: string]: object; }; lowCodes: { type: string; code: string; description?: string; path?: string; name: string; }[]; listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; eventFlows: { listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; id: string; label?: string; description?: string; }[]; }; /** * [WeApps协议] to [CALS协议] * * @param data * @param optsions */ export declare function serializePlatformApp(data: any, optsions: { dependencies: object[]; }): IPlatformApp; /** * [CALS协议] to [WeApps协议] * * @param data */ export declare function deserializePlatformApp(data: IPlatformApp, optsions: { dependencies: object[]; }): { id: any; version: string; author: string; name: string; label: string; description: string; selectedPageId: string; historyType: any; theme: import("../../types").ITheme; pageInstanceList: { isHome: boolean; vars: { data: { title: string; name: string; varType: "datasource"; dataType?: "object" | "array" | "record-collection" | "new-record" | "single-record" | "single-record-edit"; dataSourceName: string; initMethod?: IDataVarMethod; updateMethod?: IDataVarMethod; properties?: { [key: string]: any; }; }[]; }; data: { [key: string]: IDynamicValue; }; style: object; commonStyle: object; staticResourceAttribute: string[]; hideAdminPortalMenu: boolean; styleBindPath: any; id: string; dataset: any; componentInstances: { [key: string]: object; }; lowCodes: { type: string; code: string; description?: string; path?: string; name: string; }[]; listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; eventFlows: { listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; id: string; label?: string; description?: string; }[]; }[]; lowCodes: { type: string; code: string; description?: string; path?: string; name: string; }[]; datasources: IPlatformDataSource[]; dataset: any; vars: { data: { title: string; name: string; varType: "datasource"; dataType?: "object" | "array" | "record-collection" | "new-record" | "single-record" | "single-record-edit"; dataSourceName: string; initMethod?: IDataVarMethod; updateMethod?: IDataVarMethod; properties?: { [key: string]: any; }; }[]; }; compHiddenConfig: any; npmDependencies: any; plugins: any; maxID: any; rootPath: any; themeVars: any; presetColors: any; appConfig: any; miniprogramPlugins: any; externalResources: import("../../types").IExternalResource[]; extra: any; dependencies: IDependencies; schemaVersion: string; layouts: {}; }; type ArrayElement = ArrayType extends readonly (infer ElementType)[] ? ElementType : never; export declare function deserializeCompositeComponent(component: ArrayElement, options: any): { id: string; dataset: any; componentInstances: { [key: string]: object; }; lowCodes: { type: string; code: string; description?: string; path?: string; name: string; }[]; listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; eventFlows: { listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; id: string; label?: string; description?: string; }[]; }; /** * page * [formily] to [CALS] * @deprecated 已过时,使用会产生意外错误,如不包含事件流 */ export declare function serializeRuntimePage(ctx: Pick, page: any): IPageComponent; export declare function serializeRuntimeDataset(ctx: any, dataset: any): any; /** * component * [formily] to [CALS] */ export declare function serializeRuntimeComponent(ctx: ISerializeContext & { page: Required['page']; }, component: any & { id: string; }): IPlatformComponent; /** * component * [CALS] to [formily] * To be continue, currently support listener */ export declare function deserializeRuntimeComponent(ctx: any, component: any): any; export declare function deserializeComponentLibraryMeta(meta: { styles?: string[]; dependencies?: { [lib: string]: string; }; components: { [key: string]: LCDS.IComponent; }; actions: { [key: string]: LCDS.IAction; }; }): { styles: string[]; dependencies: { [lib: string]: string; }; components: { [key: string]: { title: string; desc?: string; category: string; platforms?: { [key: string]: { tagName: 'audio'; }; }; thumbnail?: string; }; }; actions: { [key: string]: LCDS.IAction; }; }; export declare function processRuntimeCodeResources(ctx: { id: string; version?: string; }, resources: any, scope: string): any[]; /** * 解析 cals version 来生成 feature map */ export declare function parseVersion(version?: string, dependencies?: any[]): { defaultDynamicCssUnit: boolean; enableObserverRef: boolean; enablePageRoot: boolean; staticDatasourceProfile: boolean; enableAsyncMaterials: boolean; disablePageComponentInvoke: boolean; }; export declare function processListeners(listeners: IPlatformListener[], options?: { strict: boolean; }): { listeners: IPlatformListener[]; eventFlows: IEventFlow[]; }; export declare function processDependenciesVersionMap(dependencies?: IDependencies): {}; export declare function parseDependenciesVersion(version: string): string; export declare function processTemplatesToDependiencies(templates?: any[]): { name: string; version: string; srcZipUrl: string; mpPkgUrl: string; actions: any[]; components: { id: any; name: any; materialName: string; componentInstances: { [key: string]: object; }; compConfig: any; dataForm: any; emitEvents: any; lowCodes: any[]; /** * @TODO: 二者归一化 * lcds.Icompinent.meta !== ICompositedComponent.meta */ meta: any; npmDependencies: {}; listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; /** * 扩展 dataset 和 eventFlows 数据 */ dataset: any; eventFlows: { listeners: { key: string; trigger: string; type: string; handler: { name: string; moduleName: string; code: string; }; data: { [key: string]: IDynamicValue; }; args: { [key: string]: IDynamicValue; }; isCapturePhase: boolean; noPropagation: boolean; }[]; id: string; label?: string; description?: string; }[]; }[]; isComposite: boolean; schemaVersion: string; }; export declare function generateHandlerParamsDynamicMap(handler: IHandler): any; /** * 精简过滤子包数据 * 仅保留子包自身数据 */ export declare function streamlineSubApp(cals: any): IPlatformSubApp; /** * 还原引用 */ export declare function collapseCalsReference(cals: IPlatformApp | IPlatformSubApp, options: { blockTemplates: IBlockTemplate[]; }): IPlatformApp | IPlatformSubApp; /** * 展开引用 */ export declare function expandCalsReference(cals: IPlatformApp | IPlatformSubApp, options: { blockTemplates: IBlockTemplate[]; strict?: boolean; enableRestore?: boolean; processPickedTeamplate?: ICalsReferenceContext['processPickedTeamplate']; }): IPlatformApp | IPlatformSubApp; //# sourceMappingURL=index.d.ts.map