create.config.ts 1.03 KB
import { useRuleChainI18n } from '../../../hook/useRuleChainI18n';
import { FormSchema, useComponentRegister } from '/@/components/Form';
import { AttributeConfiguration } from '/@/views/rule/designer/src/components/AttributeConfiguration';

const { tLabel } = useRuleChainI18n('enrichment', 'customerAttributes');

export enum CustomerAttributesFieldsEnum {
  ATTR_MAPING = 'attrMapping',
  TELEMETRY = 'telemetry',
}

useComponentRegister('AttributeConfiguration', AttributeConfiguration);

export const formSchemas: FormSchema[] = [
  {
    field: CustomerAttributesFieldsEnum.TELEMETRY,
    component: 'Checkbox',
    label: '',
    renderComponentContent: () => {
      return {
        default: () => tLabel(CustomerAttributesFieldsEnum.TELEMETRY),
      };
    },
  },
  {
    field: CustomerAttributesFieldsEnum.ATTR_MAPING,
    component: 'AttributeConfiguration',
    label: tLabel(CustomerAttributesFieldsEnum.ATTR_MAPING),
    slot: CustomerAttributesFieldsEnum.ATTR_MAPING,
    valueField: 'value',
    changeEvent: 'update:value',
  },
];