UNPKG

@grafana/ui

Version:
1 lines 2.69 kB
{"version":3,"file":"FieldNameByRegexMatcherEditor.cjs","sources":["../../../../src/components/MatchersUI/FieldNameByRegexMatcherEditor.tsx"],"sourcesContent":["import { memo, useState } from 'react';\n\nimport { FieldMatcherID, fieldMatchers } from '@grafana/data';\nimport { t } from '@grafana/i18n';\n\nimport { Input } from '../Input/Input';\nimport { Stack } from '../Layout/Stack/Stack';\n\nimport { type MatcherUIProps, type FieldMatcherUIRegistryItem } from './types';\n\nexport const FieldNameByRegexMatcherEditor = memo<MatcherUIProps<string>>((props) => {\n const { id, options, onChange, scope = 'series' } = props;\n const [regexp, setRegexp] = useState(options);\n\n return (\n <Stack gap={1} direction=\"column\">\n <Input\n id={id}\n placeholder={t('grafana-ui.field-name-by-regex-matcher.input-placeholder', 'Enter regular expression')}\n value={regexp}\n onChange={(e) => setRegexp(e.currentTarget.value)}\n onBlur={() => onChange(regexp, scope)}\n />\n </Stack>\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":["memo","useState","jsx","Stack","Input","t","FieldMatcherID","fieldMatchers"],"mappings":";;;;;;;;;;;;AAUO,MAAM,6BAAA,GAAgCA,UAAA,CAA6B,CAAC,KAAA,KAAU;AACnF,EAAA,MAAM,EAAE,EAAA,EAAI,OAAA,EAAS,QAAA,EAAU,KAAA,GAAQ,UAAS,GAAI,KAAA;AACpD,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAIC,eAAS,OAAO,CAAA;AAE5C,EAAA,uBACEC,cAAA,CAACC,WAAA,EAAA,EAAM,GAAA,EAAK,CAAA,EAAG,WAAU,QAAA,EACvB,QAAA,kBAAAD,cAAA;AAAA,IAACE,WAAA;AAAA,IAAA;AAAA,MACC,EAAA;AAAA,MACA,WAAA,EAAaC,MAAA,CAAE,0DAAA,EAA4D,0BAA0B,CAAA;AAAA,MACrG,KAAA,EAAO,MAAA;AAAA,MACP,UAAU,CAAC,CAAA,KAAM,SAAA,CAAU,CAAA,CAAE,cAAc,KAAK,CAAA;AAAA,MAChD,MAAA,EAAQ,MAAM,QAAA,CAAS,MAAA,EAAQ,KAAK;AAAA;AAAA,GACtC,EACF,CAAA;AAEJ,CAAC;AAED,6BAAA,CAA8B,WAAA,GAAc,+BAAA;AAErC,MAAM,iCAA2E,OAAO;AAAA,EAC7F,IAAIC,mBAAA,CAAe,QAAA;AAAA,EACnB,SAAA,EAAW,6BAAA;AAAA,EACX,OAAA,EAASC,kBAAA,CAAc,GAAA,CAAID,mBAAA,CAAe,QAAQ,CAAA;AAAA,EAClD,IAAA,EAAMD,MAAA,CAAE,yDAAA,EAA2D,iCAAiC,CAAA;AAAA,EACpG,WAAA,EAAaA,MAAA;AAAA,IACX,gEAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,cAAA,EAAgB,CAAC,OAAA,KAAY;AAC/B,CAAA;;;;;"}