UNPKG

@grafana/ui

Version:
1 lines 2.13 kB
{"version":3,"file":"FieldNameByRegexMatcherEditor.mjs","sources":["../../../../src/components/MatchersUI/FieldNameByRegexMatcherEditor.tsx"],"sourcesContent":["import { memo, useCallback } from 'react';\nimport * as React from 'react';\n\nimport { FieldMatcherID, fieldMatchers } from '@grafana/data';\n\nimport { t } from '../../utils/i18n';\nimport { Input } from '../Input/Input';\n\nimport { MatcherUIProps, FieldMatcherUIRegistryItem } from './types';\n\nexport const FieldNameByRegexMatcherEditor = memo<MatcherUIProps<string>>((props) => {\n const { options, onChange } = props;\n\n const onBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n return onChange(e.target.value);\n },\n [onChange]\n );\n\n return (\n <Input\n placeholder={t('grafana-ui.field-name-by-regex-matcher.input-placeholder', 'Enter regular expression')}\n defaultValue={options}\n onBlur={onBlur}\n />\n );\n});\nFieldNameByRegexMatcherEditor.displayName = 'FieldNameByRegexMatcherEditor';\n\nexport const fieldNameByRegexMatcherItem: FieldMatcherUIRegistryItem<string> = {\n id: FieldMatcherID.byRegexp,\n component: FieldNameByRegexMatcherEditor,\n matcher: fieldMatchers.get(FieldMatcherID.byRegexp),\n name: 'Fields with name matching regex',\n description: 'Set properties for fields with names matching a regex',\n optionsToLabel: (options) => options,\n};\n"],"names":[],"mappings":";;;;;;AAUa,MAAA,6BAAA,GAAgC,IAA6B,CAAA,CAAC,KAAU,KAAA;AACnF,EAAM,MAAA,EAAE,OAAS,EAAA,QAAA,EAAa,GAAA,KAAA;AAE9B,EAAA,MAAM,MAAS,GAAA,WAAA;AAAA,IACb,CAAC,CAA0C,KAAA;AACzC,MAAO,OAAA,QAAA,CAAS,CAAE,CAAA,MAAA,CAAO,KAAK,CAAA;AAAA,KAChC;AAAA,IACA,CAAC,QAAQ;AAAA,GACX;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAa,CAAE,CAAA,0DAAA,EAA4D,0BAA0B,CAAA;AAAA,MACrG,YAAc,EAAA,OAAA;AAAA,MACd;AAAA;AAAA,GACF;AAEJ,CAAC;AACD,6BAAA,CAA8B,WAAc,GAAA,+BAAA;AAErC,MAAM,2BAAkE,GAAA;AAAA,EAC7E,IAAI,cAAe,CAAA,QAAA;AAAA,EACnB,SAAW,EAAA,6BAAA;AAAA,EACX,OAAS,EAAA,aAAA,CAAc,GAAI,CAAA,cAAA,CAAe,QAAQ,CAAA;AAAA,EAClD,IAAM,EAAA,iCAAA;AAAA,EACN,WAAa,EAAA,uDAAA;AAAA,EACb,cAAA,EAAgB,CAAC,OAAY,KAAA;AAC/B;;;;"}