vendor: amis 6.13.0 base (fork root)

This commit is contained in:
2026-06-16 22:14:57 +08:00
commit 8c8e4247a9
3840 changed files with 2467374 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import {RendererEvent} from '../utils/renderer-event';
import {evalExpressionWithConditionBuilderAsync} from '../utils/tpl';
import {
RendererAction,
ListenerContext,
registerAction,
runActions,
ILogicAction
} from './Action';
export interface ISwitchAction extends ILogicAction {
actionType: 'switch';
}
/**
* 排他动作
*/
export class SwitchAction implements RendererAction {
async run(
action: ISwitchAction,
renderer: ListenerContext,
event: RendererEvent<any>,
mergeData: any
) {
for (const branch of action.children || []) {
if (!branch.expression) {
continue;
}
const isPass = await evalExpressionWithConditionBuilderAsync(
branch.expression,
mergeData
);
if (isPass) {
await runActions(branch, renderer, event);
// 去掉runAllMatch,这里只做排他,多个可以直接通过expression
break;
}
}
}
}
registerAction('switch', new SwitchAction());