feat: 导出 utils 命名空间

This commit is contained in:
力皓 2021-05-24 17:51:17 +08:00
parent 66fd3e4862
commit e3738cceca
7 changed files with 30 additions and 7 deletions

View File

@ -6,7 +6,7 @@ import {
MetadataTransducer,
Designer,
} from '@ali/lowcode-designer';
import { Setters } from '../types';
import { Setters, Utils } from '../types';
export interface ILowCodePluginConfig {
name: string;
@ -53,9 +53,7 @@ export interface ILowCodePluginContext {
plugins: ILowCodePluginManager;
designerCabin: IDesignerCabin;
setters: Setters;
/**
*/
utils: Utils;
}
interface ILowCodePluginManagerPluginAccessor {

View File

@ -1,4 +1,6 @@
import { getSetter, registerSetter, getSettersMap } from '@ali/lowcode-editor-core';
import { isFormEvent, compatibleLegaoSchema, getNodeSchemaById } from '@ali/lowcode-utils';
import { isNodeSchema } from '@ali/lowcode-types';
export type Setters = {
getSetter: typeof getSetter;
@ -9,3 +11,11 @@ export type Setters = {
export type NodeRemoveOptions = {
suppressRemoveEvent?: boolean;
};
const utils = {
isNodeSchema,
isFormEvent,
compatibleLegaoSchema,
getNodeSchemaById,
};
export type Utils = typeof utils;

View File

@ -15,11 +15,12 @@ import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-o
import DesignerPlugin from '@ali/lowcode-plugin-designer';
import './modules/live-editing';
import { isPlainObject } from '@ali/lowcode-utils';
import utils from './modules/utils';
export * from './modules/editor-types';
export * from './modules/skeleton-types';
export * from './modules/designer-types';
// export * from './modules/lowcode-types';
export * from './modules/lowcode-types';
const { hotkey, monitor, getSetter, registerSetter, getSettersMap } = editorCabin;
registerDefaults();
@ -68,6 +69,7 @@ export {
// store,
hotkey,
monitor,
utils,
engineConfig,
};
@ -97,6 +99,7 @@ const getSelection = () => designer.currentDocument?.selection;
hotkey,
monitor,
init,
utils,
engineConfig,
};

View File

@ -0,0 +1 @@
export { NodeSchema } from '@ali/lowcode-types';

View File

@ -0,0 +1,11 @@
import { isFormEvent, compatibleLegaoSchema, getNodeSchemaById } from '@ali/lowcode-utils';
import { isNodeSchema } from '@ali/lowcode-types';
const utils = {
isNodeSchema,
isFormEvent,
compatibleLegaoSchema,
getNodeSchemaById,
};
export default utils;

View File

@ -57,6 +57,6 @@
"publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com"
},
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@1.0.48/build/index.html",
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@1.0.49/build/index.html",
"gitHead": "3bfd7df92985ec6c9d2ccb8ba95d7b0829fa2b1d"
}

View File

@ -55,7 +55,7 @@ export function compatibleLegaoSchema(props: any): any {
return newProps;
}
function getNodeSchemaById(schema: NodeSchema, nodeId: string): NodeSchema | undefined {
export function getNodeSchemaById(schema: NodeSchema, nodeId: string): NodeSchema | undefined {
let found: NodeSchema | undefined;
if (schema.id === nodeId) {
return schema;