mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-20 07:14:23 +00:00
feat: 导出 utils 命名空间
This commit is contained in:
parent
66fd3e4862
commit
e3738cceca
@ -6,7 +6,7 @@ import {
|
|||||||
MetadataTransducer,
|
MetadataTransducer,
|
||||||
Designer,
|
Designer,
|
||||||
} from '@ali/lowcode-designer';
|
} from '@ali/lowcode-designer';
|
||||||
import { Setters } from '../types';
|
import { Setters, Utils } from '../types';
|
||||||
|
|
||||||
export interface ILowCodePluginConfig {
|
export interface ILowCodePluginConfig {
|
||||||
name: string;
|
name: string;
|
||||||
@ -53,9 +53,7 @@ export interface ILowCodePluginContext {
|
|||||||
plugins: ILowCodePluginManager;
|
plugins: ILowCodePluginManager;
|
||||||
designerCabin: IDesignerCabin;
|
designerCabin: IDesignerCabin;
|
||||||
setters: Setters;
|
setters: Setters;
|
||||||
/**
|
utils: Utils;
|
||||||
其他暂不增加,按需增加
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ILowCodePluginManagerPluginAccessor {
|
interface ILowCodePluginManagerPluginAccessor {
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
import { getSetter, registerSetter, getSettersMap } from '@ali/lowcode-editor-core';
|
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 = {
|
export type Setters = {
|
||||||
getSetter: typeof getSetter;
|
getSetter: typeof getSetter;
|
||||||
@ -9,3 +11,11 @@ export type Setters = {
|
|||||||
export type NodeRemoveOptions = {
|
export type NodeRemoveOptions = {
|
||||||
suppressRemoveEvent?: boolean;
|
suppressRemoveEvent?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const utils = {
|
||||||
|
isNodeSchema,
|
||||||
|
isFormEvent,
|
||||||
|
compatibleLegaoSchema,
|
||||||
|
getNodeSchemaById,
|
||||||
|
};
|
||||||
|
export type Utils = typeof utils;
|
||||||
@ -15,11 +15,12 @@ import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-o
|
|||||||
import DesignerPlugin from '@ali/lowcode-plugin-designer';
|
import DesignerPlugin from '@ali/lowcode-plugin-designer';
|
||||||
import './modules/live-editing';
|
import './modules/live-editing';
|
||||||
import { isPlainObject } from '@ali/lowcode-utils';
|
import { isPlainObject } from '@ali/lowcode-utils';
|
||||||
|
import utils from './modules/utils';
|
||||||
|
|
||||||
export * from './modules/editor-types';
|
export * from './modules/editor-types';
|
||||||
export * from './modules/skeleton-types';
|
export * from './modules/skeleton-types';
|
||||||
export * from './modules/designer-types';
|
export * from './modules/designer-types';
|
||||||
// export * from './modules/lowcode-types';
|
export * from './modules/lowcode-types';
|
||||||
|
|
||||||
const { hotkey, monitor, getSetter, registerSetter, getSettersMap } = editorCabin;
|
const { hotkey, monitor, getSetter, registerSetter, getSettersMap } = editorCabin;
|
||||||
registerDefaults();
|
registerDefaults();
|
||||||
@ -68,6 +69,7 @@ export {
|
|||||||
// store,
|
// store,
|
||||||
hotkey,
|
hotkey,
|
||||||
monitor,
|
monitor,
|
||||||
|
utils,
|
||||||
engineConfig,
|
engineConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,6 +99,7 @@ const getSelection = () => designer.currentDocument?.selection;
|
|||||||
hotkey,
|
hotkey,
|
||||||
monitor,
|
monitor,
|
||||||
init,
|
init,
|
||||||
|
utils,
|
||||||
engineConfig,
|
engineConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
export { NodeSchema } from '@ali/lowcode-types';
|
||||||
11
packages/engine/src/modules/utils.ts
Normal file
11
packages/engine/src/modules/utils.ts
Normal 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;
|
||||||
@ -57,6 +57,6 @@
|
|||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npm.alibaba-inc.com"
|
"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"
|
"gitHead": "3bfd7df92985ec6c9d2ccb8ba95d7b0829fa2b1d"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export function compatibleLegaoSchema(props: any): any {
|
|||||||
return newProps;
|
return newProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodeSchemaById(schema: NodeSchema, nodeId: string): NodeSchema | undefined {
|
export function getNodeSchemaById(schema: NodeSchema, nodeId: string): NodeSchema | undefined {
|
||||||
let found: NodeSchema | undefined;
|
let found: NodeSchema | undefined;
|
||||||
if (schema.id === nodeId) {
|
if (schema.id === nodeId) {
|
||||||
return schema;
|
return schema;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user