/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ import { type FlowSurfaceCompiledComposePlan, type FlowSurfaceComposeNormalizedActionSpec, type FlowSurfaceComposeNormalizedBlockSpec, type FlowSurfaceComposeNormalizedFieldSpec, type FlowSurfaceComposeObject, type FlowSurfaceComposeTargetKey } from './compose-compiler'; export type FlowSurfaceComposeBlockResult = { uid: string; gridUid?: string; itemUid?: string; itemGridUid?: string; actionsColumnUid?: string; }; export type FlowSurfaceComposeFieldResult = { uid?: string; wrapperUid?: string; fieldUid?: string; innerFieldUid?: string; popupPageUid?: string; popupTabUid?: string; popupGridUid?: string; }; export type FlowSurfaceComposeActionResult = { uid: string; parentUid?: string; scope?: string; }; export type FlowSurfaceComposeRuntimeBlockState = { spec: FlowSurfaceComposeNormalizedBlockSpec; result: FlowSurfaceComposeBlockResult; createdFields: Array<{ spec: FlowSurfaceComposeNormalizedFieldSpec; result: FlowSurfaceComposeFieldResult; }>; fieldResults: Array>; actionResults: Array>; recordActionResults: Array>; }; export type FlowSurfaceComposeRuntimeState = { keyMap: Record>; blocks: FlowSurfaceComposeRuntimeBlockState[]; }; export type FlowSurfaceComposeExecutionResult = { target: { uid: string; }; mode: FlowSurfaceCompiledComposePlan['mode']; blocks: Array<{ key: string; type?: string; uid: string; gridUid?: string; itemUid?: string; itemGridUid?: string; actionsColumnUid?: string; fields: Array>; actions: Array>; recordActions: Array>; }>; layout?: unknown; }; export type FlowSurfaceComposeRuntimeDeps = { removeExistingItem?: (uid: string) => Promise; createBlock: (payload: Record, spec: FlowSurfaceComposeNormalizedBlockSpec) => Promise; applyNodeSettings?: (actionName: string, targetUid: string | undefined, settings?: FlowSurfaceComposeObject) => Promise; resolveBlockSettings?: (settings: FlowSurfaceComposeObject, state: FlowSurfaceComposeRuntimeState, block: FlowSurfaceComposeRuntimeBlockState) => FlowSurfaceComposeObject | Promise; resolveActionSettings?: (settings: FlowSurfaceComposeObject, state: FlowSurfaceComposeRuntimeState, block: FlowSurfaceComposeRuntimeBlockState, action: FlowSurfaceComposeNormalizedActionSpec, actionName: string) => FlowSurfaceComposeObject | Promise; createField: (payload: Record, spec: FlowSurfaceComposeNormalizedFieldSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise; applyFieldSettings?: (actionName: string, result: FlowSurfaceComposeFieldResult, settings?: FlowSurfaceComposeObject) => Promise; onFieldError?: (input: { error: unknown; spec: FlowSurfaceComposeNormalizedFieldSpec; blockSpec: FlowSurfaceComposeNormalizedBlockSpec; blockResult: FlowSurfaceComposeBlockResult; }) => Promise<'continue' | void> | 'continue' | void; createAction: (payload: Record, spec: FlowSurfaceComposeNormalizedActionSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise; createRecordAction: (payload: Record, spec: FlowSurfaceComposeNormalizedActionSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise; applyActionPopup?: (actionName: string, actionUid: string, popup?: FlowSurfaceComposeObject) => Promise; collectActionKeys?: (actionUid: string) => Promise>; buildExplicitLayoutPayload?: (input: { layout?: FlowSurfaceComposeObject; createdByKey: Record>; targetUid: string; }) => Promise> | Record; buildAppendLayoutPayload?: (input: { gridUid: string; appendedItemUids: string[]; }) => Promise> | Record; setLayout?: (payload: Record) => Promise; }; export declare function executeComposeRuntime(plan: FlowSurfaceCompiledComposePlan, deps: FlowSurfaceComposeRuntimeDeps): Promise; export declare function createComposeRuntimeState(): FlowSurfaceComposeRuntimeState;