@grafana/ui
Version:
Grafana Components Library
1 lines • 2.36 kB
Source Map (JSON)
{"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';\nimport { t } from '@grafana/i18n';\n\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 getFieldNameByRegexMatcherItem: () => FieldMatcherUIRegistryItem<string> = () => ({\n id: FieldMatcherID.byRegexp,\n component: FieldNameByRegexMatcherEditor,\n matcher: fieldMatchers.get(FieldMatcherID.byRegexp),\n name: t('grafana-ui.matchers-ui.name-field-name-by-regex-matcher', 'Fields with name matching regex'),\n description: t(\n 'grafana-ui.matchers-ui.description-field-name-by-regex-matcher',\n 'Set properties for fields with names matching a regex'\n ),\n optionsToLabel: (options) => options,\n});\n"],"names":[],"mappings":";;;;;;;AAUO,MAAM,6BAAA,GAAgC,IAAA,CAA6B,CAAC,KAAA,KAAU;AACnF,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,KAAA;AAE9B,EAAA,MAAM,MAAA,GAAS,WAAA;AAAA,IACb,CAAC,CAAA,KAA0C;AACzC,MAAA,OAAO,QAAA,CAAS,CAAA,CAAE,MAAA,CAAO,KAAK,CAAA;AAAA,IAChC,CAAA;AAAA,IACA,CAAC,QAAQ;AAAA,GACX;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAa,CAAA,CAAE,0DAAA,EAA4D,0BAA0B,CAAA;AAAA,MACrG,YAAA,EAAc,OAAA;AAAA,MACd;AAAA;AAAA,GACF;AAEJ,CAAC;AACD,6BAAA,CAA8B,WAAA,GAAc,+BAAA;AAErC,MAAM,iCAA2E,OAAO;AAAA,EAC7F,IAAI,cAAA,CAAe,QAAA;AAAA,EACnB,SAAA,EAAW,6BAAA;AAAA,EACX,OAAA,EAAS,aAAA,CAAc,GAAA,CAAI,cAAA,CAAe,QAAQ,CAAA;AAAA,EAClD,IAAA,EAAM,CAAA,CAAE,yDAAA,EAA2D,iCAAiC,CAAA;AAAA,EACpG,WAAA,EAAa,CAAA;AAAA,IACX,gEAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,cAAA,EAAgB,CAAC,OAAA,KAAY;AAC/B,CAAA;;;;"}