fix: flow engine set context

This commit is contained in:
chenos 2025-06-24 15:13:08 +08:00
parent 10fbb75bd7
commit 5aa628c6a8
3 changed files with 7 additions and 7 deletions

View File

@ -55,7 +55,7 @@ export class FlowEngine {
} }
setContext(context: any) { setContext(context: any) {
this.context = context; this.context = { ...this.context, ...context };
} }
getContext() { getContext() {

View File

@ -13,7 +13,7 @@ import { Card, Skeleton, Spin } from 'antd';
import React, { createRef } from 'react'; import React, { createRef } from 'react';
import { CodeEditor } from './CodeEditor'; import { CodeEditor } from './CodeEditor';
export class LowcodeBlockFlowModel extends BlockModel { export class LowcodeBlockModel extends BlockModel {
ref = createRef<HTMLDivElement>(); ref = createRef<HTMLDivElement>();
declare resource: APIResource; declare resource: APIResource;
@ -41,12 +41,12 @@ export class LowcodeBlockFlowModel extends BlockModel {
// Export CodeEditor for external use // Export CodeEditor for external use
export { CodeEditor }; export { CodeEditor };
LowcodeBlockFlowModel.define({ LowcodeBlockModel.define({
title: 'Lowcode', title: 'Lowcode',
group: 'Content', group: 'Content',
icon: 'CloudOutlined', icon: 'CloudOutlined',
defaultOptions: { defaultOptions: {
use: 'LowcodeBlockFlowModel', use: 'LowcodeBlockModel',
stepParams: { stepParams: {
default: { default: {
executionStep: { executionStep: {
@ -88,7 +88,7 @@ element.innerHTML = \`
}, },
}); });
LowcodeBlockFlowModel.registerFlow({ LowcodeBlockModel.registerFlow({
key: 'default', key: 'default',
auto: true, auto: true,
steps: { steps: {

View File

@ -8,8 +8,8 @@
*/ */
import { Plugin } from '@nocobase/client'; import { Plugin } from '@nocobase/client';
import { LowcodeBlockFlowModel } from './LowcodeBlockFlowModel';
import { CodeEditor } from './CodeEditor'; import { CodeEditor } from './CodeEditor';
import { LowcodeBlockModel } from './LowcodeBlockModel';
export class PluginBlockLowcodeClient extends Plugin { export class PluginBlockLowcodeClient extends Plugin {
async load() { async load() {
@ -19,7 +19,7 @@ export class PluginBlockLowcodeClient extends Plugin {
}); });
// Register the LowcodeBlockFlowModel // Register the LowcodeBlockFlowModel
this.flowEngine.registerModels({ LowcodeBlockFlowModel }); this.flowEngine.registerModels({ LowcodeBlockModel });
// Set up requirejs context for lowcode components // Set up requirejs context for lowcode components
const existingContext = this.flowEngine.getContext() || {}; const existingContext = this.flowEngine.getContext() || {};