mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 09:47:20 +00:00
feat: merge from develop
This commit is contained in:
parent
94e8a0e585
commit
5fa7d6298a
@ -125,7 +125,103 @@ export const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
|||||||
symbols,
|
symbols,
|
||||||
classes,
|
classes,
|
||||||
};
|
};
|
||||||
config.set('isOpenSource', isOpenSource);
|
engineConfig.set('isOpenSource', isOpenSource);
|
||||||
|
|
||||||
|
// 注册一批内置插件
|
||||||
|
(async function registerPlugins() {
|
||||||
|
// 处理 editor.set('assets'),将组件元数据创建好
|
||||||
|
const componentMetaParser = (ctx: ILowCodePluginContext) => {
|
||||||
|
return {
|
||||||
|
init() {
|
||||||
|
editor.onGot('assets', (assets: any) => {
|
||||||
|
const { components = [] } = assets;
|
||||||
|
designer.buildComponentMetasMap(components);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
componentMetaParser.pluginName = '___component_meta_parser___';
|
||||||
|
await plugins.register(componentMetaParser);
|
||||||
|
|
||||||
|
// 注册默认的 setters
|
||||||
|
const setterRegistry = (ctx: ILowCodePluginContext) => {
|
||||||
|
return {
|
||||||
|
init() {
|
||||||
|
if (engineConfig.get('disableDefaultSetters')) return;
|
||||||
|
const builtinSetters = require('@alilc/lowcode-engine-ext')?.setters;
|
||||||
|
if (builtinSetters) {
|
||||||
|
ctx.setters.registerSetter(builtinSetters);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
setterRegistry.pluginName = '___setter_registry___';
|
||||||
|
await plugins.register(setterRegistry);
|
||||||
|
|
||||||
|
// 注册默认的面板
|
||||||
|
const defaultPanelRegistry = (ctx: ILowCodePluginContext) => {
|
||||||
|
return {
|
||||||
|
init() {
|
||||||
|
skeleton.add({
|
||||||
|
area: 'mainArea',
|
||||||
|
name: 'designer',
|
||||||
|
type: 'Widget',
|
||||||
|
content: DesignerPlugin,
|
||||||
|
});
|
||||||
|
if (!engineConfig.get('disableDefaultSettingPanel')) {
|
||||||
|
skeleton.add({
|
||||||
|
area: 'rightArea',
|
||||||
|
name: 'settingsPane',
|
||||||
|
type: 'Panel',
|
||||||
|
content: SettingsPrimaryPane,
|
||||||
|
props: {
|
||||||
|
ignoreRoot: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// by default in float area;
|
||||||
|
let isInFloatArea = true;
|
||||||
|
const hasPreferenceForOutline = editor
|
||||||
|
?.getPreference()
|
||||||
|
?.contains('outline-pane-pinned-status-isFloat', 'skeleton');
|
||||||
|
if (hasPreferenceForOutline) {
|
||||||
|
isInFloatArea = editor
|
||||||
|
?.getPreference()
|
||||||
|
?.get('outline-pane-pinned-status-isFloat', 'skeleton');
|
||||||
|
}
|
||||||
|
|
||||||
|
skeleton.add({
|
||||||
|
area: 'leftArea',
|
||||||
|
name: 'outlinePane',
|
||||||
|
type: 'PanelDock',
|
||||||
|
content: Outline,
|
||||||
|
panelProps: {
|
||||||
|
area: isInFloatArea ? 'leftFloatArea' : 'leftFixedArea',
|
||||||
|
keepVisibleWhileDragging: true,
|
||||||
|
...engineConfig.get('defaultOutlinePaneProps'),
|
||||||
|
},
|
||||||
|
contentProps: {
|
||||||
|
treeTitleExtra: engineConfig.get('treeTitleExtra'),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
skeleton.add({
|
||||||
|
area: 'rightArea',
|
||||||
|
name: 'backupOutline',
|
||||||
|
type: 'Panel',
|
||||||
|
props: {
|
||||||
|
condition: () => {
|
||||||
|
return designer.dragon.dragging && !getTreeMaster(designer).hasVisibleTreeBoard();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
content: OutlineBackupPane,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
defaultPanelRegistry.pluginName = '___default_panel___';
|
||||||
|
await plugins.register(defaultPanelRegistry);
|
||||||
|
})();
|
||||||
|
|
||||||
// container which will host LowCodeEngine DOM
|
// container which will host LowCodeEngine DOM
|
||||||
let engineContainer: HTMLElement;
|
let engineContainer: HTMLElement;
|
||||||
|
|||||||
20
packages/plugin-outline-pane/src/helper/tree-title-extra.ts
Normal file
20
packages/plugin-outline-pane/src/helper/tree-title-extra.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { globalContext } from '@alilc/lowcode-editor-core';
|
||||||
|
import { ReactElement } from 'react';
|
||||||
|
|
||||||
|
const TREE_TITLE_EXTRA_KEY = 'TREE_TITLE_EXTRA_KEY';
|
||||||
|
|
||||||
|
export const registerTreeTitleExtra = (extra: ReactElement) => {
|
||||||
|
if (extra && !globalContext.has(TREE_TITLE_EXTRA_KEY)) {
|
||||||
|
globalContext.register(extra, TREE_TITLE_EXTRA_KEY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getTreeTitleExtra = () => {
|
||||||
|
try {
|
||||||
|
return globalContext.get(TREE_TITLE_EXTRA_KEY);
|
||||||
|
} catch (e) {
|
||||||
|
// console.error('getTreeTitleExtra Error', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
@ -6,6 +6,7 @@ import TreeView from './tree';
|
|||||||
import './style.less';
|
import './style.less';
|
||||||
import { IEditor } from '@alilc/lowcode-types';
|
import { IEditor } from '@alilc/lowcode-types';
|
||||||
import Filter from './filter';
|
import Filter from './filter';
|
||||||
|
import { registerTreeTitleExtra } from '../helper/tree-title-extra';
|
||||||
|
|
||||||
interface Props { config: any; editor: IEditor }
|
interface Props { config: any; editor: IEditor }
|
||||||
@observer
|
@observer
|
||||||
@ -21,6 +22,10 @@ export class OutlinePane extends Component<any> {
|
|||||||
this.main.purge();
|
this.main.purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
registerTreeTitleExtra(this.props?.config?.contentProps?.treeTitleExtra);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const tree = this.main.currentTree;
|
const tree = this.main.currentTree;
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { IconLoop } from '../icons/loop';
|
|||||||
import { IconRadioActive } from '../icons/radio-active';
|
import { IconRadioActive } from '../icons/radio-active';
|
||||||
import { IconRadio } from '../icons/radio';
|
import { IconRadio } from '../icons/radio';
|
||||||
import { IconLock, IconUnlock } from '../icons';
|
import { IconLock, IconUnlock } from '../icons';
|
||||||
|
import { getTreeTitleExtra } from '../helper/tree-title-extra';
|
||||||
|
|
||||||
|
|
||||||
function emitOutlineEvent(type: string, treeNode: TreeNode, rest?: Record<string, unknown>) {
|
function emitOutlineEvent(type: string, treeNode: TreeNode, rest?: Record<string, unknown>) {
|
||||||
@ -98,6 +99,7 @@ export default class TreeTitle extends Component<{
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const { filterWorking, matchSelf, keywords } = treeNode.filterReult;
|
const { filterWorking, matchSelf, keywords } = treeNode.filterReult;
|
||||||
|
const Extra = getTreeTitleExtra();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -154,6 +156,7 @@ export default class TreeTitle extends Component<{
|
|||||||
match={filterWorking && matchSelf}
|
match={filterWorking && matchSelf}
|
||||||
keywords={keywords}
|
keywords={keywords}
|
||||||
/>
|
/>
|
||||||
|
{Extra && <Extra node={treeNode?.node} />}
|
||||||
{node.slotFor && (
|
{node.slotFor && (
|
||||||
<a className="tree-node-tag slot">
|
<a className="tree-node-tag slot">
|
||||||
{/* todo: click redirect to prop */}
|
{/* todo: click redirect to prop */}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user