@grafana/scenes 5.23.0--canary.954.11668840775.0 → 5.23.1--canary.955.11689118589.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +24 -0
- package/dist/esm/core/SceneTimeRange.js +1 -4
- package/dist/esm/core/SceneTimeRange.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.js +14 -2
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +46 -58
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/MultiValuePill.js +114 -0
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/MultiValuePill.js.map +1 -0
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/utils.js +14 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/utils.js.map +1 -1
- package/dist/esm/variables/macros/timeMacros.js +3 -0
- package/dist/esm/variables/macros/timeMacros.js.map +1 -1
- package/dist/index.js +406 -286
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AdHocFiltersCombobox.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { FloatingFocusManager, FloatingPortal, UseFloatingOptions } from '@floating-ui/react';\nimport { Button, Icon, Spinner, Text, useStyles2 } from '@grafana/ui';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable, isMultiValueOperator } from '../AdHocFiltersVariable';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport {\n DropdownItem,\n LoadingOptionsPlaceholder,\n MultiValueApplyButton,\n NoOptionsPlaceholder,\n OptionsErrorPlaceholder,\n} from './DropdownItem';\nimport {\n ERROR_STATE_DROPDOWN_WIDTH,\n flattenOptionGroups,\n fuzzySearchOptions,\n generateFilterUpdatePayload,\n generatePlaceholder,\n setupDropdownAccessibility,\n switchInputType,\n switchToNextInputType,\n VIRTUAL_LIST_ITEM_HEIGHT,\n VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION,\n VIRTUAL_LIST_OVERSCAN,\n} from './utils';\nimport { handleOptionGroups } from '../../utils';\nimport { useFloatingInteractions, MAX_MENU_HEIGHT } from './useFloatingInteractions';\n\ninterface AdHocComboboxProps {\n filter?: AdHocFilterWithLabels;\n isAlwaysWip?: boolean;\n model: AdHocFiltersVariable;\n handleChangeViewMode?: (event?: React.MouseEvent, shouldFocusOnPillWrapperOverride?: boolean) => void;\n focusOnWipInputRef?: () => void;\n}\n\nexport type AdHocInputType = 'key' | 'operator' | 'value';\n\nexport const AdHocCombobox = forwardRef(function AdHocCombobox(\n { filter, model, isAlwaysWip, handleChangeViewMode, focusOnWipInputRef }: AdHocComboboxProps,\n parentRef\n) {\n const [open, setOpen] = useState(false);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>([]);\n const [optionsLoading, setOptionsLoading] = useState<boolean>(false);\n const [optionsError, setOptionsError] = useState<boolean>(false);\n const [inputValue, setInputValue] = useState('');\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n const [filterInputType, setInputType] = useState<AdHocInputType>(!isAlwaysWip ? 'value' : 'key');\n const styles = useStyles2(getStyles);\n // control multi values with local state in order to commit all values at once and avoid _wip reset mid creation\n const [filterMultiValues, setFilterMultiValues] = useState<Array<SelectableValue<string>>>([]);\n const [_, setForceRefresh] = useState({});\n\n const multiValuePillWrapperRef = useRef<HTMLDivElement>(null);\n\n const hasMultiValueOperator = isMultiValueOperator(filter?.operator || '');\n const isMultiValueEdit = hasMultiValueOperator && filterInputType === 'value';\n\n // used to identify operator element and prevent dismiss because it registers as outside click\n const operatorIdentifier = useId();\n\n const listRef = useRef<Array<HTMLElement | null>>([]);\n const disabledIndicesRef = useRef<number[]>([]);\n\n const optionsSearcher = useMemo(() => fuzzySearchOptions(options), [options]);\n\n const isLastFilter = useMemo(() => {\n if (isAlwaysWip) {\n return false;\n }\n\n if (model.state.filters.at(-1) === filter) {\n return true;\n }\n return false;\n }, [filter, isAlwaysWip, model.state.filters]);\n\n // reset wip filter. Used when navigating away with incomplete wip filer or when selecting wip filter value\n const handleResetWip = useCallback(() => {\n if (isAlwaysWip) {\n model._addWip();\n setInputType('key');\n setInputValue('');\n }\n }, [model, isAlwaysWip]);\n\n const handleMultiValueFilterCommit = useCallback(\n (\n model: AdHocFiltersVariable,\n filter: AdHocFilterWithLabels,\n filterMultiValues: Array<SelectableValue<string>>,\n preventFocus?: boolean\n ) => {\n if (filterMultiValues.length) {\n const valueLabels: string[] = [];\n const values: string[] = [];\n filterMultiValues.forEach((item) => {\n valueLabels.push(item.label ?? item.value!);\n values.push(item.value!);\n });\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n model._updateFilter(filter!, { valueLabels, values, value: values[0] });\n setFilterMultiValues([]);\n }\n if (!preventFocus) {\n setTimeout(() => refs.domReference.current?.focus());\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const handleLocalMultiValueChange = useCallback((selectedItem: SelectableValue<string>) => {\n setFilterMultiValues((items) => {\n if (items.some((item) => item.value === selectedItem.value)) {\n return items.filter((item) => item.value !== selectedItem.value);\n }\n return [...items, selectedItem];\n });\n }, []);\n\n const onOpenChange = useCallback<NonNullable<UseFloatingOptions['onOpenChange']>>(\n (nextOpen, _, reason) => {\n setOpen(nextOpen);\n // change from filter edit mode to filter view mode when clicked\n // outside input or dropdown\n\n if (reason && ['outside-press', 'escape-key'].includes(reason)) {\n if (isMultiValueEdit) {\n // commit multi value filter values on escape and click-away\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n }\n handleResetWip();\n handleChangeViewMode?.();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n isMultiValueEdit,\n model,\n ]\n );\n\n // generate ids from multi values in order to prevent outside click based on those ids\n const outsidePressIdsToIgnore = useMemo(() => {\n return [operatorIdentifier, ...filterMultiValues.map((item, i) => `${item.value}-${i}`)];\n }, [operatorIdentifier, filterMultiValues]);\n\n const { refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps } = useFloatingInteractions({\n open,\n onOpenChange,\n activeIndex,\n setActiveIndex,\n outsidePressIdsToIgnore,\n listRef,\n disabledIndicesRef,\n });\n\n // pass ability to focus on input element back to parent\n // parentRef is coming from AdHocFiltersComboboxRenderer\n useImperativeHandle(parentRef, () => () => refs.domReference.current?.focus(), [refs.domReference]);\n\n function onChange(event: React.ChangeEvent<HTMLInputElement>) {\n const value = event.target.value;\n setInputValue(value);\n setActiveIndex(0);\n }\n\n const handleRemoveMultiValue = useCallback(\n (item: SelectableValue<string>) => {\n setFilterMultiValues((selected) => selected.filter((option) => option.value !== item.value));\n setTimeout(() => refs.domReference.current?.focus());\n },\n [refs.domReference]\n );\n\n // operation order on fetched options:\n // fuzzy search -> extract into groups -> flatten group labels and options\n const filteredDropDownItems = flattenOptionGroups(handleOptionGroups(optionsSearcher(inputValue, filterInputType)));\n\n // adding custom option this way so that virtualiser is aware of it and can scroll to\n if (filterInputType !== 'operator' && inputValue) {\n filteredDropDownItems.push({\n value: inputValue.trim(),\n label: inputValue.trim(),\n isCustom: true,\n });\n }\n\n // calculate width and populate listRef and disabledIndicesRef for arrow key navigation\n const maxOptionWidth = setupDropdownAccessibility(filteredDropDownItems, listRef, disabledIndicesRef);\n\n const handleFetchOptions = useCallback(\n async (inputType: AdHocInputType) => {\n setOptionsError(false);\n setOptionsLoading(true);\n setOptions([]);\n let options: Array<SelectableValue<string>> = [];\n try {\n if (inputType === 'key') {\n options = await model._getKeys(null);\n } else if (inputType === 'operator') {\n options = model._getOperators();\n } else if (inputType === 'value') {\n options = await model._getValuesFor(filter!);\n }\n\n setOptions(options);\n if (options[0]?.group) {\n setActiveIndex(1);\n } else {\n setActiveIndex(0);\n }\n } catch (e) {\n setOptionsError(true);\n }\n setOptionsLoading(false);\n },\n [filter, model]\n );\n\n const rowVirtualizer = useVirtualizer({\n count: filteredDropDownItems.length,\n getScrollElement: () => refs.floating.current,\n estimateSize: (index) =>\n filteredDropDownItems[index].description ? VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION : VIRTUAL_LIST_ITEM_HEIGHT,\n overscan: VIRTUAL_LIST_OVERSCAN,\n });\n\n //\n // Keyboard interactions\n //\n\n const handleBackspaceInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit: boolean) => {\n if (event.key === 'Backspace' && !inputValue) {\n if (filterInputType === 'value') {\n if (multiValueEdit) {\n if (filterMultiValues.length) {\n setFilterMultiValues((items) => {\n const updated = [...items];\n updated.splice(-1, 1);\n\n return updated;\n });\n return;\n }\n }\n setInputType('operator');\n return;\n }\n\n // focus back on alway wip input when you delete filter with backspace\n focusOnWipInputRef?.();\n\n model._handleComboboxBackspace(filter!);\n\n if (isAlwaysWip) {\n handleResetWip();\n }\n }\n },\n [\n inputValue,\n filterInputType,\n model,\n filter,\n isAlwaysWip,\n filterMultiValues.length,\n handleResetWip,\n focusOnWipInputRef,\n ]\n );\n\n const handleTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n // change filter to view mode when navigating away with Tab key\n // this is needed because useDismiss only reacts to mousedown\n if (event.key === 'Tab' && !event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n refs.domReference.current?.focus();\n }\n\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n model,\n refs.domReference,\n ]\n );\n\n const handleShiftTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Tab' && event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on shift tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues, true);\n }\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [filter, filterMultiValues, handleChangeViewMode, handleMultiValueFilterCommit, handleResetWip, model]\n );\n\n const handleEnterInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Enter' && activeIndex != null) {\n // safeguard for non existing items\n if (!filteredDropDownItems[activeIndex]) {\n return;\n }\n const selectedItem = filteredDropDownItems[activeIndex];\n\n if (multiValueEdit) {\n handleLocalMultiValueChange(selectedItem);\n } else {\n model._updateFilter(\n filter!,\n generateFilterUpdatePayload({\n filterInputType,\n item: selectedItem,\n filter: filter!,\n setFilterMultiValues,\n })\n );\n\n switchToNextInputType(\n filterInputType,\n setInputType,\n handleChangeViewMode,\n refs.domReference.current,\n // preventing focus on filter pill only when last filter for better backspace experience\n isLastFilter ? false : undefined\n );\n setActiveIndex(null);\n if (isLastFilter) {\n focusOnWipInputRef?.();\n }\n }\n\n setInputValue('');\n }\n },\n [\n activeIndex,\n filteredDropDownItems,\n handleLocalMultiValueChange,\n model,\n filter,\n filterInputType,\n handleChangeViewMode,\n refs.domReference,\n isLastFilter,\n focusOnWipInputRef,\n ]\n );\n\n //\n // Effects\n //\n\n useEffect(() => {\n // fetch options when dropdown is opened.\n if (open) {\n handleFetchOptions(filterInputType);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, filterInputType]);\n\n // when not in wip mode this is the point of switching from view to edit mode\n // and in this case we default to 'value' input type and focus input\n useEffect(() => {\n if (!isAlwaysWip) {\n setInputType('value');\n setInputValue('');\n\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n if (hasMultiValueOperator && filter?.values?.length) {\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const multiValueOptions = (filter.values as string[]).reduce<Array<SelectableValue<string>>>(\n (acc, value, i) => [\n ...acc,\n {\n label: filter.valueLabels?.[i] || value,\n value: value,\n },\n ],\n []\n );\n // populate filter multi values to local state on pill edit enter\n setFilterMultiValues(multiValueOptions);\n }\n\n refs.domReference.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // this is required only with multi value select in order to update position\n // of the multi value apply button\n useEffect(() => {\n if (isMultiValueEdit && filterMultiValues) {\n setTimeout(() => setForceRefresh({}));\n }\n }, [filterMultiValues, isMultiValueEdit]);\n\n useLayoutEffect(() => {\n // this is needed to scroll virtual list to the position of currently selected\n // dropdown item when navigating with arrow up/down keys to end/start of list\n if (\n activeIndex !== null &&\n rowVirtualizer.range &&\n (activeIndex > rowVirtualizer.range?.endIndex || activeIndex < rowVirtualizer.range?.startIndex)\n ) {\n rowVirtualizer.scrollToIndex(activeIndex);\n }\n }, [activeIndex, rowVirtualizer]);\n\n const keyLabel = filter?.keyLabel ?? filter?.key;\n\n return (\n <div className={styles.comboboxWrapper}>\n {filter ? (\n <div className={styles.pillWrapper}>\n {/* Filter key pill render */}\n {filter?.key ? <div className={cx(styles.basePill, styles.keyPill)}>{keyLabel}</div> : null}\n {/* Filter operator pill render */}\n {filter?.key && filter?.operator && filterInputType !== 'operator' ? (\n <div\n id={operatorIdentifier}\n className={cx(styles.basePill, styles.operatorPill, operatorIdentifier)}\n role=\"button\"\n aria-label=\"Edit filter operator\"\n tabIndex={0}\n onClick={(event) => {\n event.stopPropagation();\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }}\n onKeyDown={(event) => {\n handleShiftTabInput(event, hasMultiValueOperator);\n if (event.key === 'Enter') {\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }\n }}\n >\n {filter.operator}\n </div>\n ) : null}\n\n <div ref={multiValuePillWrapperRef}></div>\n {isMultiValueEdit\n ? filterMultiValues.map((item, i) => (\n <MultiValuePill\n key={`${item.value}-${i}`}\n item={item}\n index={i}\n handleRemoveMultiValue={handleRemoveMultiValue}\n />\n ))\n : null}\n </div>\n ) : null}\n\n <input\n {...getReferenceProps({\n ref: refs.setReference,\n onChange,\n value: inputValue,\n // dynamic placeholder to display operator and/or value in filter edit mode\n placeholder: generatePlaceholder(filter!, filterInputType, isMultiValueEdit, isAlwaysWip),\n 'aria-autocomplete': 'list',\n onKeyDown(event) {\n if (!open) {\n setOpen(true);\n return;\n }\n\n if (filterInputType === 'operator') {\n handleShiftTabInput(event);\n }\n handleBackspaceInput(event, isMultiValueEdit);\n handleTabInput(event, isMultiValueEdit);\n handleEnterInput(event, isMultiValueEdit);\n },\n })}\n className={cx(styles.inputStyle, { [styles.loadingInputPadding]: !optionsLoading })}\n onClick={(event) => {\n event.stopPropagation();\n setOpen(true);\n }}\n onFocus={() => {\n setActiveIndex(0);\n setOpen(true);\n }}\n />\n {optionsLoading ? <Spinner className={styles.loadingIndicator} inline={true} /> : null}\n <FloatingPortal>\n {open && (\n <FloatingFocusManager context={context} initialFocus={-1} visuallyHiddenDismiss modal={false}>\n <>\n <div\n style={{\n ...floatingStyles,\n width: `${optionsError ? ERROR_STATE_DROPDOWN_WIDTH : maxOptionWidth}px`,\n transform: isMultiValueEdit\n ? `translate(${multiValuePillWrapperRef.current?.getBoundingClientRect().left || 0}px, ${\n (refs.domReference.current?.getBoundingClientRect().bottom || 0) + 10\n }px )`\n : floatingStyles.transform,\n }}\n ref={refs.setFloating}\n className={styles.dropdownWrapper}\n tabIndex={-1}\n >\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize() || VIRTUAL_LIST_ITEM_HEIGHT}px`, // fallback to 38px for loading/error/no options placeholders\n }}\n {...getFloatingProps()}\n tabIndex={-1}\n >\n {optionsLoading ? (\n <LoadingOptionsPlaceholder />\n ) : optionsError ? (\n <OptionsErrorPlaceholder handleFetchOptions={() => handleFetchOptions(filterInputType)} />\n ) : !filteredDropDownItems.length && (filterInputType === 'operator' || !inputValue) ? (\n <NoOptionsPlaceholder />\n ) : (\n rowVirtualizer.getVirtualItems().map((virtualItem) => {\n const item = filteredDropDownItems[virtualItem.index];\n const index = virtualItem.index;\n\n // render group label\n if (item.options) {\n return (\n <div\n key={`${item.label}+${index}`}\n className={cx(styles.optionGroupLabel, styles.groupTopBorder)}\n style={{\n height: `${virtualItem.size}px`,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n >\n <Text weight=\"bold\" variant=\"bodySmall\" color=\"secondary\">\n {item.label!}\n </Text>\n </div>\n );\n }\n\n const nextItem: SelectableValue<string> | undefined =\n filteredDropDownItems[virtualItem.index + 1];\n const shouldAddBottomBorder = nextItem && !nextItem.group && !nextItem.options && item.group;\n\n return (\n // key is included in getItemProps()\n // eslint-disable-next-line react/jsx-key\n <DropdownItem\n {...getItemProps({\n key: `${item.value!}-${index}`,\n ref(node) {\n listRef.current[index] = node;\n },\n onClick(event) {\n if (filterInputType !== 'value') {\n event.stopPropagation();\n }\n if (isMultiValueEdit) {\n event.preventDefault();\n event.stopPropagation();\n handleLocalMultiValueChange(item);\n refs.domReference.current?.focus();\n } else {\n model._updateFilter(\n filter!,\n generateFilterUpdatePayload({\n filterInputType,\n item,\n filter: filter!,\n setFilterMultiValues,\n })\n );\n setInputValue('');\n\n switchToNextInputType(\n filterInputType,\n setInputType,\n handleChangeViewMode,\n refs.domReference.current,\n // explicitly preventing focus on filter pill due to a11y error\n false\n );\n }\n },\n })}\n active={activeIndex === index}\n addGroupBottomBorder={shouldAddBottomBorder}\n // virtual item positioning and accessibility\n style={{\n height: `${virtualItem.size}px`,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n aria-setsize={filteredDropDownItems.length}\n aria-posinset={virtualItem.index + 1}\n isMultiValueEdit={isMultiValueEdit}\n checked={filterMultiValues.some((val) => val.value === item.value)}\n >\n <span>\n {item.isCustom ? 'Use custom value: ' : ''} {item.label ?? item.value}\n </span>\n {item.description ? <div className={styles.descriptionText}>{item.description}</div> : null}\n </DropdownItem>\n );\n })\n )}\n </div>\n </div>\n {isMultiValueEdit && !optionsLoading && !optionsError && filteredDropDownItems.length ? (\n <MultiValueApplyButton\n onApply={() => {\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n }}\n floatingElement={refs.floating.current}\n maxOptionWidth={maxOptionWidth}\n menuHeight={Math.min(rowVirtualizer.getTotalSize(), MAX_MENU_HEIGHT)}\n />\n ) : null}\n </>\n </FloatingFocusManager>\n )}\n </FloatingPortal>\n </div>\n );\n});\n\ninterface MultiValuePillProps {\n item: SelectableValue<string>;\n handleRemoveMultiValue: (item: SelectableValue<string>) => void;\n index: number;\n}\nconst MultiValuePill = ({ item, handleRemoveMultiValue, index }: MultiValuePillProps) => {\n const styles = useStyles2(getStyles);\n\n return (\n <div className={cx(styles.basePill, styles.valuePill)}>\n <span> {item.label ?? item.value}</span>\n <Button\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleRemoveMultiValue(item);\n }}\n onKeyDownCapture={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n handleRemoveMultiValue(item);\n }\n }}\n fill=\"text\"\n size=\"sm\"\n variant=\"secondary\"\n className={styles.removeButton}\n tooltip={`Remove filter value - ${item.label ?? item.value}`}\n >\n <Icon name=\"times\" size=\"md\" id={`${item.value}-${index}`} />\n </Button>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n comboboxWrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n }),\n pillWrapper: css({\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }),\n basePill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.disabledBackground,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 1, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: theme.spacing(2.75),\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n keyPill: css({\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'default',\n }),\n operatorPill: css({\n '&:hover': {\n background: theme.colors.action.hover,\n },\n }),\n valuePill: css({\n background: theme.colors.action.selected,\n padding: theme.spacing(0.125, 0, 0.125, 1),\n }),\n dropdownWrapper: css({\n backgroundColor: theme.colors.background.primary,\n color: theme.colors.text.primary,\n boxShadow: theme.shadows.z2,\n overflowY: 'auto',\n zIndex: theme.zIndex.dropdown,\n }),\n inputStyle: css({\n paddingBlock: 0,\n '&:focus': {\n outline: 'none',\n },\n }),\n loadingIndicator: css({\n color: theme.colors.text.secondary,\n marginLeft: theme.spacing(0.5),\n }),\n loadingInputPadding: css({\n paddingRight: theme.spacing(2.5),\n }),\n optionGroupLabel: css({\n padding: theme.spacing(1),\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n }),\n groupTopBorder: css({\n '&:not(:first-child)': {\n borderTop: `1px solid ${theme.colors.border.weak}`,\n },\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n height: '100%',\n padding: 0,\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n descriptionText: css({\n ...theme.typography.bodySmall,\n color: theme.colors.text.secondary,\n paddingTop: theme.spacing(0.5),\n }),\n multiValueApply: css({\n position: 'absolute',\n top: 0,\n left: 0,\n display: 'flex',\n }),\n});\n"],"names":["AdHocCombobox","model","filter","filterMultiValues","_a","_","options","_b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDa,MAAA,aAAA,GAAgB,UAAW,CAAA,SAASA,cAC/C,CAAA,EAAE,MAAQ,EAAA,KAAA,EAAO,WAAa,EAAA,oBAAA,EAAsB,kBAAmB,EAAA,EACvE,SACA,EAAA;AArDF,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAsDE,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CA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AAA;AAAA,GACR,CAAA;AAAA,EACD,gBAAgB,GAAI,CAAA;AAAA,IAClB,qBAAuB,EAAA;AAAA,MACrB,SAAW,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,MAAA,CAAO,MAAO,CAAA,IAAA,CAAA,CAAA;AAAA,KAC9C;AAAA,GACD,CAAA;AAAA,EACD,cAAc,GAAI,CAAA;AAAA,IAChB,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC/B,MAAQ,EAAA,MAAA;AAAA,IACR,OAAS,EAAA,CAAA;AAAA,IACT,MAAQ,EAAA,SAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,KAC3B;AAAA,GACD,CAAA;AAAA,EACD,eAAiB,EAAA,GAAA,CAAI,aAChB,CAAA,cAAA,CAAA,EAAA,EAAA,KAAA,CAAM,WAAW,SADD,CAAA,EAAA;AAAA,IAEnB,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,IACzB,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GAC9B,CAAA,CAAA;AAAA,EACD,iBAAiB,GAAI,CAAA;AAAA,IACnB,QAAU,EAAA,UAAA;AAAA,IACV,GAAK,EAAA,CAAA;AAAA,IACL,IAAM,EAAA,CAAA;AAAA,IACN,OAAS,EAAA,MAAA;AAAA,GACV,CAAA;AACH,CAAA,CAAA;;;;"}
|
1
|
+
{"version":3,"file":"AdHocFiltersCombobox.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { FloatingFocusManager, FloatingPortal, UseFloatingOptions } from '@floating-ui/react';\nimport { Spinner, Text, useStyles2 } from '@grafana/ui';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable, isMultiValueOperator } from '../AdHocFiltersVariable';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport {\n DropdownItem,\n LoadingOptionsPlaceholder,\n MultiValueApplyButton,\n NoOptionsPlaceholder,\n OptionsErrorPlaceholder,\n} from './DropdownItem';\nimport {\n ERROR_STATE_DROPDOWN_WIDTH,\n flattenOptionGroups,\n fuzzySearchOptions,\n generateFilterUpdatePayload,\n generatePlaceholder,\n populateInputValueOnInputTypeSwitch,\n setupDropdownAccessibility,\n switchInputType,\n switchToNextInputType,\n VIRTUAL_LIST_ITEM_HEIGHT,\n VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION,\n VIRTUAL_LIST_OVERSCAN,\n} from './utils';\nimport { handleOptionGroups } from '../../utils';\nimport { useFloatingInteractions, MAX_MENU_HEIGHT } from './useFloatingInteractions';\nimport { MultiValuePill } from './MultiValuePill';\n\ninterface AdHocComboboxProps {\n filter?: AdHocFilterWithLabels;\n isAlwaysWip?: boolean;\n model: AdHocFiltersVariable;\n handleChangeViewMode?: (event?: React.MouseEvent, shouldFocusOnPillWrapperOverride?: boolean) => void;\n focusOnWipInputRef?: () => void;\n populateInputOnEdit?: boolean;\n}\n\nexport type AdHocInputType = 'key' | 'operator' | 'value';\n\nexport const AdHocCombobox = forwardRef(function AdHocCombobox(\n { filter, model, isAlwaysWip, handleChangeViewMode, focusOnWipInputRef, populateInputOnEdit }: AdHocComboboxProps,\n parentRef\n) {\n const [open, setOpen] = useState(false);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>([]);\n const [optionsLoading, setOptionsLoading] = useState<boolean>(false);\n const [optionsError, setOptionsError] = useState<boolean>(false);\n const [inputValue, setInputValue] = useState('');\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n const [filterInputType, setInputType] = useState<AdHocInputType>(!isAlwaysWip ? 'value' : 'key');\n const styles = useStyles2(getStyles);\n // control multi values with local state in order to commit all values at once and avoid _wip reset mid creation\n const [filterMultiValues, setFilterMultiValues] = useState<Array<SelectableValue<string>>>([]);\n const [_, setForceRefresh] = useState({});\n\n const multiValuePillWrapperRef = useRef<HTMLDivElement>(null);\n\n const hasMultiValueOperator = isMultiValueOperator(filter?.operator || '');\n const isMultiValueEdit = hasMultiValueOperator && filterInputType === 'value';\n\n // used to identify operator element and prevent dismiss because it registers as outside click\n const operatorIdentifier = useId();\n\n const listRef = useRef<Array<HTMLElement | null>>([]);\n const disabledIndicesRef = useRef<number[]>([]);\n\n const optionsSearcher = useMemo(() => fuzzySearchOptions(options), [options]);\n\n const isLastFilter = useMemo(() => {\n if (isAlwaysWip) {\n return false;\n }\n\n if (model.state.filters.at(-1) === filter) {\n return true;\n }\n return false;\n }, [filter, isAlwaysWip, model.state.filters]);\n\n // reset wip filter. Used when navigating away with incomplete wip filer or when selecting wip filter value\n const handleResetWip = useCallback(() => {\n if (isAlwaysWip) {\n model._addWip();\n setInputType('key');\n setInputValue('');\n }\n }, [model, isAlwaysWip]);\n\n const handleMultiValueFilterCommit = useCallback(\n (\n model: AdHocFiltersVariable,\n filter: AdHocFilterWithLabels,\n filterMultiValues: Array<SelectableValue<string>>,\n preventFocus?: boolean\n ) => {\n if (filterMultiValues.length) {\n const valueLabels: string[] = [];\n const values: string[] = [];\n filterMultiValues.forEach((item) => {\n valueLabels.push(item.label ?? item.value!);\n values.push(item.value!);\n });\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n model._updateFilter(filter!, { valueLabels, values, value: values[0] });\n setFilterMultiValues([]);\n }\n if (!preventFocus) {\n setTimeout(() => refs.domReference.current?.focus());\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const handleLocalMultiValueChange = useCallback((selectedItem: SelectableValue<string>) => {\n setFilterMultiValues((items) => {\n if (items.some((item) => item.value === selectedItem.value)) {\n return items.filter((item) => item.value !== selectedItem.value);\n }\n return [...items, selectedItem];\n });\n }, []);\n\n const onOpenChange = useCallback<NonNullable<UseFloatingOptions['onOpenChange']>>(\n (nextOpen, _, reason) => {\n setOpen(nextOpen);\n // change from filter edit mode to filter view mode when clicked\n // outside input or dropdown\n\n if (reason && ['outside-press', 'escape-key'].includes(reason)) {\n if (isMultiValueEdit) {\n // commit multi value filter values on escape and click-away\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n }\n handleResetWip();\n handleChangeViewMode?.();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n isMultiValueEdit,\n model,\n ]\n );\n\n // generate ids from multi values in order to prevent outside click based on those ids\n const outsidePressIdsToIgnore = useMemo(() => {\n return [\n operatorIdentifier,\n ...filterMultiValues.reduce<string[]>(\n (acc, item, i) => [...acc, `${item.value}-${i}`, `${item.value}-${i}-close-icon`],\n []\n ),\n ];\n }, [operatorIdentifier, filterMultiValues]);\n\n const { refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps } = useFloatingInteractions({\n open,\n onOpenChange,\n activeIndex,\n setActiveIndex,\n outsidePressIdsToIgnore,\n listRef,\n disabledIndicesRef,\n });\n\n // pass ability to focus on input element back to parent\n // parentRef is coming from AdHocFiltersComboboxRenderer\n useImperativeHandle(parentRef, () => () => refs.domReference.current?.focus(), [refs.domReference]);\n\n function onChange(event: React.ChangeEvent<HTMLInputElement>) {\n const value = event.target.value;\n setInputValue(value);\n setActiveIndex(0);\n }\n\n const handleRemoveMultiValue = useCallback(\n (item: SelectableValue<string>) => {\n setFilterMultiValues((selected) => selected.filter((option) => option.value !== item.value));\n setTimeout(() => refs.domReference.current?.focus());\n },\n [refs.domReference]\n );\n\n // operation order on fetched options:\n // fuzzy search -> extract into groups -> flatten group labels and options\n const filteredDropDownItems = flattenOptionGroups(handleOptionGroups(optionsSearcher(inputValue, filterInputType)));\n\n // adding custom option this way so that virtualiser is aware of it and can scroll to\n if (filterInputType !== 'operator' && inputValue) {\n filteredDropDownItems.push({\n value: inputValue.trim(),\n label: inputValue.trim(),\n isCustom: true,\n });\n }\n\n // calculate width and populate listRef and disabledIndicesRef for arrow key navigation\n const maxOptionWidth = setupDropdownAccessibility(filteredDropDownItems, listRef, disabledIndicesRef);\n\n const handleFetchOptions = useCallback(\n async (inputType: AdHocInputType) => {\n setOptionsError(false);\n setOptionsLoading(true);\n setOptions([]);\n let options: Array<SelectableValue<string>> = [];\n try {\n if (inputType === 'key') {\n options = await model._getKeys(null);\n } else if (inputType === 'operator') {\n options = model._getOperators();\n } else if (inputType === 'value') {\n options = await model._getValuesFor(filter!);\n }\n\n setOptions(options);\n if (options[0]?.group) {\n setActiveIndex(1);\n } else {\n setActiveIndex(0);\n }\n } catch (e) {\n setOptionsError(true);\n }\n setOptionsLoading(false);\n },\n [filter, model]\n );\n\n const rowVirtualizer = useVirtualizer({\n count: filteredDropDownItems.length,\n getScrollElement: () => refs.floating.current,\n estimateSize: (index) =>\n filteredDropDownItems[index].description ? VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION : VIRTUAL_LIST_ITEM_HEIGHT,\n overscan: VIRTUAL_LIST_OVERSCAN,\n });\n\n //\n // Keyboard interactions\n //\n\n const handleBackspaceInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit: boolean) => {\n if (event.key === 'Backspace' && !inputValue) {\n if (filterInputType === 'value') {\n if (multiValueEdit) {\n if (filterMultiValues.length) {\n setFilterMultiValues((items) => {\n const updated = [...items];\n updated.splice(-1, 1);\n\n return updated;\n });\n return;\n }\n }\n setInputType('operator');\n return;\n }\n\n // focus back on alway wip input when you delete filter with backspace\n focusOnWipInputRef?.();\n\n model._handleComboboxBackspace(filter!);\n\n if (isAlwaysWip) {\n handleResetWip();\n }\n }\n },\n [\n inputValue,\n filterInputType,\n model,\n filter,\n isAlwaysWip,\n filterMultiValues.length,\n handleResetWip,\n focusOnWipInputRef,\n ]\n );\n\n const handleTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n // change filter to view mode when navigating away with Tab key\n // this is needed because useDismiss only reacts to mousedown\n if (event.key === 'Tab' && !event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n refs.domReference.current?.focus();\n }\n\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n model,\n refs.domReference,\n ]\n );\n\n const handleShiftTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Tab' && event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on shift tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues, true);\n }\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [filter, filterMultiValues, handleChangeViewMode, handleMultiValueFilterCommit, handleResetWip, model]\n );\n\n const handleEnterInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Enter' && activeIndex != null) {\n // safeguard for non existing items\n if (!filteredDropDownItems[activeIndex]) {\n return;\n }\n const selectedItem = filteredDropDownItems[activeIndex];\n\n if (multiValueEdit) {\n handleLocalMultiValueChange(selectedItem);\n setInputValue('');\n } else {\n model._updateFilter(\n filter!,\n generateFilterUpdatePayload({\n filterInputType,\n item: selectedItem,\n filter: filter!,\n setFilterMultiValues,\n })\n );\n\n populateInputValueOnInputTypeSwitch({\n populateInputOnEdit,\n item: selectedItem,\n filterInputType,\n setInputValue,\n filter,\n });\n\n switchToNextInputType(\n filterInputType,\n setInputType,\n handleChangeViewMode,\n refs.domReference.current,\n // preventing focus on filter pill only when last filter for better backspace experience\n isLastFilter ? false : undefined\n );\n setActiveIndex(null);\n if (isLastFilter) {\n focusOnWipInputRef?.();\n }\n }\n }\n },\n [\n activeIndex,\n filteredDropDownItems,\n handleLocalMultiValueChange,\n model,\n filter,\n filterInputType,\n populateInputOnEdit,\n handleChangeViewMode,\n refs.domReference,\n isLastFilter,\n focusOnWipInputRef,\n ]\n );\n\n const handleEditMultiValuePill = useCallback(\n (value: SelectableValue<string>) => {\n const valueLabel = value.label || value.value!;\n setFilterMultiValues((prev) => prev.filter((item) => item.value !== value.value));\n setInputValue(valueLabel);\n refs.domReference.current?.focus();\n },\n [refs.domReference]\n );\n\n //\n // Effects\n //\n\n useEffect(() => {\n // fetch options when dropdown is opened.\n if (open) {\n handleFetchOptions(filterInputType);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, filterInputType]);\n\n // when not in wip mode this is the point of switching from view to edit mode\n // and in this case we default to 'value' input type and focus input\n useEffect(() => {\n if (!isAlwaysWip) {\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n if (hasMultiValueOperator && filter?.values?.length) {\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const multiValueOptions = (filter.values as string[]).reduce<Array<SelectableValue<string>>>(\n (acc, value, i) => [\n ...acc,\n {\n label: filter.valueLabels?.[i] || value,\n value: value,\n },\n ],\n []\n );\n // populate filter multi values to local state on pill edit enter\n setFilterMultiValues(multiValueOptions);\n }\n\n // populate input when selecting pill for edit\n // this avoids populating input during delete with backspace\n if (!hasMultiValueOperator && populateInputOnEdit) {\n setInputValue(filter?.value || '');\n }\n\n refs.domReference.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // this is required only with multi value select in order to update position\n // of the multi value apply button\n useEffect(() => {\n if (isMultiValueEdit && filterMultiValues) {\n setTimeout(() => setForceRefresh({}));\n }\n }, [filterMultiValues, isMultiValueEdit]);\n\n useLayoutEffect(() => {\n // this is needed to scroll virtual list to the position of currently selected\n // dropdown item when navigating with arrow up/down keys to end/start of list\n if (\n activeIndex !== null &&\n rowVirtualizer.range &&\n (activeIndex > rowVirtualizer.range?.endIndex || activeIndex < rowVirtualizer.range?.startIndex)\n ) {\n rowVirtualizer.scrollToIndex(activeIndex);\n }\n }, [activeIndex, rowVirtualizer]);\n\n const keyLabel = filter?.keyLabel ?? filter?.key;\n\n return (\n <div className={styles.comboboxWrapper}>\n {filter ? (\n <div className={styles.pillWrapper}>\n {/* Filter key pill render */}\n {filter?.key ? <div className={cx(styles.basePill, styles.keyPill)}>{keyLabel}</div> : null}\n {/* Filter operator pill render */}\n {filter?.key && filter?.operator && filterInputType !== 'operator' ? (\n <div\n id={operatorIdentifier}\n className={cx(styles.basePill, styles.operatorPill, operatorIdentifier)}\n role=\"button\"\n aria-label=\"Edit filter operator\"\n tabIndex={0}\n onClick={(event) => {\n event.stopPropagation();\n setInputValue('');\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }}\n onKeyDown={(event) => {\n handleShiftTabInput(event, hasMultiValueOperator);\n if (event.key === 'Enter') {\n setInputValue('');\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }\n }}\n >\n {filter.operator}\n </div>\n ) : null}\n\n <div ref={multiValuePillWrapperRef}></div>\n {isMultiValueEdit\n ? filterMultiValues.map((item, i) => (\n <MultiValuePill\n key={`${item.value}-${i}`}\n item={item}\n index={i}\n handleRemoveMultiValue={handleRemoveMultiValue}\n handleEditMultiValuePill={handleEditMultiValuePill}\n />\n ))\n : null}\n </div>\n ) : null}\n\n <input\n {...getReferenceProps({\n ref: refs.setReference,\n onChange,\n value: inputValue,\n // dynamic placeholder to display operator and/or value in filter edit mode\n placeholder: generatePlaceholder(filter!, filterInputType, isMultiValueEdit, isAlwaysWip),\n 'aria-autocomplete': 'list',\n onKeyDown(event) {\n if (!open) {\n setOpen(true);\n return;\n }\n\n if (filterInputType === 'operator') {\n handleShiftTabInput(event);\n }\n handleBackspaceInput(event, isMultiValueEdit);\n handleTabInput(event, isMultiValueEdit);\n handleEnterInput(event, isMultiValueEdit);\n },\n })}\n className={cx(styles.inputStyle, { [styles.loadingInputPadding]: !optionsLoading })}\n onClick={(event) => {\n event.stopPropagation();\n setOpen(true);\n }}\n onFocus={() => {\n setActiveIndex(0);\n setOpen(true);\n }}\n />\n {optionsLoading ? <Spinner className={styles.loadingIndicator} inline={true} /> : null}\n <FloatingPortal>\n {open && (\n <FloatingFocusManager context={context} initialFocus={-1} visuallyHiddenDismiss modal={false}>\n <>\n <div\n style={{\n ...floatingStyles,\n width: `${optionsError ? ERROR_STATE_DROPDOWN_WIDTH : maxOptionWidth}px`,\n transform: isMultiValueEdit\n ? `translate(${multiValuePillWrapperRef.current?.getBoundingClientRect().left || 0}px, ${\n (refs.domReference.current?.getBoundingClientRect().bottom || 0) + 10\n }px )`\n : floatingStyles.transform,\n }}\n ref={refs.setFloating}\n className={styles.dropdownWrapper}\n tabIndex={-1}\n >\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize() || VIRTUAL_LIST_ITEM_HEIGHT}px`, // fallback to 38px for loading/error/no options placeholders\n }}\n {...getFloatingProps()}\n tabIndex={-1}\n >\n {optionsLoading ? (\n <LoadingOptionsPlaceholder />\n ) : optionsError ? (\n <OptionsErrorPlaceholder handleFetchOptions={() => handleFetchOptions(filterInputType)} />\n ) : !filteredDropDownItems.length && (filterInputType === 'operator' || !inputValue) ? (\n <NoOptionsPlaceholder />\n ) : (\n rowVirtualizer.getVirtualItems().map((virtualItem) => {\n const item = filteredDropDownItems[virtualItem.index];\n const index = virtualItem.index;\n\n // render group label\n if (item.options) {\n return (\n <div\n key={`${item.label}+${index}`}\n className={cx(styles.optionGroupLabel, styles.groupTopBorder)}\n style={{\n height: `${virtualItem.size}px`,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n >\n <Text weight=\"bold\" variant=\"bodySmall\" color=\"secondary\">\n {item.label!}\n </Text>\n </div>\n );\n }\n\n const nextItem: SelectableValue<string> | undefined =\n filteredDropDownItems[virtualItem.index + 1];\n const shouldAddBottomBorder = nextItem && !nextItem.group && !nextItem.options && item.group;\n\n return (\n // key is included in getItemProps()\n // eslint-disable-next-line react/jsx-key\n <DropdownItem\n {...getItemProps({\n key: `${item.value!}-${index}`,\n ref(node) {\n listRef.current[index] = node;\n },\n onClick(event) {\n if (filterInputType !== 'value') {\n event.stopPropagation();\n }\n if (isMultiValueEdit) {\n event.preventDefault();\n event.stopPropagation();\n handleLocalMultiValueChange(item);\n setInputValue('');\n refs.domReference.current?.focus();\n } else {\n model._updateFilter(\n filter!,\n generateFilterUpdatePayload({\n filterInputType,\n item,\n filter: filter!,\n setFilterMultiValues,\n })\n );\n\n populateInputValueOnInputTypeSwitch({\n populateInputOnEdit,\n item,\n filterInputType,\n setInputValue,\n filter,\n });\n\n switchToNextInputType(\n filterInputType,\n setInputType,\n handleChangeViewMode,\n refs.domReference.current,\n // explicitly preventing focus on filter pill due to a11y error\n false\n );\n }\n },\n })}\n active={activeIndex === index}\n addGroupBottomBorder={shouldAddBottomBorder}\n // virtual item positioning and accessibility\n style={{\n height: `${virtualItem.size}px`,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n aria-setsize={filteredDropDownItems.length}\n aria-posinset={virtualItem.index + 1}\n isMultiValueEdit={isMultiValueEdit}\n checked={filterMultiValues.some((val) => val.value === item.value)}\n >\n <span>\n {item.isCustom ? 'Use custom value: ' : ''} {item.label ?? item.value}\n </span>\n {item.description ? <div className={styles.descriptionText}>{item.description}</div> : null}\n </DropdownItem>\n );\n })\n )}\n </div>\n </div>\n {isMultiValueEdit && !optionsLoading && !optionsError && filteredDropDownItems.length ? (\n <MultiValueApplyButton\n onApply={() => {\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n }}\n floatingElement={refs.floating.current}\n maxOptionWidth={maxOptionWidth}\n menuHeight={Math.min(rowVirtualizer.getTotalSize(), MAX_MENU_HEIGHT)}\n />\n ) : null}\n </>\n </FloatingFocusManager>\n )}\n </FloatingPortal>\n </div>\n );\n});\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n comboboxWrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n }),\n pillWrapper: css({\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }),\n basePill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.disabledBackground,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 1, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: theme.spacing(2.75),\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n keyPill: css({\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'default',\n }),\n operatorPill: css({\n '&:hover': {\n background: theme.colors.action.hover,\n },\n }),\n dropdownWrapper: css({\n backgroundColor: theme.colors.background.primary,\n color: theme.colors.text.primary,\n boxShadow: theme.shadows.z2,\n overflowY: 'auto',\n zIndex: theme.zIndex.dropdown,\n }),\n inputStyle: css({\n paddingBlock: 0,\n '&:focus': {\n outline: 'none',\n },\n }),\n loadingIndicator: css({\n color: theme.colors.text.secondary,\n marginLeft: theme.spacing(0.5),\n }),\n loadingInputPadding: css({\n paddingRight: theme.spacing(2.5),\n }),\n optionGroupLabel: css({\n padding: theme.spacing(1),\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n }),\n groupTopBorder: css({\n '&:not(:first-child)': {\n borderTop: `1px solid ${theme.colors.border.weak}`,\n },\n }),\n descriptionText: css({\n ...theme.typography.bodySmall,\n color: theme.colors.text.secondary,\n paddingTop: theme.spacing(0.5),\n }),\n});\n"],"names":["AdHocCombobox","model","filter","filterMultiValues","_a","_","options","_b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDO,MAAM,aAAgB,GAAA,UAAA,CAAW,SAASA,cAAAA,CAC/C,EAAE,MAAA,EAAQ,KAAO,EAAA,WAAA,EAAa,oBAAsB,EAAA,kBAAA,EAAoB,mBAAoB,EAAA,EAC5F,SACA,EAAA;AAxDF,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAyDE,EAAA,MAAM,CAAC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AAQ,GAAG,CAAA;AAAA,GAC9B,CAAA,CAAA;AACH,CAAA,CAAA;;;;"}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import { cx, css } from '@emotion/css';
|
2
|
+
import { useStyles2, Button, Icon } from '@grafana/ui';
|
3
|
+
import React, { useCallback } from 'react';
|
4
|
+
|
5
|
+
var __defProp = Object.defineProperty;
|
6
|
+
var __defProps = Object.defineProperties;
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
+
var __spreadValues = (a, b) => {
|
13
|
+
for (var prop in b || (b = {}))
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
if (__getOwnPropSymbols)
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
+
if (__propIsEnum.call(b, prop))
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
20
|
+
}
|
21
|
+
return a;
|
22
|
+
};
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
+
const MultiValuePill = ({
|
25
|
+
item,
|
26
|
+
handleRemoveMultiValue,
|
27
|
+
index,
|
28
|
+
handleEditMultiValuePill
|
29
|
+
}) => {
|
30
|
+
var _a, _b;
|
31
|
+
const styles = useStyles2(getStyles);
|
32
|
+
const editMultiValuePill = useCallback(
|
33
|
+
(e) => {
|
34
|
+
e.stopPropagation();
|
35
|
+
e.preventDefault();
|
36
|
+
handleEditMultiValuePill(item);
|
37
|
+
},
|
38
|
+
[handleEditMultiValuePill, item]
|
39
|
+
);
|
40
|
+
const editMultiValuePillWithKeyboard = useCallback(
|
41
|
+
(e) => {
|
42
|
+
if (e.key === "Enter") {
|
43
|
+
editMultiValuePill(e);
|
44
|
+
}
|
45
|
+
},
|
46
|
+
[editMultiValuePill]
|
47
|
+
);
|
48
|
+
const removePillHandler = useCallback(
|
49
|
+
(e) => {
|
50
|
+
e.stopPropagation();
|
51
|
+
e.preventDefault();
|
52
|
+
handleRemoveMultiValue(item);
|
53
|
+
},
|
54
|
+
[handleRemoveMultiValue, item]
|
55
|
+
);
|
56
|
+
const removePillHandlerWithKeyboard = useCallback(
|
57
|
+
(e) => {
|
58
|
+
if (e.key === "Enter") {
|
59
|
+
removePillHandler(e);
|
60
|
+
}
|
61
|
+
},
|
62
|
+
[removePillHandler]
|
63
|
+
);
|
64
|
+
return /* @__PURE__ */ React.createElement("div", {
|
65
|
+
className: cx(styles.basePill, styles.valuePill),
|
66
|
+
onClick: editMultiValuePill,
|
67
|
+
onKeyDown: editMultiValuePillWithKeyboard,
|
68
|
+
tabIndex: 0,
|
69
|
+
id: `${item.value}-${index}`
|
70
|
+
}, (_a = item.label) != null ? _a : item.value, /* @__PURE__ */ React.createElement(Button, {
|
71
|
+
onClick: removePillHandler,
|
72
|
+
onKeyDownCapture: removePillHandlerWithKeyboard,
|
73
|
+
fill: "text",
|
74
|
+
size: "sm",
|
75
|
+
variant: "secondary",
|
76
|
+
className: styles.removeButton,
|
77
|
+
tooltip: `Remove filter value - ${(_b = item.label) != null ? _b : item.value}`
|
78
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
79
|
+
name: "times",
|
80
|
+
size: "md",
|
81
|
+
id: `${item.value}-${index}-close-icon`
|
82
|
+
})));
|
83
|
+
};
|
84
|
+
const getStyles = (theme) => ({
|
85
|
+
basePill: css(__spreadProps(__spreadValues({
|
86
|
+
display: "flex",
|
87
|
+
alignItems: "center",
|
88
|
+
background: theme.colors.action.disabledBackground,
|
89
|
+
border: `1px solid ${theme.colors.border.weak}`,
|
90
|
+
padding: theme.spacing(0.125, 1, 0.125, 1),
|
91
|
+
color: theme.colors.text.primary,
|
92
|
+
overflow: "hidden",
|
93
|
+
whiteSpace: "nowrap",
|
94
|
+
minHeight: theme.spacing(2.75)
|
95
|
+
}, theme.typography.bodySmall), {
|
96
|
+
cursor: "pointer"
|
97
|
+
})),
|
98
|
+
valuePill: css({
|
99
|
+
background: theme.colors.action.selected,
|
100
|
+
padding: theme.spacing(0.125, 0, 0.125, 1)
|
101
|
+
}),
|
102
|
+
removeButton: css({
|
103
|
+
marginInline: theme.spacing(0.5),
|
104
|
+
height: "100%",
|
105
|
+
padding: 0,
|
106
|
+
cursor: "pointer",
|
107
|
+
"&:hover": {
|
108
|
+
color: theme.colors.text.primary
|
109
|
+
}
|
110
|
+
})
|
111
|
+
});
|
112
|
+
|
113
|
+
export { MultiValuePill };
|
114
|
+
//# sourceMappingURL=MultiValuePill.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MultiValuePill.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/MultiValuePill.tsx"],"sourcesContent":["import { cx, css } from '@emotion/css';\nimport { SelectableValue, GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2, Button, Icon } from '@grafana/ui';\nimport React, { useCallback } from 'react';\n\ninterface MultiValuePillProps {\n item: SelectableValue<string>;\n handleRemoveMultiValue: (item: SelectableValue<string>) => void;\n index: number;\n handleEditMultiValuePill: (value: SelectableValue<string>) => void;\n}\nexport const MultiValuePill = ({\n item,\n handleRemoveMultiValue,\n index,\n handleEditMultiValuePill,\n}: MultiValuePillProps) => {\n const styles = useStyles2(getStyles);\n\n const editMultiValuePill = useCallback(\n (e: React.SyntheticEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleEditMultiValuePill(item);\n },\n [handleEditMultiValuePill, item]\n );\n\n const editMultiValuePillWithKeyboard = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n editMultiValuePill(e);\n }\n },\n [editMultiValuePill]\n );\n\n const removePillHandler = useCallback(\n (e: React.SyntheticEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleRemoveMultiValue(item);\n },\n [handleRemoveMultiValue, item]\n );\n\n const removePillHandlerWithKeyboard = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n removePillHandler(e);\n }\n },\n [removePillHandler]\n );\n\n return (\n <div\n className={cx(styles.basePill, styles.valuePill)}\n onClick={editMultiValuePill}\n onKeyDown={editMultiValuePillWithKeyboard}\n tabIndex={0}\n id={`${item.value}-${index}`}\n >\n {item.label ?? item.value}\n <Button\n onClick={removePillHandler}\n onKeyDownCapture={removePillHandlerWithKeyboard}\n fill=\"text\"\n size=\"sm\"\n variant=\"secondary\"\n className={styles.removeButton}\n tooltip={`Remove filter value - ${item.label ?? item.value}`}\n >\n <Icon name=\"times\" size=\"md\" id={`${item.value}-${index}-close-icon`} />\n </Button>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n basePill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.disabledBackground,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 1, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: theme.spacing(2.75),\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n valuePill: css({\n background: theme.colors.action.selected,\n padding: theme.spacing(0.125, 0, 0.125, 1),\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n height: '100%',\n padding: 0,\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,IAAA;AAAA,EACA,sBAAA;AAAA,EACA,KAAA;AAAA,EACA,wBAAA;AACF,CAA2B,KAAA;AAhB3B,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAiBE,EAAM,MAAA,MAAA,GAAS,WAAW,SA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AAAA,IACzC,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,IACzB,QAAU,EAAA,QAAA;AAAA,IACV,UAAY,EAAA,QAAA;AAAA,IACZ,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,GAC1B,EAAA,KAAA,CAAM,WAAW,SAVR,CAAA,EAAA;AAAA,IAWZ,MAAQ,EAAA,SAAA;AAAA,GACT,CAAA,CAAA;AAAA,EACD,WAAW,GAAI,CAAA;AAAA,IACb,UAAA,EAAY,KAAM,CAAA,MAAA,CAAO,MAAO,CAAA,QAAA;AAAA,IAChC,SAAS,KAAM,CAAA,OAAA,CAAQ,KAAO,EAAA,CAAA,EAAG,OAAO,CAAC,CAAA;AAAA,GAC1C,CAAA;AAAA,EACD,cAAc,GAAI,CAAA;AAAA,IAChB,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC/B,MAAQ,EAAA,MAAA;AAAA,IACR,OAAS,EAAA,CAAA;AAAA,IACT,MAAQ,EAAA,SAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,KAC3B;AAAA,GACD,CAAA;AACH,CAAA,CAAA;;;;"}
|
@@ -167,6 +167,19 @@ const generatePlaceholder = (filter, filterInputType, isMultiValueEdit, isAlways
|
|
167
167
|
}
|
168
168
|
return filter[filterInputType] && !isAlwaysWip ? `${filter[filterInputType]}` : INPUT_PLACEHOLDER;
|
169
169
|
};
|
170
|
+
const populateInputValueOnInputTypeSwitch = ({
|
171
|
+
populateInputOnEdit,
|
172
|
+
item,
|
173
|
+
filterInputType,
|
174
|
+
setInputValue,
|
175
|
+
filter
|
176
|
+
}) => {
|
177
|
+
if (populateInputOnEdit && !isMultiValueOperator(item.value || "") && nextInputTypeMap[filterInputType] === "value") {
|
178
|
+
setInputValue((filter == null ? void 0 : filter.value) || "");
|
179
|
+
} else {
|
180
|
+
setInputValue("");
|
181
|
+
}
|
182
|
+
};
|
170
183
|
|
171
|
-
export { ERROR_STATE_DROPDOWN_WIDTH, VIRTUAL_LIST_ITEM_HEIGHT, VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION, VIRTUAL_LIST_OVERSCAN, flattenOptionGroups, fuzzySearchOptions, generateFilterUpdatePayload, generatePlaceholder, setupDropdownAccessibility, switchInputType, switchToNextInputType };
|
184
|
+
export { ERROR_STATE_DROPDOWN_WIDTH, VIRTUAL_LIST_ITEM_HEIGHT, VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION, VIRTUAL_LIST_OVERSCAN, flattenOptionGroups, fuzzySearchOptions, generateFilterUpdatePayload, generatePlaceholder, populateInputValueOnInputTypeSwitch, setupDropdownAccessibility, switchInputType, switchToNextInputType };
|
172
185
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/utils.ts"],"sourcesContent":["import { SelectableValue } from '@grafana/data';\nimport uFuzzy from '@leeoniya/ufuzzy';\nimport { AdHocInputType } from './AdHocFiltersCombobox';\nimport { AdHocFilterWithLabels, isMultiValueOperator } from '../AdHocFiltersVariable';\n\nconst VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER = 8;\nconst VIRTUAL_LIST_DESCRIPTION_WIDTH_ESTIMATE_MULTIPLIER = 6;\nconst VIRTUAL_LIST_PADDING = 8;\nexport const VIRTUAL_LIST_OVERSCAN = 5;\nexport const VIRTUAL_LIST_ITEM_HEIGHT = 38;\nexport const VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION = 60;\nexport const ERROR_STATE_DROPDOWN_WIDTH = 366;\n\nexport function fuzzySearchOptions(options: Array<SelectableValue<string>>) {\n const ufuzzy = new uFuzzy();\n const haystack: string[] = [];\n const limit = 10000;\n\n return (search: string, filterInputType: AdHocInputType) => {\n if (search === '') {\n if (options.length > limit) {\n return options.slice(0, limit);\n } else {\n return options;\n }\n }\n\n if (filterInputType === 'operator') {\n const filteredOperators = [];\n for (let i = 0; i < options.length; i++) {\n if ((options[i].label || options[i].value)?.includes(search)) {\n filteredOperators.push(options[i]);\n if (filteredOperators.length > limit) {\n return filteredOperators;\n }\n }\n }\n return filteredOperators;\n }\n\n if (haystack.length === 0) {\n for (let i = 0; i < options.length; i++) {\n haystack.push(options[i].label || options[i].value!);\n }\n }\n const [idxs, info, order] = ufuzzy.search(haystack, search);\n const filteredOptions: Array<SelectableValue<string>> = [];\n\n if (idxs) {\n for (let i = 0; i < idxs.length; i++) {\n if (info && order) {\n const idx = order[i];\n filteredOptions.push(options[idxs[idx]]);\n } else {\n filteredOptions.push(options[idxs[i]]);\n }\n\n if (filteredOptions.length > limit) {\n return filteredOptions;\n }\n }\n return filteredOptions;\n }\n\n if (options.length > limit) {\n return options.slice(0, limit);\n }\n\n return options;\n };\n}\nexport const flattenOptionGroups = (options: Array<SelectableValue<string>>) =>\n options.flatMap<SelectableValue<string>>((option) => (option.options ? [option, ...option.options] : [option]));\n\nexport const setupDropdownAccessibility = (\n options: Array<SelectableValue<string>>,\n listRef: React.MutableRefObject<Array<HTMLElement | null>>,\n disabledIndicesRef: React.MutableRefObject<number[]>\n) => {\n let maxOptionWidth = 182;\n const listRefArr = [];\n const disabledIndices = [];\n\n for (let i = 0; i < options.length; i++) {\n // listRefArr should be filled with nulls for amount of dropdown items so that\n // useNavigationList sets activeIndex correctly when navigating with arrow keys\n listRefArr.push(null);\n\n // disabledIndices are used to skip unselectable group items in dropdown when\n // navigating with arrow keys\n if (options[i]?.options) {\n disabledIndices.push(i);\n }\n let label = options[i].label ?? options[i].value ?? '';\n let multiplierToUse = VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER;\n if (\n label.length * VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER <\n (options[i].description?.length || 0) * VIRTUAL_LIST_DESCRIPTION_WIDTH_ESTIMATE_MULTIPLIER\n ) {\n label = options[i].description!;\n multiplierToUse = VIRTUAL_LIST_DESCRIPTION_WIDTH_ESTIMATE_MULTIPLIER;\n }\n\n // rough widthEstimate\n const widthEstimate =\n (options[i].isCustom ? label.length + 18 : label.length) * multiplierToUse + VIRTUAL_LIST_PADDING * 2;\n if (widthEstimate > maxOptionWidth) {\n maxOptionWidth = widthEstimate;\n }\n }\n\n listRef.current = [...listRefArr];\n disabledIndicesRef.current = [...disabledIndices];\n return maxOptionWidth;\n};\n\nconst nextInputTypeMap = {\n key: 'operator',\n operator: 'value',\n value: 'key',\n} as const;\n\nexport const switchToNextInputType = (\n filterInputType: AdHocInputType,\n setInputType: React.Dispatch<React.SetStateAction<AdHocInputType>>,\n handleChangeViewMode: ((event?: React.MouseEvent, shouldFocusOnFilterPill?: boolean) => void) | undefined,\n element: HTMLInputElement | null,\n shouldFocusOnPillWrapperOverride?: boolean\n) =>\n switchInputType(\n nextInputTypeMap[filterInputType],\n setInputType,\n filterInputType === 'value' ? handleChangeViewMode : undefined,\n element,\n shouldFocusOnPillWrapperOverride\n );\n\nexport const switchInputType = (\n filterInputType: AdHocInputType,\n setInputType: React.Dispatch<React.SetStateAction<AdHocInputType>>,\n handleChangeViewMode?: (event?: React.MouseEvent, shouldFocusOnFilterPill?: boolean) => void,\n element?: HTMLInputElement | null,\n shouldFocusOnPillWrapperOverride?: boolean\n) => {\n setInputType(filterInputType);\n\n handleChangeViewMode?.(undefined, shouldFocusOnPillWrapperOverride);\n\n setTimeout(() => element?.focus());\n};\n\nexport const generateFilterUpdatePayload = ({\n filterInputType,\n item,\n filter,\n setFilterMultiValues,\n}: {\n filterInputType: AdHocInputType;\n item: SelectableValue<string>;\n filter: AdHocFilterWithLabels;\n setFilterMultiValues: (value: React.SetStateAction<Array<SelectableValue<string>>>) => void;\n}): Partial<AdHocFilterWithLabels> => {\n if (filterInputType === 'key') {\n return {\n key: item.value,\n keyLabel: item.label ? item.label : item.value,\n };\n }\n if (filterInputType === 'value') {\n return {\n value: item.value,\n valueLabels: [item.label ? item.label : item.value!],\n };\n }\n\n if (filterInputType === 'operator') {\n // handle values/valueLabels when switching from multi to single value operator\n if (isMultiValueOperator(filter.operator) && !isMultiValueOperator(item.value!)) {\n // reset local multi values state\n setFilterMultiValues([]);\n // update operator and reset values and valueLabels\n return {\n operator: item.value,\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n valueLabels: [filter.valueLabels?.[0] || filter.values?.[0] || filter.value],\n //@ts-expect-error\n values: undefined,\n };\n }\n\n // handle values/valueLabels when switching from single to multi value operator\n if (isMultiValueOperator(item.value!) && !isMultiValueOperator(filter.operator)) {\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const valueLabels = [filter.valueLabels?.[0] || filter.values?.[0] || filter.value];\n const values = [filter.value];\n\n // populate local multi values state\n if (values[0]) {\n setFilterMultiValues([\n {\n value: values[0],\n label: valueLabels?.[0] ?? values[0],\n },\n ]);\n }\n\n // update operator and default values and valueLabels\n return {\n operator: item.value,\n valueLabels: valueLabels,\n //@ts-expect-error\n values: values,\n };\n }\n }\n\n // default operator update of same multi/single type\n return {\n [filterInputType]: item.value,\n };\n};\n\nconst INPUT_PLACEHOLDER = 'Filter by label values';\n\nexport const generatePlaceholder = (\n filter: AdHocFilterWithLabels,\n filterInputType: AdHocInputType,\n isMultiValueEdit: boolean,\n isAlwaysWip?: boolean\n) => {\n if (filterInputType === 'key') {\n return INPUT_PLACEHOLDER;\n }\n if (filterInputType === 'value') {\n if (isMultiValueEdit) {\n return 'Edit values';\n }\n return filter.valueLabels?.[0] || '';\n }\n\n return filter[filterInputType] && !isAlwaysWip ? `${filter[filterInputType]}` : INPUT_PLACEHOLDER;\n};\n"],"names":[],"mappings":";;;AAKA,MAAM,sCAAyC,GAAA,CAAA,CAAA;AAC/C,MAAM,kDAAqD,GAAA,CAAA,CAAA;AAC3D,MAAM,oBAAuB,GAAA,CAAA,CAAA;AACtB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,GAAA,EAAA,CAAqB,CAAM,CAAA,KAAA,EAAA,CAAA;AAAA,GACpC;AAEA,EAAA,OAAO,OAAO,eAAoB,CAAA,IAAA,CAAC,WAAc,GAAA,CAAA,EAAG,OAAO,eAAqB,CAAA,CAAA,CAAA,GAAA,iBAAA,CAAA;AAClF;;;;"}
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/utils.ts"],"sourcesContent":["import { SelectableValue } from '@grafana/data';\nimport uFuzzy from '@leeoniya/ufuzzy';\nimport { AdHocInputType } from './AdHocFiltersCombobox';\nimport { AdHocFilterWithLabels, isMultiValueOperator } from '../AdHocFiltersVariable';\n\nconst VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER = 8;\nconst VIRTUAL_LIST_DESCRIPTION_WIDTH_ESTIMATE_MULTIPLIER = 6;\nconst VIRTUAL_LIST_PADDING = 8;\nexport const VIRTUAL_LIST_OVERSCAN = 5;\nexport const VIRTUAL_LIST_ITEM_HEIGHT = 38;\nexport const VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION = 60;\nexport const ERROR_STATE_DROPDOWN_WIDTH = 366;\n\nexport function fuzzySearchOptions(options: Array<SelectableValue<string>>) {\n const ufuzzy = new uFuzzy();\n const haystack: string[] = [];\n const limit = 10000;\n\n return (search: string, filterInputType: AdHocInputType) => {\n if (search === '') {\n if (options.length > limit) {\n return options.slice(0, limit);\n } else {\n return options;\n }\n }\n\n if (filterInputType === 'operator') {\n const filteredOperators = [];\n for (let i = 0; i < options.length; i++) {\n if ((options[i].label || options[i].value)?.includes(search)) {\n filteredOperators.push(options[i]);\n if (filteredOperators.length > limit) {\n return filteredOperators;\n }\n }\n }\n return filteredOperators;\n }\n\n if (haystack.length === 0) {\n for (let i = 0; i < options.length; i++) {\n haystack.push(options[i].label || options[i].value!);\n }\n }\n const [idxs, info, order] = ufuzzy.search(haystack, search);\n const filteredOptions: Array<SelectableValue<string>> = [];\n\n if (idxs) {\n for (let i = 0; i < idxs.length; i++) {\n if (info && order) {\n const idx = order[i];\n filteredOptions.push(options[idxs[idx]]);\n } else {\n filteredOptions.push(options[idxs[i]]);\n }\n\n if (filteredOptions.length > limit) {\n return filteredOptions;\n }\n }\n return filteredOptions;\n }\n\n if (options.length > limit) {\n return options.slice(0, limit);\n }\n\n return options;\n };\n}\nexport const flattenOptionGroups = (options: Array<SelectableValue<string>>) =>\n options.flatMap<SelectableValue<string>>((option) => (option.options ? [option, ...option.options] : [option]));\n\nexport const setupDropdownAccessibility = (\n options: Array<SelectableValue<string>>,\n listRef: React.MutableRefObject<Array<HTMLElement | null>>,\n disabledIndicesRef: React.MutableRefObject<number[]>\n) => {\n let maxOptionWidth = 182;\n const listRefArr = [];\n const disabledIndices = [];\n\n for (let i = 0; i < options.length; i++) {\n // listRefArr should be filled with nulls for amount of dropdown items so that\n // useNavigationList sets activeIndex correctly when navigating with arrow keys\n listRefArr.push(null);\n\n // disabledIndices are used to skip unselectable group items in dropdown when\n // navigating with arrow keys\n if (options[i]?.options) {\n disabledIndices.push(i);\n }\n let label = options[i].label ?? options[i].value ?? '';\n let multiplierToUse = VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER;\n if (\n label.length * VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER <\n (options[i].description?.length || 0) * VIRTUAL_LIST_DESCRIPTION_WIDTH_ESTIMATE_MULTIPLIER\n ) {\n label = options[i].description!;\n multiplierToUse = VIRTUAL_LIST_DESCRIPTION_WIDTH_ESTIMATE_MULTIPLIER;\n }\n\n // rough widthEstimate\n const widthEstimate =\n (options[i].isCustom ? label.length + 18 : label.length) * multiplierToUse + VIRTUAL_LIST_PADDING * 2;\n if (widthEstimate > maxOptionWidth) {\n maxOptionWidth = widthEstimate;\n }\n }\n\n listRef.current = [...listRefArr];\n disabledIndicesRef.current = [...disabledIndices];\n return maxOptionWidth;\n};\n\nconst nextInputTypeMap = {\n key: 'operator',\n operator: 'value',\n value: 'key',\n} as const;\n\nexport const switchToNextInputType = (\n filterInputType: AdHocInputType,\n setInputType: React.Dispatch<React.SetStateAction<AdHocInputType>>,\n handleChangeViewMode: ((event?: React.MouseEvent, shouldFocusOnFilterPill?: boolean) => void) | undefined,\n element: HTMLInputElement | null,\n shouldFocusOnPillWrapperOverride?: boolean\n) =>\n switchInputType(\n nextInputTypeMap[filterInputType],\n setInputType,\n filterInputType === 'value' ? handleChangeViewMode : undefined,\n element,\n shouldFocusOnPillWrapperOverride\n );\n\nexport const switchInputType = (\n filterInputType: AdHocInputType,\n setInputType: React.Dispatch<React.SetStateAction<AdHocInputType>>,\n handleChangeViewMode?: (event?: React.MouseEvent, shouldFocusOnFilterPill?: boolean) => void,\n element?: HTMLInputElement | null,\n shouldFocusOnPillWrapperOverride?: boolean\n) => {\n setInputType(filterInputType);\n\n handleChangeViewMode?.(undefined, shouldFocusOnPillWrapperOverride);\n\n setTimeout(() => element?.focus());\n};\n\nexport const generateFilterUpdatePayload = ({\n filterInputType,\n item,\n filter,\n setFilterMultiValues,\n}: {\n filterInputType: AdHocInputType;\n item: SelectableValue<string>;\n filter: AdHocFilterWithLabels;\n setFilterMultiValues: (value: React.SetStateAction<Array<SelectableValue<string>>>) => void;\n}): Partial<AdHocFilterWithLabels> => {\n if (filterInputType === 'key') {\n return {\n key: item.value,\n keyLabel: item.label ? item.label : item.value,\n };\n }\n if (filterInputType === 'value') {\n return {\n value: item.value,\n valueLabels: [item.label ? item.label : item.value!],\n };\n }\n\n if (filterInputType === 'operator') {\n // handle values/valueLabels when switching from multi to single value operator\n if (isMultiValueOperator(filter.operator) && !isMultiValueOperator(item.value!)) {\n // reset local multi values state\n setFilterMultiValues([]);\n // update operator and reset values and valueLabels\n return {\n operator: item.value,\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n valueLabels: [filter.valueLabels?.[0] || filter.values?.[0] || filter.value],\n //@ts-expect-error\n values: undefined,\n };\n }\n\n // handle values/valueLabels when switching from single to multi value operator\n if (isMultiValueOperator(item.value!) && !isMultiValueOperator(filter.operator)) {\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const valueLabels = [filter.valueLabels?.[0] || filter.values?.[0] || filter.value];\n const values = [filter.value];\n\n // populate local multi values state\n if (values[0]) {\n setFilterMultiValues([\n {\n value: values[0],\n label: valueLabels?.[0] ?? values[0],\n },\n ]);\n }\n\n // update operator and default values and valueLabels\n return {\n operator: item.value,\n valueLabels: valueLabels,\n //@ts-expect-error\n values: values,\n };\n }\n }\n\n // default operator update of same multi/single type\n return {\n [filterInputType]: item.value,\n };\n};\n\nconst INPUT_PLACEHOLDER = 'Filter by label values';\n\nexport const generatePlaceholder = (\n filter: AdHocFilterWithLabels,\n filterInputType: AdHocInputType,\n isMultiValueEdit: boolean,\n isAlwaysWip?: boolean\n) => {\n if (filterInputType === 'key') {\n return INPUT_PLACEHOLDER;\n }\n if (filterInputType === 'value') {\n if (isMultiValueEdit) {\n return 'Edit values';\n }\n return filter.valueLabels?.[0] || '';\n }\n\n return filter[filterInputType] && !isAlwaysWip ? `${filter[filterInputType]}` : INPUT_PLACEHOLDER;\n};\n\nexport const populateInputValueOnInputTypeSwitch = ({\n populateInputOnEdit,\n item,\n filterInputType,\n setInputValue,\n filter,\n}: {\n populateInputOnEdit: boolean | undefined;\n item: SelectableValue<string>;\n filterInputType: AdHocInputType;\n setInputValue: (value: React.SetStateAction<string>) => void;\n filter: AdHocFilterWithLabels | undefined;\n}) => {\n if (populateInputOnEdit && !isMultiValueOperator(item.value || '') && nextInputTypeMap[filterInputType] === 'value') {\n setInputValue(filter?.value || '');\n } else {\n setInputValue('');\n }\n};\n"],"names":[],"mappings":";;;AAKA,MAAM,sCAAyC,GAAA,CAAA,CAAA;AAC/C,MAAM,kDAAqD,GAAA,CAAA,CAAA;AAC3D,MAAM,oBAAuB,GAAA,CAAA,CAAA;AACtB,MAAM,qBAAwB,GAAA,EAAA;AAC9B,MAAM,wBAA2B,GAAA,GAAA;AACjC,M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EAAA,OAAO,OAAO,eAAoB,CAAA,IAAA,CAAC,WAAc,GAAA,CAAA,EAAG,OAAO,eAAqB,CAAA,CAAA,CAAA,GAAA,iBAAA,CAAA;AAClF,EAAA;AAEO,MAAM,sCAAsC,CAAC;AAAA,EAClD,mBAAA;AAAA,EACA,IAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AACF,CAMM,KAAA;AACJ,EAAI,IAAA,mBAAA,IAAuB,CAAC,oBAAqB,CAAA,IAAA,CAAK,SAAS,EAAE,CAAA,IAAK,gBAAiB,CAAA,eAAA,CAAA,KAAqB,OAAS,EAAA;AACnH,IAAc,aAAA,CAAA,CAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAQ,UAAS,EAAE,CAAA,CAAA;AAAA,GAC5B,MAAA;AACL,IAAA,aAAA,CAAc,EAAE,CAAA,CAAA;AAAA,GAClB;AACF;;;;"}
|
@@ -12,6 +12,9 @@ class UrlTimeRangeMacro {
|
|
12
12
|
var _a;
|
13
13
|
const timeRange = getTimeRange(this._sceneObject);
|
14
14
|
const urlState = (_a = timeRange.urlSync) == null ? void 0 : _a.getUrlState();
|
15
|
+
if ((urlState == null ? void 0 : urlState.timezone) === "browser") {
|
16
|
+
urlState.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
17
|
+
}
|
15
18
|
return new SkipFormattingValue(urlUtil.toUrlParams(urlState));
|
16
19
|
}
|
17
20
|
getValueText() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"timeMacros.js","sources":["../../../../src/variables/macros/timeMacros.ts"],"sourcesContent":["import { dateTimeFormat, urlUtil } from '@grafana/data';\nimport { getTimeRange } from '../../core/sceneGraph/getTimeRange';\nimport { getData } from '../../core/sceneGraph/sceneGraph';\nimport { SceneObject } from '../../core/types';\nimport { FormatVariable } from '../interpolation/formatRegistry';\nimport { SkipFormattingValue } from './types';\n\n/**\n * Handles expressions like $__url_time_range.\n */\nexport class UrlTimeRangeMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'url_variable' };\n this._sceneObject = sceneObject;\n }\n\n public getValue(): SkipFormattingValue {\n const timeRange = getTimeRange(this._sceneObject);\n const urlState = timeRange.urlSync?.getUrlState();\n return new SkipFormattingValue(urlUtil.toUrlParams(urlState));\n }\n\n public getValueText?(): string {\n return '';\n }\n}\n\n/**\n * Handles expressions like $__from and $__to.\n */\nexport class TimeFromAndToMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'time_macro' };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const timeRange = getTimeRange(this._sceneObject);\n if (this.state.name === '__from') {\n return timeRange.state.value.from.valueOf();\n } else {\n return timeRange.state.value.to.valueOf();\n }\n }\n\n public getValueText?(): string {\n const timeRange = getTimeRange(this._sceneObject);\n if (this.state.name === '__from') {\n return dateTimeFormat(timeRange.state.value.from, { timeZone: timeRange.getTimeZone() });\n } else {\n return dateTimeFormat(timeRange.state.value.to, { timeZone: timeRange.getTimeZone() });\n }\n }\n}\n\n/**\n * Handles $__timezone expression.\n */\nexport class TimezoneMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'time_macro' };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const timeRange = getTimeRange(this._sceneObject);\n const timeZone = timeRange.getTimeZone();\n\n if (timeZone === 'browser') {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n return timeZone;\n }\n\n public getValueText?(): string {\n return this.getValue();\n }\n}\n\n/**\n * Handles $__interval and $__intervalMs expression.\n */\nexport class IntervalMacro implements FormatVariable {\n public state: { name: string; type: string; match: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject, match: string) {\n this.state = { name: name, type: 'time_macro', match: match };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const data = getData(this._sceneObject);\n\n if (data) {\n const request = data.state.data?.request;\n if (!request) {\n return this.state.match;\n }\n if (this.state.name === '__interval_ms') {\n return request.intervalMs;\n }\n return request.interval;\n }\n\n return this.state.match;\n }\n}\n"],"names":[],"mappings":";;;;;AAUO,MAAM,iBAA4C,CAAA;AAAA,EAIhD,WAAA,CAAY,MAAc,WAA0B,EAAA;AACzD,IAAA,IAAA,CAAK,KAAQ,GAAA,EAAE,IAAY,EAAA,IAAA,EAAM,cAAe,EAAA,CAAA;AAChD,IAAA,IAAA,CAAK,YAAe,GAAA,WAAA,CAAA;AAAA,GACtB;AAAA,EAEO,QAAgC,GAAA;AAnBzC,IAAA,IAAA,EAAA,CAAA;AAoBI,IAAM,MAAA,SAAA,GAAY,YAAa,CAAA,IAAA,CAAK,YAAY,CAAA,CAAA;AAChD,IAAM,MAAA,QAAA,GAAA,CAAW,EAAU,GAAA,SAAA,CAAA,OAAA,KAAV,IAAmB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,EAAA,CAAA;AACpC,IAAA,OAAO,IAAI,mBAAA,CAAoB,OAAQ,CAAA,WAAA,CAAY,QAAQ,CAAC,CAAA,CAAA;AAAA,GAC9D;AAAA,EAEO,YAAwB,GAAA;AAC7B,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AACF,CAAA;AAKO,MAAM,kBAA6C,CAAA;AAAA,EAIjD,WAAA,CAAY,MAAc,WAA0B,EAAA;AACzD,IAAA,IAAA,CAAK,KAAQ,GAAA,EAAE,IAAY,EAAA,IAAA,EAAM,YAAa,EAAA,CAAA;AAC9C,IAAA,IAAA,CAAK,YAAe,GAAA,WAAA,CAAA;AAAA,GACtB;AAAA,EAEO,QAAW,GAAA;AAChB,IAAM,MAAA,SAAA,GAAY,YAAa,CAAA,IAAA,CAAK,YAAY,CAAA,CAAA;AAChD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,CAAA,QAAA,CAAA;AAAA,KACjD;AAEA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AAAA,EAEO,YAAwB,GAAA;AAC7B,IAAA,OAAO,KAAK,QAAS,EAAA,CAAA;AAAA,GACvB;AACF,CAAA;AAKO,MAAM,aAAwC,CAAA;AAAA,EAI5C,WAAA,CAAY,IAAc,EAAA,WAAA,EAA0B,KAAe,EAAA;AACxE,IAAA,IAAA,CAAK,KAAQ,GAAA,EAAE,IAAY,EAAA,IAAA,EAAM,cAAc,KAAa,EAAA,CAAA;AAC5D,IAAA,IAAA,CAAK,YAAe,GAAA,WAAA,CAAA;AAAA,GACtB;AAAA,EAEO,QAAW,GAAA;
|
1
|
+
{"version":3,"file":"timeMacros.js","sources":["../../../../src/variables/macros/timeMacros.ts"],"sourcesContent":["import { dateTimeFormat, urlUtil } from '@grafana/data';\nimport { getTimeRange } from '../../core/sceneGraph/getTimeRange';\nimport { getData } from '../../core/sceneGraph/sceneGraph';\nimport { SceneObject } from '../../core/types';\nimport { FormatVariable } from '../interpolation/formatRegistry';\nimport { SkipFormattingValue } from './types';\n\n/**\n * Handles expressions like $__url_time_range.\n */\nexport class UrlTimeRangeMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'url_variable' };\n this._sceneObject = sceneObject;\n }\n\n public getValue(): SkipFormattingValue {\n const timeRange = getTimeRange(this._sceneObject);\n const urlState = timeRange.urlSync?.getUrlState();\n if (urlState?.timezone === 'browser') {\n urlState.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n return new SkipFormattingValue(urlUtil.toUrlParams(urlState));\n }\n\n public getValueText?(): string {\n return '';\n }\n}\n\n/**\n * Handles expressions like $__from and $__to.\n */\nexport class TimeFromAndToMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'time_macro' };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const timeRange = getTimeRange(this._sceneObject);\n if (this.state.name === '__from') {\n return timeRange.state.value.from.valueOf();\n } else {\n return timeRange.state.value.to.valueOf();\n }\n }\n\n public getValueText?(): string {\n const timeRange = getTimeRange(this._sceneObject);\n if (this.state.name === '__from') {\n return dateTimeFormat(timeRange.state.value.from, { timeZone: timeRange.getTimeZone() });\n } else {\n return dateTimeFormat(timeRange.state.value.to, { timeZone: timeRange.getTimeZone() });\n }\n }\n}\n\n/**\n * Handles $__timezone expression.\n */\nexport class TimezoneMacro implements FormatVariable {\n public state: { name: string; type: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject) {\n this.state = { name: name, type: 'time_macro' };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const timeRange = getTimeRange(this._sceneObject);\n const timeZone = timeRange.getTimeZone();\n\n if (timeZone === 'browser') {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n return timeZone;\n }\n\n public getValueText?(): string {\n return this.getValue();\n }\n}\n\n/**\n * Handles $__interval and $__intervalMs expression.\n */\nexport class IntervalMacro implements FormatVariable {\n public state: { name: string; type: string; match: string };\n private _sceneObject: SceneObject;\n\n public constructor(name: string, sceneObject: SceneObject, match: string) {\n this.state = { name: name, type: 'time_macro', match: match };\n this._sceneObject = sceneObject;\n }\n\n public getValue() {\n const data = getData(this._sceneObject);\n\n if (data) {\n const request = data.state.data?.request;\n if (!request) {\n return this.state.match;\n }\n if (this.state.name === '__interval_ms') {\n return request.intervalMs;\n }\n return request.interval;\n }\n\n return this.state.match;\n }\n}\n"],"names":[],"mappings":";;;;;AAUO,MAAM,iBAA4C,CAAA;AAAA,EAIhD,WAAA,CAAY,MAAc,WAA0B,EAAA;AACzD,IAAA,IAAA,CAAK,KAAQ,GAAA,EAAE,IAAY,EAAA,IAAA,EAAM,cAAe,EAAA,CAAA;AAChD,IAAA,IAAA,CAAK,YAAe,GAAA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