import { $t } from 'platform-core'; import { Processor } from '../Processor'; class SingleRule extends Processor { #editorDialogWidth: number = 800; public getToolbarAction(): any { return { extend: 'add', name: 'singleRule', label: $t('io.sc.engine.rule.core.enums.ProcessorType.SINGLE_RULE'), icon: 'bi-noise-reduction', enableIf: (args: any) => { const type = this.context.target.type; return type !== 'RULE_RESULT' && type !== 'SINGLE_RULE_RESULT'; }, afterClick: (args: any) => { args.grid.getEditorForm().setFieldValue('type', 'SINGLE_RULE'); }, }; } public format(row: any): any { return row.singleRule; } public getEditorFields(): any { return []; } public getViewerFields(): any { return [{ name: 'singleRule', label: $t('re.resources.designer.processor.grid.entity.singleRule') }]; } public beforeEditorDataSubmit(args: any): void {} public afterEditorOpen(args: any): void { args.grid.getEditorDialog().setWidth(this.#editorDialogWidth); } } export { SingleRule };