create.config.ts 827 Bytes
import { ScriptFieldsEnum, ScriptFieldsNameEnum } from '../../../enum/formField/transformation';
import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal';
import { FormSchema, useComponentRegister } from '/@/components/Form';

useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal);

export const formSchemas: FormSchema[] = [
  {
    field: ScriptFieldsEnum.JS_SCRIPT,
    component: 'JavascriptEditorWithTestModal',
    label: ScriptFieldsNameEnum.JS_SCRIPT,
    changeEvent: 'update:value',
    valueField: 'value',
    componentProps: {
      javaScriptEditorProps: {
        functionName: 'Transform',
        paramsName: ['msg', 'metadata', 'msgType'],
        scriptType: 'update',
      },
      buttonName: 'Test transformer function',
    },
  },
];