mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 03:01:16 +00:00
fix: remove common deprecated apis
This commit is contained in:
parent
8beefd3a1c
commit
1ec54e0a5f
@ -29,7 +29,10 @@ export default tseslint.config({
|
|||||||
rules: {
|
rules: {
|
||||||
'@stylistic/indent': ['error', 2],
|
'@stylistic/indent': ['error', 2],
|
||||||
'@stylistic/indent-binary-ops': ['error', 2],
|
'@stylistic/indent-binary-ops': ['error', 2],
|
||||||
'@stylistic/max-len': ['error', { code: 100, tabWidth: 2, ignoreStrings: true, ignoreComments: true }],
|
'@stylistic/max-len': [
|
||||||
|
'error',
|
||||||
|
{ code: 100, tabWidth: 2, ignoreStrings: true, ignoreComments: true, ignoreTemplateLiterals: true }
|
||||||
|
],
|
||||||
'@stylistic/no-tabs': 'error',
|
'@stylistic/no-tabs': 'error',
|
||||||
'@stylistic/quotes': ['error', 'single'],
|
'@stylistic/quotes': ['error', 'single'],
|
||||||
'@stylistic/quote-props': ['error', 'as-needed'],
|
'@stylistic/quote-props': ['error', 'as-needed'],
|
||||||
@ -40,7 +43,7 @@ export default tseslint.config({
|
|||||||
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
|
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
|
||||||
|
|
||||||
'@typescript-eslint/ban-ts-comment': ["error", { 'ts-expect-error': 'allow-with-description' }],
|
'@typescript-eslint/ban-ts-comment': ["error", { 'ts-expect-error': 'allow-with-description' }],
|
||||||
'@typescript-eslint/no-explicit-any': 'warn',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
|
||||||
'react/jsx-no-undef': 'error',
|
'react/jsx-no-undef': 'error',
|
||||||
'react/jsx-uses-vars': 'error',
|
'react/jsx-uses-vars': 'error',
|
||||||
|
|||||||
@ -75,7 +75,10 @@ export class ComponentActions {
|
|||||||
});
|
});
|
||||||
rglNode?.setPropValue('layout', layout);
|
rglNode?.setPropValue('layout', layout);
|
||||||
// 如果是磁贴块复制,则需要滚动到影响位置
|
// 如果是磁贴块复制,则需要滚动到影响位置
|
||||||
setTimeout(() => newNode?.document?.project?.simulatorHost?.scrollToNode(newNode), 10);
|
setTimeout(
|
||||||
|
() => newNode?.document?.project?.simulatorHost?.scrollToNode(newNode),
|
||||||
|
10
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,12 +91,10 @@ export class ComponentActions {
|
|||||||
content: {
|
content: {
|
||||||
icon: IconLock, // 锁定 icon
|
icon: IconLock, // 锁定 icon
|
||||||
title: intlNode('lock'),
|
title: intlNode('lock'),
|
||||||
/* istanbul ignore next */
|
|
||||||
action(node: IPublicModelNode) {
|
action(node: IPublicModelNode) {
|
||||||
node.lock();
|
node.lock();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/* istanbul ignore next */
|
|
||||||
condition: (node: IPublicModelNode) => {
|
condition: (node: IPublicModelNode) => {
|
||||||
return engineConfig.get('enableCanvasLock', false) && node.isContainerNode && !node.isLocked;
|
return engineConfig.get('enableCanvasLock', false) && node.isContainerNode && !node.isLocked;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -92,7 +92,8 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
|||||||
registerOptions = options;
|
registerOptions = options;
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
let { pluginName, meta = {} } = pluginModel;
|
let { pluginName } = pluginModel;
|
||||||
|
const { meta = {} } = pluginModel;
|
||||||
const { preferenceDeclaration, engines } = meta;
|
const { preferenceDeclaration, engines } = meta;
|
||||||
// filter invalid eventPrefix
|
// filter invalid eventPrefix
|
||||||
const { eventPrefix } = meta;
|
const { eventPrefix } = meta;
|
||||||
|
|||||||
@ -43,8 +43,8 @@ interface ILowCodePluginRuntimeExportsAccessor {
|
|||||||
[propName: string]: any;
|
[propName: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
export type ILowCodePluginRuntime =
|
||||||
export type ILowCodePluginRuntime = ILowCodePluginRuntimeCore & ILowCodePluginRuntimeExportsAccessor;
|
ILowCodePluginRuntimeCore & ILowCodePluginRuntimeExportsAccessor;
|
||||||
|
|
||||||
export interface ILowCodePluginContextPrivate {
|
export interface ILowCodePluginContextPrivate {
|
||||||
set hotkey(hotkey: IPublicApiHotkey);
|
set hotkey(hotkey: IPublicApiHotkey);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { IPublicApiCommand, IPublicEnumTransitionType, IPublicModelPluginContext, IPublicTypeCommand, IPublicTypeCommandHandlerArgs, IPublicTypeListCommand } from '@alilc/lowcode-types';
|
import { IPublicApiCommand, IPublicEnumTransitionType, IPublicModelPluginContext, IPublicTypeCommand, IPublicTypeCommandHandlerArgs, IPublicTypeListCommand } from '@alilc/lowcode-types';
|
||||||
import { checkPropTypes } from '@alilc/lowcode-utils';
|
import { checkPropTypes } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
export interface ICommand extends Command {}
|
export interface ICommand extends Command {}
|
||||||
|
|
||||||
export interface ICommandOptions {
|
export interface ICommandOptions {
|
||||||
@ -52,7 +53,10 @@ export class Command implements Omit<IPublicApiCommand, 'registerCommand' | 'bat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
batchExecuteCommand(commands: { name: string; args: IPublicTypeCommandHandlerArgs }[], pluginContext: IPublicModelPluginContext): void {
|
batchExecuteCommand(
|
||||||
|
commands: { name: string; args: IPublicTypeCommandHandlerArgs }[],
|
||||||
|
pluginContext: IPublicModelPluginContext
|
||||||
|
): void {
|
||||||
if (!commands || !commands.length) {
|
if (!commands || !commands.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { get as lodashGet } from 'lodash-es';
|
import { get as lodashGet } from 'lodash-es';
|
||||||
import { isPlainObject } from '@alilc/lowcode-utils';
|
import { isPlainObject, getLogger } from '@alilc/lowcode-utils';
|
||||||
import {
|
import {
|
||||||
IPublicTypeEngineOptions,
|
IPublicTypeEngineOptions,
|
||||||
IPublicModelEngineConfig,
|
IPublicModelEngineConfig,
|
||||||
IPublicModelPreference,
|
IPublicModelPreference,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { getLogger } from './utils/logger';
|
|
||||||
import Preference from './utils/preference';
|
import Preference from './utils/preference';
|
||||||
|
|
||||||
const logger = getLogger({ level: 'log', bizName: 'config' });
|
const logger = getLogger({ level: 'log', bizName: 'config' });
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { createContent, isCustomView } from '@alilc/lowcode-utils';
|
|||||||
const settersMap = new Map<string, IPublicTypeRegisteredSetter & {
|
const settersMap = new Map<string, IPublicTypeRegisteredSetter & {
|
||||||
type: string;
|
type: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
export function registerSetter(
|
export function registerSetter(
|
||||||
typeOrMaps: string | { [key: string]: IPublicTypeCustomView | IPublicTypeRegisteredSetter },
|
typeOrMaps: string | { [key: string]: IPublicTypeCustomView | IPublicTypeRegisteredSetter },
|
||||||
setter?: IPublicTypeCustomView | IPublicTypeRegisteredSetter,
|
setter?: IPublicTypeCustomView | IPublicTypeRegisteredSetter,
|
||||||
@ -43,9 +44,7 @@ function getInitialFromSetter(setter: any) {
|
|||||||
) || null; // eslint-disable-line
|
) || null; // eslint-disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISetters extends IPublicApiSetters {
|
export interface ISetters extends IPublicApiSetters {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Setters implements ISetters {
|
export class Setters implements ISetters {
|
||||||
settersMap = new Map<string, IPublicTypeRegisteredSetter & {
|
settersMap = new Map<string, IPublicTypeRegisteredSetter & {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { EventBus, IEventBus } from './event-bus';
|
import { EventBus, IEventBus } from './event-bus';
|
||||||
import {
|
import {
|
||||||
@ -10,7 +9,6 @@ import {
|
|||||||
HookConfig,
|
HookConfig,
|
||||||
IPublicTypeComponentDescription,
|
IPublicTypeComponentDescription,
|
||||||
IPublicTypeRemoteComponentDescription,
|
IPublicTypeRemoteComponentDescription,
|
||||||
GlobalEvent,
|
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { engineConfig } from './config';
|
import { engineConfig } from './config';
|
||||||
import { globalLocale } from './intl';
|
import { globalLocale } from './intl';
|
||||||
@ -37,24 +35,6 @@ const AssetsCache: {
|
|||||||
[key: string]: IPublicTypeRemoteComponentDescription;
|
[key: string]: IPublicTypeRemoteComponentDescription;
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
export declare interface Editor extends StrictEventEmitter<EventEmitter, GlobalEvent.EventConfig> {
|
|
||||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
||||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
||||||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
||||||
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
||||||
removeAllListeners(event?: string | symbol): this;
|
|
||||||
setMaxListeners(n: number): this;
|
|
||||||
getMaxListeners(): number;
|
|
||||||
listeners(event: string | symbol): Function[];
|
|
||||||
rawListeners(event: string | symbol): Function[];
|
|
||||||
listenerCount(type: string | symbol): number;
|
|
||||||
// Added in Node 6...
|
|
||||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
||||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
||||||
eventNames(): Array<string | symbol>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IEditor extends IPublicModelEditor {
|
export interface IEditor extends IPublicModelEditor {
|
||||||
config?: EditorConfig;
|
config?: EditorConfig;
|
||||||
|
|
||||||
@ -65,7 +45,6 @@ export interface IEditor extends IPublicModelEditor {
|
|||||||
init(config?: EditorConfig, components?: PluginClassSet): Promise<any>;
|
init(config?: EditorConfig, components?: PluginClassSet): Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-redeclare
|
|
||||||
export class Editor extends EventEmitter implements IEditor {
|
export class Editor extends EventEmitter implements IEditor {
|
||||||
/**
|
/**
|
||||||
* Ioc Container
|
* Ioc Container
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
import store from 'store';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
interface Window {
|
|
||||||
__isDebug?: boolean;
|
|
||||||
__newFunc?: (funcStr: string) => (...args: any[]) => any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据 url 参数设置 debug 选项
|
|
||||||
const debugRegRes = /_?debug=(.*?)(&|$)/.exec(location.search);
|
|
||||||
if (debugRegRes && debugRegRes[1]) {
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
|
||||||
window.__isDebug = true;
|
|
||||||
// @ts-ignore
|
|
||||||
store.storage.write('debug', debugRegRes[1] === 'true' ? '*' : debugRegRes[1]);
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
|
||||||
window.__isDebug = false;
|
|
||||||
store.remove('debug');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重要,用于矫正画布执行 new Function 的 window 对象上下文
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
|
||||||
window.__newFunc = (funContext: string): ((...args: any[]) => any) => {
|
|
||||||
// eslint-disable-next-line no-new-func
|
|
||||||
return new Function(funContext) as (...args: any[]) => any;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 关闭浏览器前提醒,只有产生过交互才会生效
|
|
||||||
window.onbeforeunload = function (e: Event): string {
|
|
||||||
const ev = e || window.event;
|
|
||||||
// 本地调试不生效
|
|
||||||
if (location.href.indexOf('localhost') > 0) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
const msg = '您确定要离开此页面吗?';
|
|
||||||
ev.cancelBubble = true;
|
|
||||||
ev.returnValue = true;
|
|
||||||
if (e.stopPropagation) {
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
};
|
|
||||||
@ -14,11 +14,12 @@ export function assetsTransform(assets: IPublicTypeAssetsJson) {
|
|||||||
acc[key] = cur;
|
acc[key] = cur;
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{} as any,
|
{},
|
||||||
);
|
);
|
||||||
components.forEach(
|
components.forEach(
|
||||||
(componentDesc: IPublicTypeComponentDescription | IPublicTypeRemoteComponentDescription) => {
|
(componentDesc: IPublicTypeComponentDescription | IPublicTypeRemoteComponentDescription) => {
|
||||||
let { devMode, schema, reference } = componentDesc;
|
let { devMode } = componentDesc;
|
||||||
|
const { schema, reference } = componentDesc;
|
||||||
if ((devMode as string) === 'lowcode') {
|
if ((devMode as string) === 'lowcode') {
|
||||||
devMode = 'lowCode';
|
devMode = 'lowCode';
|
||||||
} else if (devMode === 'proCode') {
|
} else if (devMode === 'proCode') {
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
import { Logger, Level } from '@alilc/lowcode-utils';
|
|
||||||
|
|
||||||
export { Logger };
|
|
||||||
|
|
||||||
export function getLogger(config: { level: Level; bizName: string }): Logger {
|
|
||||||
return new Logger(config);
|
|
||||||
}
|
|
||||||
@ -1,10 +1,8 @@
|
|||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { configure } from 'mobx';
|
import { configure } from 'mobx';
|
||||||
import * as mobx from 'mobx';
|
|
||||||
|
|
||||||
configure({ enforceActions: 'never' });
|
configure({ enforceActions: 'never' });
|
||||||
|
|
||||||
// 常用的直接导出,其他的以 mobx 命名空间导出
|
|
||||||
export {
|
export {
|
||||||
observable as obx,
|
observable as obx,
|
||||||
observable,
|
observable,
|
||||||
@ -21,4 +19,4 @@ export {
|
|||||||
} from 'mobx';
|
} from 'mobx';
|
||||||
export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx';
|
export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx';
|
||||||
|
|
||||||
export { observer, mobx };
|
export { observer };
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import store from 'store';
|
import store from 'store';
|
||||||
import { getLogger } from './logger';
|
import { getLogger } from '@alilc/lowcode-utils';
|
||||||
import { IPublicModelPreference } from '@alilc/lowcode-types';
|
import { IPublicModelPreference } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
const logger = getLogger({ level: 'warn', bizName: 'Preference' });
|
const logger = getLogger({ level: 'warn', bizName: 'Preference' });
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import { SVGIcon, IconProps } from '@alilc/lowcode-utils';
|
import { SVGIcon, type IconProps } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
export function IconExit(props: IconProps) {
|
export function IconExit(props: IconProps) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -32,8 +32,8 @@ export class Workbench extends Component<{
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
skeleton,
|
skeleton,
|
||||||
className,
|
className = 'engine-main',
|
||||||
topAreaItemClassName,
|
topAreaItemClassName = 'engine-actionitem',
|
||||||
} = this.props;
|
} = this.props;
|
||||||
return (
|
return (
|
||||||
<div className={classNames('lc-workbench', className)}>
|
<div className={classNames('lc-workbench', className)}>
|
||||||
|
|||||||
@ -56,28 +56,7 @@ export default function (
|
|||||||
const { props, supports = {} } = configure as any;
|
const { props, supports = {} } = configure as any;
|
||||||
const isRoot: boolean = componentName === 'Page' || componentName === 'Component';
|
const isRoot: boolean = componentName === 'Page' || componentName === 'Component';
|
||||||
const eventsDefinition: any[] = [];
|
const eventsDefinition: any[] = [];
|
||||||
const supportedLifecycles =
|
const supportedLifecycles = supports.lifecycles;
|
||||||
supports.lifecycles ||
|
|
||||||
(isRoot
|
|
||||||
? /* [
|
|
||||||
{
|
|
||||||
description: '初始化时',
|
|
||||||
name: 'constructor',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: '装载后',
|
|
||||||
name: 'componentDidMount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: '更新时',
|
|
||||||
name: 'componentDidUpdate',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: '卸载时',
|
|
||||||
name: 'componentWillUnmount',
|
|
||||||
},
|
|
||||||
] */ null
|
|
||||||
: null);
|
|
||||||
if (supportedLifecycles) {
|
if (supportedLifecycles) {
|
||||||
eventsDefinition.push({
|
eventsDefinition.push({
|
||||||
type: 'lifeCycleEvent',
|
type: 'lifeCycleEvent',
|
||||||
@ -117,43 +96,13 @@ export default function (
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// propsGroup.push({
|
|
||||||
// name: '#generals',
|
|
||||||
// title: { type: 'i18n', 'zh-CN': '通用', 'en-US': 'General' },
|
|
||||||
// items: [
|
|
||||||
// {
|
|
||||||
// name: 'id',
|
|
||||||
// title: 'ID',
|
|
||||||
// setter: 'StringSetter',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: 'key',
|
|
||||||
// title: 'Key',
|
|
||||||
// // todo: use Mixin
|
|
||||||
// setter: 'StringSetter',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: 'ref',
|
|
||||||
// title: 'Ref',
|
|
||||||
// setter: 'StringSetter',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '!more',
|
|
||||||
// title: '更多',
|
|
||||||
// setter: 'PropertiesSetter',
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// });
|
|
||||||
const stylesGroup: IPublicTypeFieldConfig[] = [];
|
const stylesGroup: IPublicTypeFieldConfig[] = [];
|
||||||
const advancedGroup: IPublicTypeFieldConfig[] = [];
|
const advancedGroup: IPublicTypeFieldConfig[] = [];
|
||||||
if (propsGroup) {
|
if (propsGroup) {
|
||||||
let l = propsGroup.length;
|
let l = propsGroup.length;
|
||||||
while (l-- > 0) {
|
while (l-- > 0) {
|
||||||
const item = propsGroup[l];
|
const item = propsGroup[l];
|
||||||
// if (item.type === 'group' && (item.title === '高级' || item.title?.label === '高级')) {
|
|
||||||
// advancedGroup = item.items || [];
|
|
||||||
// propsGroup.splice(l, 1);
|
|
||||||
// }
|
|
||||||
if (
|
if (
|
||||||
item.name === '__style__' ||
|
item.name === '__style__' ||
|
||||||
item.name === 'style' ||
|
item.name === 'style' ||
|
||||||
|
|||||||
@ -70,9 +70,9 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType
|
|||||||
value,
|
value,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const componentName = dataSource.length >= 4 ? 'SelectSetter' : 'RadioGroupSetter';
|
|
||||||
return {
|
return {
|
||||||
componentName,
|
componentName: dataSource.length >= 4 ? 'SelectSetter' : 'RadioGroupSetter',
|
||||||
props: { dataSource, options: dataSource },
|
props: { dataSource, options: dataSource },
|
||||||
isRequired,
|
isRequired,
|
||||||
initialValue: dataSource[0] ? dataSource[0].value : null,
|
initialValue: dataSource[0] ? dataSource[0].value : null,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { createElement } from 'react';
|
import { createElement } from 'react';
|
||||||
import { createRoot, type Root } from 'react-dom/client';
|
import { createRoot, type Root } from 'react-dom/client';
|
||||||
import { isPlainObject } from '@alilc/lowcode-utils';
|
|
||||||
import {
|
import {
|
||||||
globalContext,
|
globalContext,
|
||||||
Editor,
|
Editor,
|
||||||
@ -29,7 +28,7 @@ import {
|
|||||||
PluginPreference,
|
PluginPreference,
|
||||||
IDesigner,
|
IDesigner,
|
||||||
} from '@alilc/lowcode-designer';
|
} from '@alilc/lowcode-designer';
|
||||||
import { Skeleton as InnerSkeleton, registerDefaults } from '@alilc/lowcode-editor-skeleton';
|
import { Skeleton as InnerSkeleton, registerDefaults, Workbench } from '@alilc/lowcode-editor-skeleton';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Workspace as InnerWorkspace,
|
Workspace as InnerWorkspace,
|
||||||
@ -146,7 +145,7 @@ editor.set('innerHotkey', innerHotkey);
|
|||||||
const config = new Config(engineConfig);
|
const config = new Config(engineConfig);
|
||||||
const event = new Event(commonEvent, { prefix: 'common' });
|
const event = new Event(commonEvent, { prefix: 'common' });
|
||||||
const logger = new Logger({ level: 'warn', bizName: 'common' });
|
const logger = new Logger({ level: 'warn', bizName: 'common' });
|
||||||
const common = new Common(editor, innerSkeleton);
|
const common = new Common();
|
||||||
const canvas = new Canvas(editor);
|
const canvas = new Canvas(editor);
|
||||||
|
|
||||||
const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
||||||
@ -160,9 +159,10 @@ const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
|||||||
context.skeleton = new Skeleton(innerSkeleton, pluginName, false);
|
context.skeleton = new Skeleton(innerSkeleton, pluginName, false);
|
||||||
context.setters = setters;
|
context.setters = setters;
|
||||||
context.material = material;
|
context.material = material;
|
||||||
|
|
||||||
const eventPrefix = meta?.eventPrefix || 'common';
|
const eventPrefix = meta?.eventPrefix || 'common';
|
||||||
const commandScope = meta?.commandScope;
|
|
||||||
context.event = new Event(commonEvent, { prefix: eventPrefix });
|
context.event = new Event(commonEvent, { prefix: eventPrefix });
|
||||||
|
|
||||||
context.config = config;
|
context.config = config;
|
||||||
context.common = common;
|
context.common = common;
|
||||||
context.canvas = canvas;
|
context.canvas = canvas;
|
||||||
@ -170,10 +170,13 @@ const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
|||||||
context.logger = new Logger({ level: 'warn', bizName: `plugin:${pluginName}` });
|
context.logger = new Logger({ level: 'warn', bizName: `plugin:${pluginName}` });
|
||||||
context.workspace = workspace;
|
context.workspace = workspace;
|
||||||
context.commonUI = commonUI;
|
context.commonUI = commonUI;
|
||||||
|
|
||||||
|
const commandScope = meta?.commandScope;
|
||||||
context.command = new Command(
|
context.command = new Command(
|
||||||
innerCommand, context as IPublicModelPluginContext, {
|
innerCommand, context as IPublicModelPluginContext, {
|
||||||
commandScope,
|
commandScope,
|
||||||
});
|
});
|
||||||
|
|
||||||
context.registerLevel = IPublicEnumPluginRegisterLevel.Default;
|
context.registerLevel = IPublicEnumPluginRegisterLevel.Default;
|
||||||
context.isPluginRegisteredInWorkspace = false;
|
context.isPluginRegisteredInWorkspace = false;
|
||||||
editor.set('pluginContext', context);
|
editor.set('pluginContext', context);
|
||||||
@ -216,7 +219,6 @@ export {
|
|||||||
command,
|
command,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// declare this is open-source version
|
// declare this is open-source version
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -235,77 +237,47 @@ export const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
|||||||
classes,
|
classes,
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluginPromise = registryInnerPlugin(designer, editor, plugins);
|
// react root
|
||||||
|
|
||||||
let root: Root | undefined;
|
let root: Root | undefined;
|
||||||
|
|
||||||
export async function init(
|
export async function init(
|
||||||
container?: HTMLElement,
|
container: HTMLElement,
|
||||||
options?: IPublicTypeEngineOptions,
|
options: IPublicTypeEngineOptions = {},
|
||||||
pluginPreference?: PluginPreference
|
pluginPreference?: PluginPreference
|
||||||
) {
|
) {
|
||||||
await destroy();
|
await destroy();
|
||||||
|
|
||||||
// container which will host LowCodeEngine DOM
|
engineConfig.setEngineOptions(options);
|
||||||
let engineContainer: HTMLElement;
|
|
||||||
let engineOptions = null;
|
|
||||||
|
|
||||||
if (isPlainObject(container)) {
|
|
||||||
engineOptions = container;
|
|
||||||
engineContainer = document.createElement('div');
|
|
||||||
engineContainer.id = 'engine';
|
|
||||||
document.body.appendChild(engineContainer);
|
|
||||||
} else {
|
|
||||||
engineOptions = options;
|
|
||||||
engineContainer = container!;
|
|
||||||
if (!container) {
|
|
||||||
engineContainer = document.createElement('div');
|
|
||||||
engineContainer.id = 'engine';
|
|
||||||
document.body.appendChild(engineContainer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
engineConfig.setEngineOptions(engineOptions as any);
|
|
||||||
|
|
||||||
const { Workbench } = common.skeletonCabin;
|
|
||||||
if (options && options.enableWorkspaceMode) {
|
|
||||||
const disposeFun = await pluginPromise;
|
|
||||||
disposeFun && disposeFun();
|
|
||||||
|
|
||||||
if (!root) {
|
|
||||||
root = createRoot(engineContainer);
|
|
||||||
root.render(
|
|
||||||
createElement(WorkSpaceWorkbench, {
|
|
||||||
workspace: innerWorkspace,
|
|
||||||
// skeleton: workspace.skeleton,
|
|
||||||
className: 'engine-main',
|
|
||||||
topAreaItemClassName: 'engine-actionitem',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (engineConfig.get('enableWorkspaceMode')) {
|
||||||
innerWorkspace.enableAutoOpenFirstWindow = engineConfig.get('enableAutoOpenFirstWindow', true);
|
innerWorkspace.enableAutoOpenFirstWindow = engineConfig.get('enableAutoOpenFirstWindow', true);
|
||||||
innerWorkspace.setActive(true);
|
innerWorkspace.setActive(true);
|
||||||
innerWorkspace.initWindow();
|
innerWorkspace.initWindow();
|
||||||
innerHotkey.activate(false);
|
innerHotkey.activate(false);
|
||||||
await innerWorkspace.plugins.init(pluginPreference);
|
await innerWorkspace.plugins.init(pluginPreference);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await pluginPromise;
|
|
||||||
await plugins.init(pluginPreference as any);
|
|
||||||
|
|
||||||
if (!root) {
|
if (!root) {
|
||||||
root = createRoot(engineContainer);
|
root = createRoot(container);
|
||||||
|
root.render(
|
||||||
|
createElement(WorkSpaceWorkbench, {
|
||||||
|
workspace: innerWorkspace,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await registryInnerPlugin(designer, editor, plugins);
|
||||||
|
await plugins.init(pluginPreference);
|
||||||
|
|
||||||
|
if (!root) {
|
||||||
|
root = createRoot(container);
|
||||||
root.render(
|
root.render(
|
||||||
createElement(Workbench, {
|
createElement(Workbench, {
|
||||||
skeleton: innerSkeleton,
|
skeleton: innerSkeleton,
|
||||||
className: 'engine-main',
|
|
||||||
topAreaItemClassName: 'engine-actionitem',
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function destroy() {
|
export async function destroy() {
|
||||||
// remove all documents
|
// remove all documents
|
||||||
@ -320,5 +292,5 @@ export async function destroy() {
|
|||||||
|
|
||||||
// unmount DOM container, this will trigger React componentWillUnmount lifeCycle,
|
// unmount DOM container, this will trigger React componentWillUnmount lifeCycle,
|
||||||
// so necessary cleanups will be done.
|
// so necessary cleanups will be done.
|
||||||
root && root.unmount();
|
root?.unmount();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,220 +1,41 @@
|
|||||||
import { editorSymbol, skeletonSymbol, designerCabinSymbol, designerSymbol, settingFieldSymbol, editorCabinSymbol, skeletonCabinSymbol } from '../symbols';
|
|
||||||
import {
|
import {
|
||||||
isFormEvent as innerIsFormEvent,
|
isFormEvent as innerIsFormEvent,
|
||||||
compatibleLegaoSchema as innerCompatibleLegaoSchema,
|
|
||||||
getNodeSchemaById as innerGetNodeSchemaById,
|
getNodeSchemaById as innerGetNodeSchemaById,
|
||||||
transactionManager,
|
transactionManager,
|
||||||
isNodeSchema as innerIsNodeSchema,
|
isNodeSchema as innerIsNodeSchema,
|
||||||
isDragNodeDataObject as innerIsDragNodeDataObject,
|
|
||||||
isDragNodeObject as innerIsDragNodeObject,
|
|
||||||
isDragAnyObject as innerIsDragAnyObject,
|
|
||||||
isLocationChildrenDetail as innerIsLocationChildrenDetail,
|
|
||||||
isNode as innerIsNode,
|
|
||||||
isSettingField,
|
|
||||||
isSettingField as innerIsSettingField,
|
|
||||||
} from '@alilc/lowcode-utils';
|
} from '@alilc/lowcode-utils';
|
||||||
import {
|
import {
|
||||||
IPublicTypeNodeSchema,
|
IPublicTypeNodeSchema,
|
||||||
IPublicEnumTransitionType,
|
IPublicEnumTransitionType,
|
||||||
IPublicEnumTransformStage as InnerTransitionStage,
|
|
||||||
IPublicApiCommonDesignerCabin,
|
|
||||||
IPublicApiCommonSkeletonCabin,
|
|
||||||
IPublicApiCommonUtils,
|
IPublicApiCommonUtils,
|
||||||
IPublicApiCommon,
|
|
||||||
IPublicEnumDragObjectType as InnerDragObjectType,
|
|
||||||
IPublicTypeLocationDetailType as InnerLocationDetailType,
|
|
||||||
IPublicApiCommonEditorCabin,
|
|
||||||
IPublicModelDragon,
|
|
||||||
IPublicModelSettingField,
|
|
||||||
IPublicTypeI18nData,
|
IPublicTypeI18nData,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import {
|
import {
|
||||||
SettingField as InnerSettingField,
|
|
||||||
LiveEditing as InnerLiveEditing,
|
|
||||||
isShaken as innerIsShaken,
|
|
||||||
contains as innerContains,
|
|
||||||
ScrollTarget as InnerScrollTarget,
|
|
||||||
getConvertedExtraKey as innerGetConvertedExtraKey,
|
getConvertedExtraKey as innerGetConvertedExtraKey,
|
||||||
getOriginalExtraKey as innerGetOriginalExtraKey,
|
getOriginalExtraKey as innerGetOriginalExtraKey,
|
||||||
IDesigner,
|
|
||||||
DropLocation as InnerDropLocation,
|
|
||||||
Designer as InnerDesigner,
|
|
||||||
Node as InnerNode,
|
|
||||||
LowCodePluginManager as InnerLowCodePluginManager,
|
|
||||||
DesignerView as InnerDesignerView,
|
|
||||||
} from '@alilc/lowcode-designer';
|
} from '@alilc/lowcode-designer';
|
||||||
import {
|
import {
|
||||||
Skeleton as InnerSkeleton,
|
|
||||||
createSettingFieldView as innerCreateSettingFieldView,
|
|
||||||
PopupContext as InnerPopupContext,
|
|
||||||
PopupPipe as InnerPopupPipe,
|
|
||||||
Workbench as InnerWorkbench,
|
|
||||||
SettingsPrimaryPane as InnerSettingsPrimaryPane,
|
|
||||||
registerDefaults as InnerRegisterDefaults,
|
|
||||||
} from '@alilc/lowcode-editor-skeleton';
|
|
||||||
import {
|
|
||||||
Editor,
|
|
||||||
Title as InnerTitle,
|
|
||||||
Tip as InnerTip,
|
|
||||||
shallowIntl as innerShallowIntl,
|
|
||||||
createIntl as innerCreateIntl,
|
createIntl as innerCreateIntl,
|
||||||
intl as innerIntl,
|
intl as innerIntl,
|
||||||
globalLocale as innerGlobalLocale,
|
|
||||||
obx as innerObx,
|
|
||||||
observable as innerObservable,
|
|
||||||
makeObservable as innerMakeObservable,
|
|
||||||
untracked as innerUntracked,
|
|
||||||
computed as innerComputed,
|
|
||||||
observer as innerObserver,
|
|
||||||
action as innerAction,
|
|
||||||
runInAction as innerRunInAction,
|
|
||||||
engineConfig as innerEngineConfig,
|
|
||||||
globalContext,
|
|
||||||
} from '@alilc/lowcode-editor-core';
|
} from '@alilc/lowcode-editor-core';
|
||||||
import { Dragon as ShellDragon } from '../model';
|
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
class DesignerCabin implements IPublicApiCommonDesignerCabin {
|
export interface IPublicApiCommon {
|
||||||
private readonly [editorSymbol]: Editor;
|
get utils(): IPublicApiCommonUtils;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
readonly [designerCabinSymbol]: any;
|
|
||||||
|
|
||||||
private get [designerSymbol](): IDesigner {
|
|
||||||
return this[editorSymbol].get('designer') as IDesigner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(editor: Editor) {
|
export class Common implements IPublicApiCommon {
|
||||||
this[editorSymbol] = editor;
|
private readonly __utils: Utils;
|
||||||
this[designerCabinSymbol] = {
|
|
||||||
isDragNodeObject: innerIsDragNodeObject,
|
constructor() {
|
||||||
isDragAnyObject: innerIsDragAnyObject,
|
this.__utils = new Utils();
|
||||||
isShaken: innerIsShaken,
|
|
||||||
contains: innerContains,
|
|
||||||
LocationDetailType: InnerLocationDetailType,
|
|
||||||
isLocationChildrenDetail: innerIsLocationChildrenDetail,
|
|
||||||
ScrollTarget: InnerScrollTarget,
|
|
||||||
isSettingField: innerIsSettingField,
|
|
||||||
TransformStage: InnerTransitionStage,
|
|
||||||
SettingField: InnerSettingField,
|
|
||||||
LiveEditing: InnerLiveEditing,
|
|
||||||
DragObjectType: InnerDragObjectType,
|
|
||||||
isDragNodeDataObject: innerIsDragNodeDataObject,
|
|
||||||
isNode: innerIsNode,
|
|
||||||
DropLocation: InnerDropLocation,
|
|
||||||
Designer: InnerDesigner,
|
|
||||||
Node: InnerNode,
|
|
||||||
LowCodePluginManager: InnerLowCodePluginManager,
|
|
||||||
DesignerView: InnerDesignerView,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
get utils(): Utils {
|
||||||
* 是否是 SettingField 实例
|
return this.__utils;
|
||||||
* @deprecated use same function from @alilc/lowcode-utils directly
|
|
||||||
*/
|
|
||||||
isSettingField(obj: any): boolean {
|
|
||||||
return isSettingField(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换类型枚举对象,包含 init / upgrade / render 等类型
|
|
||||||
* [参考](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/transform-stage.ts)
|
|
||||||
* @deprecated use { TransformStage } from '@alilc/lowcode-types' instead
|
|
||||||
*/
|
|
||||||
get TransformStage() {
|
|
||||||
return InnerTransitionStage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get SettingField() {
|
|
||||||
return InnerSettingField;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get LiveEditing() {
|
|
||||||
return InnerLiveEditing;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get DragObjectType() {
|
|
||||||
return InnerDragObjectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
isDragNodeDataObject(obj: any): boolean {
|
|
||||||
return innerIsDragNodeDataObject(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
isNode(node: any): boolean {
|
|
||||||
return innerIsNode(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use canvas.dragon
|
|
||||||
*/
|
|
||||||
get dragon(): IPublicModelDragon | null {
|
|
||||||
return ShellDragon.create(this[designerSymbol].dragon, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SkeletonCabin implements IPublicApiCommonSkeletonCabin {
|
|
||||||
private readonly [skeletonSymbol]: InnerSkeleton;
|
|
||||||
|
|
||||||
readonly [skeletonCabinSymbol]: any;
|
|
||||||
|
|
||||||
constructor(skeleton: InnerSkeleton) {
|
|
||||||
this[skeletonSymbol] = skeleton;
|
|
||||||
this[skeletonCabinSymbol] = {
|
|
||||||
Workbench: InnerWorkbench,
|
|
||||||
createSettingFieldView: this.createSettingFieldView,
|
|
||||||
PopupContext: InnerPopupContext,
|
|
||||||
PopupPipe: InnerPopupPipe,
|
|
||||||
SettingsPrimaryPane: InnerSettingsPrimaryPane,
|
|
||||||
registerDefaults: InnerRegisterDefaults,
|
|
||||||
Skeleton: InnerSkeleton,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
get Workbench(): any {
|
|
||||||
const innerSkeleton = this[skeletonSymbol];
|
|
||||||
return (props: any) => <InnerWorkbench {...props} skeleton={innerSkeleton} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
createSettingFieldView(field: IPublicModelSettingField, fieldEntry: any) {
|
|
||||||
return innerCreateSettingFieldView((field as any)[settingFieldSymbol] || field, fieldEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get PopupContext(): any {
|
|
||||||
return InnerPopupContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get PopupPipe(): any {
|
|
||||||
return InnerPopupPipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Utils implements IPublicApiCommonUtils {
|
class Utils implements IPublicApiCommonUtils {
|
||||||
isNodeSchema(data: any): data is IPublicTypeNodeSchema {
|
isNodeSchema(data: any): data is IPublicTypeNodeSchema {
|
||||||
@ -225,13 +46,6 @@ class Utils implements IPublicApiCommonUtils {
|
|||||||
return innerIsFormEvent(e);
|
return innerIsFormEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated this is a legacy api, do not use this if not using is already
|
|
||||||
*/
|
|
||||||
compatibleLegaoSchema(props: any): any {
|
|
||||||
return innerCompatibleLegaoSchema(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
getNodeSchemaById(
|
getNodeSchemaById(
|
||||||
schema: IPublicTypeNodeSchema,
|
schema: IPublicTypeNodeSchema,
|
||||||
nodeId: string,
|
nodeId: string,
|
||||||
@ -267,202 +81,3 @@ class Utils implements IPublicApiCommonUtils {
|
|||||||
return innerIntl(data, params);
|
return innerIntl(data, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class EditorCabin implements IPublicApiCommonEditorCabin {
|
|
||||||
private readonly [editorSymbol]: Editor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
readonly [editorCabinSymbol]: any;
|
|
||||||
|
|
||||||
constructor(editor: Editor) {
|
|
||||||
this[editorSymbol] = editor;
|
|
||||||
this[editorCabinSymbol] = {
|
|
||||||
Editor,
|
|
||||||
globalContext,
|
|
||||||
runInAction: innerRunInAction,
|
|
||||||
Title: InnerTitle,
|
|
||||||
Tip: InnerTip,
|
|
||||||
shallowIntl: innerShallowIntl,
|
|
||||||
createIntl: innerCreateIntl,
|
|
||||||
intl: innerIntl,
|
|
||||||
createSetterContent: this.createSetterContent.bind(this),
|
|
||||||
globalLocale: innerGlobalLocale,
|
|
||||||
obx: innerObx,
|
|
||||||
action: innerAction,
|
|
||||||
engineConfig: innerEngineConfig,
|
|
||||||
observable: innerObservable,
|
|
||||||
makeObservable: innerMakeObservable,
|
|
||||||
untracked: innerUntracked,
|
|
||||||
computed: innerComputed,
|
|
||||||
observer: innerObserver,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Title 组件
|
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
|
||||||
*/
|
|
||||||
get Title() {
|
|
||||||
return InnerTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tip 组件
|
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
|
||||||
*/
|
|
||||||
get Tip() {
|
|
||||||
return InnerTip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
shallowIntl(data: any): any {
|
|
||||||
return innerShallowIntl(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use common.utils.createIntl instead
|
|
||||||
*/
|
|
||||||
createIntl(instance: any): any {
|
|
||||||
return innerCreateIntl(instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
intl(data: any, params?: object): any {
|
|
||||||
return innerIntl(data, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
createSetterContent = (setter: any, props: Record<string, any>): ReactNode => {
|
|
||||||
const setters = this[editorSymbol].get('setters');
|
|
||||||
return setters.createSetterContent(setter, props);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use common.utils.createIntl instead
|
|
||||||
*/
|
|
||||||
get globalLocale(): any {
|
|
||||||
return innerGlobalLocale;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get obx() {
|
|
||||||
return innerObx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get action() {
|
|
||||||
return innerAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get engineConfig() {
|
|
||||||
return innerEngineConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get runInAction() {
|
|
||||||
return innerRunInAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get observable() {
|
|
||||||
return innerObservable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
makeObservable(target: any, annotations: any, options: any) {
|
|
||||||
return innerMakeObservable(target, annotations, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
untracked(action: any) {
|
|
||||||
return innerUntracked(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get computed() {
|
|
||||||
return innerComputed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
observer(component: any) {
|
|
||||||
return innerObserver(component);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Common implements IPublicApiCommon {
|
|
||||||
private readonly __designerCabin: DesignerCabin;
|
|
||||||
private readonly __skeletonCabin: SkeletonCabin;
|
|
||||||
private readonly __editorCabin: EditorCabin;
|
|
||||||
private readonly __utils: Utils;
|
|
||||||
|
|
||||||
constructor(editor: Editor, skeleton: InnerSkeleton) {
|
|
||||||
this.__designerCabin = new DesignerCabin(editor);
|
|
||||||
this.__skeletonCabin = new SkeletonCabin(skeleton);
|
|
||||||
this.__editorCabin = new EditorCabin(editor);
|
|
||||||
this.__utils = new Utils();
|
|
||||||
}
|
|
||||||
|
|
||||||
get utils(): any {
|
|
||||||
return this.__utils;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 历史原因导致此处设计不合理,慎用。
|
|
||||||
* this load of crap will be removed in some future versions, don`t use it.
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get editorCabin(): EditorCabin {
|
|
||||||
return this.__editorCabin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 历史原因导致此处设计不合理,慎用。
|
|
||||||
* this load of crap will be removed in some future versions, don`t use it.
|
|
||||||
* @deprecated use canvas api instead
|
|
||||||
*/
|
|
||||||
get designerCabin(): DesignerCabin {
|
|
||||||
return this.__designerCabin;
|
|
||||||
}
|
|
||||||
|
|
||||||
get skeletonCabin(): SkeletonCabin {
|
|
||||||
return this.__skeletonCabin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 历史原因导致此处设计不合理,慎用。
|
|
||||||
* this load of crap will be removed in some future versions, don`t use it.
|
|
||||||
* @deprecated use { TransformStage } from '@alilc/lowcode-types' instead
|
|
||||||
*/
|
|
||||||
get objects() {
|
|
||||||
return {
|
|
||||||
TransformStage: InnerTransitionStage,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ export class Workbench extends Component<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { workspace, className, topAreaItemClassName } = this.props;
|
const { workspace, className = 'engine-main', topAreaItemClassName = 'engine-actionitem' } = this.props;
|
||||||
const { skeleton } = workspace;
|
const { skeleton } = workspace;
|
||||||
const { workspaceEmptyComponent: WorkspaceEmptyComponent, theme } = this.state;
|
const { workspaceEmptyComponent: WorkspaceEmptyComponent, theme } = this.state;
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,11 @@ export class Workspace implements Omit<IPublicApiWorkspace<
|
|||||||
} | IResource)[] = [];
|
} | IResource)[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly registryInnerPlugin: (designer: IDesigner, editor: IEditor, plugins: IPublicApiPlugins) => Promise<IPublicTypeDisposable>,
|
readonly registryInnerPlugin: (
|
||||||
|
designer: IDesigner,
|
||||||
|
editor: IEditor,
|
||||||
|
plugins: IPublicApiPlugins
|
||||||
|
) => Promise<IPublicTypeDisposable>,
|
||||||
readonly shellModelFactory: any,
|
readonly shellModelFactory: any,
|
||||||
) {
|
) {
|
||||||
this.context = new BasicContext(this, '', IPublicEnumPluginRegisterLevel.Workspace);
|
this.context = new BasicContext(this, '', IPublicEnumPluginRegisterLevel.Workspace);
|
||||||
|
|||||||
@ -126,7 +126,6 @@ class TreeNodeChildren extends PureComponent<{
|
|||||||
children.push(
|
children.push(
|
||||||
<div key={currentGrp.id} className="condition-group-container" data-id={currentGrp.firstNode?.id}>
|
<div key={currentGrp.id} className="condition-group-container" data-id={currentGrp.firstNode?.id}>
|
||||||
<div className="condition-group-title">
|
<div className="condition-group-title">
|
||||||
{/* @ts-ignore */}
|
|
||||||
<Title
|
<Title
|
||||||
title={currentGrp.title}
|
title={currentGrp.title}
|
||||||
match={filterWorking && matchSelf}
|
match={filterWorking && matchSelf}
|
||||||
@ -204,7 +203,6 @@ class TreeNodeSlots extends PureComponent<{
|
|||||||
data-id={treeNode.nodeId}
|
data-id={treeNode.nodeId}
|
||||||
>
|
>
|
||||||
<div className="tree-node-slots-title">
|
<div className="tree-node-slots-title">
|
||||||
{/* @ts-ignore */}
|
|
||||||
<Title title={{ type: 'i18n', intl: this.props.treeNode.pluginContext.intlNode('Slots') }} />
|
<Title title={{ type: 'i18n', intl: this.props.treeNode.pluginContext.intlNode('Slots') }} />
|
||||||
</div>
|
</div>
|
||||||
{treeNode.slots.map(tnode => (
|
{treeNode.slots.map(tnode => (
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { IPublicTypeI18nData, IPublicTypeNodeSchema, IPublicTypeTitleContent } f
|
|||||||
import { IPublicEnumTransitionType } from '../enum';
|
import { IPublicEnumTransitionType } from '../enum';
|
||||||
|
|
||||||
export interface IPublicApiCommonUtils {
|
export interface IPublicApiCommonUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为合法的 schema 结构
|
* 是否为合法的 schema 结构
|
||||||
* check if data is valid NodeSchema
|
* check if data is valid NodeSchema
|
||||||
@ -90,7 +89,7 @@ export interface IPublicApiCommonEditorCabin {
|
|||||||
* Title 组件
|
* Title 组件
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
* @experimental unstable API, pay extra caution when trying to use this
|
||||||
*/
|
*/
|
||||||
get Tip(): React.ComponentClass<{}>;
|
get Tip(): React.ComponentClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tip 组件
|
* Tip 组件
|
||||||
@ -102,23 +101,3 @@ export interface IPublicApiCommonEditorCabin {
|
|||||||
keywords?: string | null;
|
keywords?: string | null;
|
||||||
}>;
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPublicApiCommonDesignerCabin {
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IPublicApiCommon {
|
|
||||||
|
|
||||||
get utils(): IPublicApiCommonUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get designerCabin(): IPublicApiCommonDesignerCabin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
|
||||||
*/
|
|
||||||
get editorCabin(): IPublicApiCommonEditorCabin;
|
|
||||||
|
|
||||||
get skeletonCabin(): IPublicApiCommonSkeletonCabin;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import { ReactNode } from 'react';
|
|||||||
import { IPublicTypeRegisteredSetter, IPublicTypeCustomView } from '../type';
|
import { IPublicTypeRegisteredSetter, IPublicTypeCustomView } from '../type';
|
||||||
|
|
||||||
export interface IPublicApiSetters {
|
export interface IPublicApiSetters {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定 setter
|
* 获取指定 setter
|
||||||
* get setter by type
|
* get setter by type
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { IPublicTypePluginConfig } from './';
|
import { IPublicTypePluginConfig } from './';
|
||||||
import { IPublicModelPluginContext } from '../model';
|
import { IPublicModelPluginContext } from '../model';
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
export type IPublicTypePluginCreater = (
|
||||||
export type IPublicTypePluginCreater = (ctx: IPublicModelPluginContext, options: any) => IPublicTypePluginConfig;
|
ctx: IPublicModelPluginContext, options: any
|
||||||
|
) => IPublicTypePluginConfig;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable max-len */
|
|
||||||
import { IPublicTypePluginMeta, IPublicTypePluginCreater } from './';
|
import { IPublicTypePluginMeta, IPublicTypePluginCreater } from './';
|
||||||
|
|
||||||
export interface IPublicTypePlugin extends IPublicTypePluginCreater {
|
export interface IPublicTypePlugin extends IPublicTypePluginCreater {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import React, { ReactNode } from 'react';
|
import React, { ReactNode } from 'react';
|
||||||
|
|
||||||
const SizePresets: any = {
|
const SizePresets = {
|
||||||
xsmall: 8,
|
xsmall: 8,
|
||||||
small: 12,
|
small: 12,
|
||||||
medium: 16,
|
medium: 16,
|
||||||
@ -26,8 +26,7 @@ export function SVGIcon({
|
|||||||
}: IconProps & {
|
}: IconProps & {
|
||||||
viewBox: string;
|
viewBox: string;
|
||||||
}) {
|
}) {
|
||||||
// eslint-disable-next-line no-prototype-builtins
|
if (typeof size === 'string' && size in SizePresets) {
|
||||||
if (SizePresets.hasOwnProperty(size)) {
|
|
||||||
size = SizePresets[size];
|
size = SizePresets[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
import { request } from 'node:http';
|
import { request } from 'node:http';
|
||||||
import packageJson from '../packages/engine/package.json';
|
import packageJson from '../packages/engine/package.json';
|
||||||
import console from 'node:console';
|
import console from 'node:console';
|
||||||
import { Buffer } from 'node:buffer'
|
import { Buffer } from 'node:buffer';
|
||||||
|
|
||||||
const { version, name } = packageJson;
|
const { version, name } = packageJson;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user