mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
feat: 导出 utils 命名空间
This commit is contained in:
parent
66fd3e4862
commit
e3738cceca
@ -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 {
|
||||
|
||||
@ -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;
|
||||
@ -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,
|
||||
};
|
||||
|
||||
|
||||
@ -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": {
|
||||
"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"
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user