@grafana/scenes 5.23.4--canary.964.11745806385.0 β†’ 5.24.0--canary.960.11775742614.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,31 +1,3 @@
1
- # v5.23.3 (Fri Nov 08 2024)
2
-
3
- #### πŸ› Bug Fix
4
-
5
- - VariableLabel: change variable label check to OR instead of ?? [#963](https://github.com/grafana/scenes/pull/963) ([@Sergej-Vlasov](https://github.com/Sergej-Vlasov))
6
- - GroupByVariable: Support custom filter keys [#865](https://github.com/grafana/scenes/pull/865) ([@andreaalopez](https://github.com/andreaalopez))
7
-
8
- #### Authors: 2
9
-
10
- - [@Sergej-Vlasov](https://github.com/Sergej-Vlasov)
11
- - Andrea Lopez ([@andreaalopez](https://github.com/andreaalopez))
12
-
13
- ---
14
-
15
- # v5.23.2 (Fri Nov 08 2024)
16
-
17
- #### πŸ› Bug Fix
18
-
19
- - Variables: Saved default all value with non multi select fix [#959](https://github.com/grafana/scenes/pull/959) ([@torkelo](https://github.com/torkelo))
20
- - ScenesReact: Cache SceneQueryRunners and other scene object by a key / hashing string [#788](https://github.com/grafana/scenes/pull/788) ([@torkelo](https://github.com/torkelo) [@mdvictor](https://github.com/mdvictor))
21
-
22
- #### Authors: 2
23
-
24
- - Torkel Γ–degaard ([@torkelo](https://github.com/torkelo))
25
- - Victor Marin ([@mdvictor](https://github.com/mdvictor))
26
-
27
- ---
28
-
29
1
  # v5.23.1 (Wed Nov 06 2024)
30
2
 
31
3
  #### πŸ› Bug Fix
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../src/core/types.ts"],"sourcesContent":["import React from 'react';\nimport { MonoTypeOperatorFunction, Observable, Unsubscribable } from 'rxjs';\n\nimport {\n BusEvent,\n BusEventHandler,\n BusEventType,\n DataFrame,\n DataQueryRequest,\n DataSourceGetTagKeysOptions,\n DataSourceGetTagValuesOptions,\n DataTransformContext,\n PanelData,\n TimeRange,\n} from '@grafana/data';\nimport { DataQuery, DataTopic, TimeZone } from '@grafana/schema';\n\nimport { SceneVariableDependencyConfigLike, SceneVariables } from '../variables/types';\nimport { SceneObjectRef } from './SceneObjectRef';\n\nexport interface SceneObjectState {\n key?: string;\n $timeRange?: SceneTimeRangeLike;\n $data?: SceneDataProvider;\n $variables?: SceneVariables;\n /**\n * @experimental\n * Can be used to add extra behaviors to a scene object.\n * These are activated when the their parent scene object is activated.\n */\n $behaviors?: Array<SceneObject | SceneStatelessBehavior>;\n}\n\nexport interface SceneLayoutChildOptions {\n width?: number | string;\n height?: number | string;\n xSizing?: 'fill' | 'content';\n ySizing?: 'fill' | 'content';\n x?: number;\n y?: number;\n minWidth?: number | string;\n minHeight?: number | string;\n isDraggable?: boolean;\n isResizable?: boolean;\n}\n\nexport interface SceneComponentProps<T> {\n model: T;\n}\n\nexport type SceneComponent<TModel> = (props: SceneComponentProps<TModel>) => React.ReactElement | null;\n\nexport interface SceneDataState extends SceneObjectState {\n data?: PanelData;\n}\n\nexport interface SceneObject<TState extends SceneObjectState = SceneObjectState> {\n /** The current state */\n readonly state: TState;\n\n /** True when there is a React component mounted for this Object */\n readonly isActive: boolean;\n\n /** SceneObject parent */\n readonly parent?: SceneObject;\n\n /** This abtractions declares what variables the scene object depends on and how to handle when they change value. **/\n readonly variableDependency?: SceneVariableDependencyConfigLike;\n\n /** This abstraction declares URL sync dependencies of a scene object. **/\n readonly urlSync?: SceneObjectUrlSyncHandler;\n\n /** Subscribe to state changes */\n subscribeToState(handler: SceneStateChangedHandler<TState>): Unsubscribable;\n\n /** Subscribe to a scene event */\n subscribeToEvent<T extends BusEvent>(typeFilter: BusEventType<T>, handler: BusEventHandler<T>): Unsubscribable;\n\n /** Publish an event and optionally bubble it up the scene */\n publishEvent(event: BusEvent, bubble?: boolean): void;\n\n /** Utility hook that wraps useObservable. Used by React components to subscribes to state changes */\n useState(): TState;\n\n /** How to modify state */\n setState(state: Partial<TState>): void;\n\n /**\n * Called when the Component is mounted. This will also activate any $data, $variables or $timeRange scene object on this level.\n * Don't override this in your custom SceneObjects, instead use addActivationHandler from the constructor.\n **/\n activate(): CancelActivationHandler;\n\n /** Get the scene root */\n getRoot(): SceneObject;\n\n /** Returns a deep clone this object and all its children */\n clone(state?: Partial<TState>): this;\n\n /** A React component to use for rendering the object */\n Component(props: SceneComponentProps<SceneObject<TState>>): React.ReactElement | null;\n\n /** Force a re-render, should only be needed when variable values change */\n forceRender(): void;\n\n /** Returns a SceneObjectRef that will resolve to this object */\n getRef(): SceneObjectRef<this>;\n\n /**\n * Allows external code to register code that is executed on activate and deactivate. This allow you\n * to wire up scene objects that need to respond to state changes in other objects from the outside.\n **/\n addActivationHandler(handler: SceneActivationHandler): void;\n\n /**\n * Loop through state and call callback for each direct child scene object.\n * Checks 1 level deep properties and arrays. So a scene object hidden in a nested plain object will not be detected.\n */\n forEachChild(callback: (child: SceneObject) => void): void;\n\n /**\n * Useful for edge cases when you want to move a scene object to another parent.\n */\n clearParent(): void;\n}\n\nexport type SceneActivationHandler = () => SceneDeactivationHandler | void;\nexport type SceneDeactivationHandler = () => void;\n\n/**\n * Function returned by activate() that when called will deactivate the object if it's the last activator\n **/\nexport type CancelActivationHandler = () => void;\n\nexport interface SceneLayoutState extends SceneObjectState {\n children: SceneObject[];\n}\n\nexport interface SceneLayout<T extends SceneLayoutState = SceneLayoutState> extends SceneObject<T> {\n isDraggable(): boolean;\n getDragClass?(): string;\n getDragClassCancel?(): string;\n}\n\nexport interface SceneTimeRangeState extends SceneObjectState {\n from: string;\n to: string;\n fiscalYearStartMonth?: number;\n value: TimeRange;\n timeZone?: TimeZone;\n /** weekStart will change the global date locale so having multiple different weekStart values is not supported */\n weekStart?: string;\n /**\n * @internal\n * To enable feature parity with the old time range picker, not sure if it will be kept.\n * Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.\n * */\n UNSAFE_nowDelay?: string;\n\n refreshOnActivate?: {\n /**\n * When set, the time range will invalidate relative ranges after the specified interval has elapsed\n */\n afterMs?: number;\n /**\n * When set, the time range will invalidate relative ranges after the specified percentage of the current interval has elapsed.\n * If both invalidate values are set, the smaller value will be used for the given interval.\n */\n percent?: number;\n };\n}\n\nexport interface SceneTimeRangeLike extends SceneObject<SceneTimeRangeState> {\n onTimeZoneChange(timeZone: TimeZone): void;\n onTimeRangeChange(timeRange: TimeRange): void;\n onRefresh(): void;\n getTimeZone(): TimeZone;\n}\n\nexport function isSceneObject(obj: any): obj is SceneObject {\n return obj.useState !== undefined;\n}\n\nexport interface SceneObjectWithUrlSync extends SceneObject {\n getUrlState(): SceneObjectUrlValues;\n updateFromUrl(values: SceneObjectUrlValues): void;\n shouldCreateHistoryStep?(values: SceneObjectUrlValues): boolean;\n}\n\nexport interface SceneObjectUrlSyncHandler {\n getKeys(): string[];\n getUrlState(): SceneObjectUrlValues;\n updateFromUrl(values: SceneObjectUrlValues): void;\n shouldCreateHistoryStep?(values: SceneObjectUrlValues): boolean;\n}\n\nexport interface DataRequestEnricher {\n // Return partial data query request that will be merged with the original request provided by SceneQueryRunner\n enrichDataRequest(source: SceneObject): Partial<DataQueryRequest> | null;\n}\n\nexport interface FiltersRequestEnricher {\n // Return partial getTagKeys or getTagValues query request that will be merged with the original request provided by ad hoc or group by variable\n enrichFiltersRequest(\n source: SceneObject\n ): Partial<DataSourceGetTagKeysOptions | DataSourceGetTagValuesOptions> | null;\n}\n\nexport function isDataRequestEnricher(obj: any): obj is DataRequestEnricher {\n return 'enrichDataRequest' in obj;\n}\n\nexport function isFiltersRequestEnricher(obj: any): obj is FiltersRequestEnricher {\n return 'enrichFiltersRequest' in obj;\n}\n\nexport type SceneObjectUrlValue = string | string[] | undefined | null;\nexport type SceneObjectUrlValues = Record<string, SceneObjectUrlValue>;\n\nexport type CustomTransformOperator = (context: DataTransformContext) => MonoTypeOperatorFunction<DataFrame[]>;\nexport type CustomTransformerDefinition =\n | { operator: CustomTransformOperator; topic: DataTopic }\n | CustomTransformOperator;\nexport type SceneStateChangedHandler<TState> = (newState: TState, prevState: TState) => void;\n\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nexport interface SceneDataProviderResult {\n data: PanelData;\n origin: SceneDataProvider;\n}\n\nexport interface SceneDataProvider<T extends SceneObjectState = SceneDataState> extends SceneObject<T> {\n setContainerWidth?: (width: number) => void;\n isDataReadyToDisplay?: () => boolean;\n cancelQuery?: () => void;\n getResultsStream(): Observable<SceneDataProviderResult>;\n}\n\nexport interface SceneDataLayerProviderState extends SceneDataState {\n name: string;\n description?: string;\n isEnabled?: boolean;\n isHidden?: boolean;\n}\n\nexport interface SceneDataLayerProvider extends SceneDataProvider<SceneDataLayerProviderState> {\n isDataLayer: true;\n}\n\nexport function isDataLayer(obj: SceneObject): obj is SceneDataLayerProvider {\n return 'isDataLayer' in obj;\n}\n\nexport interface DataLayerFilter {\n panelId: number;\n}\n\nexport interface SceneStatelessBehavior<T extends SceneObject = any> {\n (sceneObject: T): CancelActivationHandler | void;\n}\n\nexport type ControlsLayout = 'horizontal' | 'vertical';\n\nexport interface UseStateHookOptions {\n /**\n * For some edge cases other scene objects want to subscribe to scene object state for objects\n * that are not active, or whose main React Component can be un-mounted. Set this to true\n * to keep the scene object active even if the React component is unmounted.\n *\n * Normally you would not need this but this can be useful in some edge cases.\n *\n * @experimental\n */\n shouldActivateOrKeepAlive?: boolean;\n}\n\nexport interface SceneDataQuery extends DataQuery {\n [key: string]: any;\n\n // Opt this query out of time window comparison\n timeRangeCompare?: boolean;\n}\n\nexport interface SceneUrlSyncOptions {\n /**\n * This will update the url to contain all scene url state\n * when the scene is initialized. Important for browser history \"back\" actions.\n */\n updateUrlOnInit?: boolean;\n /**\n * This is only supported by some objects if they implement\n * shouldCreateHistoryStep where they can control what changes\n * url changes should add a new browser history entry.\n */\n createBrowserHistorySteps?: boolean;\n}\n"],"names":[],"mappings":"AAmLO,SAAS,cAAc,GAA8B,EAAA;AAC1D,EAAA,OAAO,IAAI,QAAa,KAAA,KAAA,CAAA,CAAA;AAC1B,CAAA;AA2BO,SAAS,sBAAsB,GAAsC,EAAA;AAC1E,EAAA,OAAO,mBAAuB,IAAA,GAAA,CAAA;AAChC,CAAA;AAEO,SAAS,yBAAyB,GAAyC,EAAA;AAChF,EAAA,OAAO,sBAA0B,IAAA,GAAA,CAAA;AACnC,CAAA;AAsCO,SAAS,YAAY,GAAiD,EAAA;AAC3E,EAAA,OAAO,aAAiB,IAAA,GAAA,CAAA;AAC1B;;;;"}
1
+ {"version":3,"file":"types.js","sources":["../../../src/core/types.ts"],"sourcesContent":["import React from 'react';\nimport { MonoTypeOperatorFunction, Observable, Unsubscribable } from 'rxjs';\n\nimport {\n BusEvent,\n BusEventHandler,\n BusEventType,\n DataFrame,\n DataQueryRequest,\n DataSourceGetTagKeysOptions,\n DataSourceGetTagValuesOptions,\n DataTransformContext,\n PanelData,\n TimeRange,\n} from '@grafana/data';\nimport { DataQuery, DataTopic, TimeZone } from '@grafana/schema';\n\nimport { SceneVariableDependencyConfigLike, SceneVariables } from '../variables/types';\nimport { SceneObjectRef } from './SceneObjectRef';\n\nexport interface SceneObjectState {\n key?: string;\n $timeRange?: SceneTimeRangeLike;\n $data?: SceneDataProvider;\n $variables?: SceneVariables;\n /**\n * @experimental\n * Can be used to add extra behaviors to a scene object.\n * These are activated when the their parent scene object is activated.\n */\n $behaviors?: Array<SceneObject | SceneStatelessBehavior>;\n}\n\nexport interface SceneLayoutChildOptions {\n width?: number | string;\n height?: number | string;\n xSizing?: 'fill' | 'content';\n ySizing?: 'fill' | 'content';\n x?: number;\n y?: number;\n minWidth?: number | string;\n minHeight?: number | string;\n isDraggable?: boolean;\n isResizable?: boolean;\n}\n\nexport interface SceneComponentProps<T> {\n model: T;\n}\n\nexport type SceneComponent<TModel> = (props: SceneComponentProps<TModel>) => React.ReactElement | null;\n\nexport interface SceneDataState extends SceneObjectState {\n data?: PanelData;\n}\n\nexport interface SceneObject<TState extends SceneObjectState = SceneObjectState> {\n /** The current state */\n readonly state: TState;\n\n /** True when there is a React component mounted for this Object */\n readonly isActive: boolean;\n\n /** SceneObject parent */\n readonly parent?: SceneObject;\n\n /** This abtractions declares what variables the scene object depends on and how to handle when they change value. **/\n readonly variableDependency?: SceneVariableDependencyConfigLike;\n\n /** This abstraction declares URL sync dependencies of a scene object. **/\n readonly urlSync?: SceneObjectUrlSyncHandler;\n\n /** Subscribe to state changes */\n subscribeToState(handler: SceneStateChangedHandler<TState>): Unsubscribable;\n\n /** Subscribe to a scene event */\n subscribeToEvent<T extends BusEvent>(typeFilter: BusEventType<T>, handler: BusEventHandler<T>): Unsubscribable;\n\n /** Publish an event and optionally bubble it up the scene */\n publishEvent(event: BusEvent, bubble?: boolean): void;\n\n /** Utility hook that wraps useObservable. Used by React components to subscribes to state changes */\n useState(): TState;\n\n /** How to modify state */\n setState(state: Partial<TState>): void;\n\n /**\n * Called when the Component is mounted. This will also activate any $data, $variables or $timeRange scene object on this level.\n * Don't override this in your custom SceneObjects, instead use addActivationHandler from the constructor.\n **/\n activate(): CancelActivationHandler;\n\n /** Get the scene root */\n getRoot(): SceneObject;\n\n /** Returns a deep clone this object and all its children */\n clone(state?: Partial<TState>): this;\n\n /** A React component to use for rendering the object */\n Component(props: SceneComponentProps<SceneObject<TState>>): React.ReactElement | null;\n\n /** Force a re-render, should only be needed when variable values change */\n forceRender(): void;\n\n /** Returns a SceneObjectRef that will resolve to this object */\n getRef(): SceneObjectRef<this>;\n\n /**\n * Allows external code to register code that is executed on activate and deactivate. This allow you\n * to wire up scene objects that need to respond to state changes in other objects from the outside.\n **/\n addActivationHandler(handler: SceneActivationHandler): void;\n\n /**\n * Loop through state and call callback for each direct child scene object.\n * Checks 1 level deep properties and arrays. So a scene object hidden in a nested plain object will not be detected.\n */\n forEachChild(callback: (child: SceneObject) => void): void;\n}\n\nexport type SceneActivationHandler = () => SceneDeactivationHandler | void;\nexport type SceneDeactivationHandler = () => void;\n\n/**\n * Function returned by activate() that when called will deactivate the object if it's the last activator\n **/\nexport type CancelActivationHandler = () => void;\n\nexport interface SceneLayoutState extends SceneObjectState {\n children: SceneObject[];\n}\n\nexport interface SceneLayout<T extends SceneLayoutState = SceneLayoutState> extends SceneObject<T> {\n isDraggable(): boolean;\n getDragClass?(): string;\n getDragClassCancel?(): string;\n}\n\nexport interface SceneTimeRangeState extends SceneObjectState {\n from: string;\n to: string;\n fiscalYearStartMonth?: number;\n value: TimeRange;\n timeZone?: TimeZone;\n /** weekStart will change the global date locale so having multiple different weekStart values is not supported */\n weekStart?: string;\n /**\n * @internal\n * To enable feature parity with the old time range picker, not sure if it will be kept.\n * Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.\n * */\n UNSAFE_nowDelay?: string;\n\n refreshOnActivate?: {\n /**\n * When set, the time range will invalidate relative ranges after the specified interval has elapsed\n */\n afterMs?: number;\n /**\n * When set, the time range will invalidate relative ranges after the specified percentage of the current interval has elapsed.\n * If both invalidate values are set, the smaller value will be used for the given interval.\n */\n percent?: number;\n };\n}\n\nexport interface SceneTimeRangeLike extends SceneObject<SceneTimeRangeState> {\n onTimeZoneChange(timeZone: TimeZone): void;\n onTimeRangeChange(timeRange: TimeRange): void;\n onRefresh(): void;\n getTimeZone(): TimeZone;\n}\n\nexport function isSceneObject(obj: any): obj is SceneObject {\n return obj.useState !== undefined;\n}\n\nexport interface SceneObjectWithUrlSync extends SceneObject {\n getUrlState(): SceneObjectUrlValues;\n updateFromUrl(values: SceneObjectUrlValues): void;\n shouldCreateHistoryStep?(values: SceneObjectUrlValues): boolean;\n}\n\nexport interface SceneObjectUrlSyncHandler {\n getKeys(): string[];\n getUrlState(): SceneObjectUrlValues;\n updateFromUrl(values: SceneObjectUrlValues): void;\n shouldCreateHistoryStep?(values: SceneObjectUrlValues): boolean;\n}\n\nexport interface DataRequestEnricher {\n // Return partial data query request that will be merged with the original request provided by SceneQueryRunner\n enrichDataRequest(source: SceneObject): Partial<DataQueryRequest> | null;\n}\n\nexport interface FiltersRequestEnricher {\n // Return partial getTagKeys or getTagValues query request that will be merged with the original request provided by ad hoc or group by variable\n enrichFiltersRequest(\n source: SceneObject\n ): Partial<DataSourceGetTagKeysOptions | DataSourceGetTagValuesOptions> | null;\n}\n\nexport function isDataRequestEnricher(obj: any): obj is DataRequestEnricher {\n return 'enrichDataRequest' in obj;\n}\n\nexport function isFiltersRequestEnricher(obj: any): obj is FiltersRequestEnricher {\n return 'enrichFiltersRequest' in obj;\n}\n\nexport type SceneObjectUrlValue = string | string[] | undefined | null;\nexport type SceneObjectUrlValues = Record<string, SceneObjectUrlValue>;\n\nexport type CustomTransformOperator = (context: DataTransformContext) => MonoTypeOperatorFunction<DataFrame[]>;\nexport type CustomTransformerDefinition =\n | { operator: CustomTransformOperator; topic: DataTopic }\n | CustomTransformOperator;\nexport type SceneStateChangedHandler<TState> = (newState: TState, prevState: TState) => void;\n\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nexport interface SceneDataProviderResult {\n data: PanelData;\n origin: SceneDataProvider;\n}\n\nexport interface SceneDataProvider<T extends SceneObjectState = SceneDataState> extends SceneObject<T> {\n setContainerWidth?: (width: number) => void;\n isDataReadyToDisplay?: () => boolean;\n cancelQuery?: () => void;\n getResultsStream(): Observable<SceneDataProviderResult>;\n}\n\nexport interface SceneDataLayerProviderState extends SceneDataState {\n name: string;\n description?: string;\n isEnabled?: boolean;\n isHidden?: boolean;\n}\n\nexport interface SceneDataLayerProvider extends SceneDataProvider<SceneDataLayerProviderState> {\n isDataLayer: true;\n}\n\nexport function isDataLayer(obj: SceneObject): obj is SceneDataLayerProvider {\n return 'isDataLayer' in obj;\n}\n\nexport interface DataLayerFilter {\n panelId: number;\n}\n\nexport interface SceneStatelessBehavior<T extends SceneObject = any> {\n (sceneObject: T): CancelActivationHandler | void;\n}\n\nexport type ControlsLayout = 'horizontal' | 'vertical';\n\nexport interface UseStateHookOptions {\n /**\n * For some edge cases other scene objects want to subscribe to scene object state for objects\n * that are not active, or whose main React Component can be un-mounted. Set this to true\n * to keep the scene object active even if the React component is unmounted.\n *\n * Normally you would not need this but this can be useful in some edge cases.\n *\n * @experimental\n */\n shouldActivateOrKeepAlive?: boolean;\n}\n\nexport interface SceneDataQuery extends DataQuery {\n [key: string]: any;\n\n // Opt this query out of time window comparison\n timeRangeCompare?: boolean;\n}\n\nexport interface SceneUrlSyncOptions {\n /**\n * This will update the url to contain all scene url state\n * when the scene is initialized. Important for browser history \"back\" actions.\n */\n updateUrlOnInit?: boolean;\n /**\n * This is only supported by some objects if they implement\n * shouldCreateHistoryStep where they can control what changes\n * url changes should add a new browser history entry.\n */\n createBrowserHistorySteps?: boolean;\n}\n"],"names":[],"mappings":"AA8KO,SAAS,cAAc,GAA8B,EAAA;AAC1D,EAAA,OAAO,IAAI,QAAa,KAAA,KAAA,CAAA,CAAA;AAC1B,CAAA;AA2BO,SAAS,sBAAsB,GAAsC,EAAA;AAC1E,EAAA,OAAO,mBAAuB,IAAA,GAAA,CAAA;AAChC,CAAA;AAEO,SAAS,yBAAyB,GAAyC,EAAA;AAChF,EAAA,OAAO,sBAA0B,IAAA,GAAA,CAAA;AACnC,CAAA;AAsCO,SAAS,YAAY,GAAiD,EAAA;AAC3E,EAAA,OAAO,aAAiB,IAAA,GAAA,CAAA;AAC1B;;;;"}
@@ -17,7 +17,6 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- const GLOBAL_ANNOTATION_ID = 0;
21
20
  function filterAnnotations(data, filters) {
22
21
  var _a;
23
22
  if (!Array.isArray(data) || data.length === 0) {
@@ -35,11 +34,11 @@ function filterAnnotations(data, filters) {
35
34
  const sourceField = frame.fields.find((f) => f.name === "source");
36
35
  if (sourceField) {
37
36
  if (panelIdField && sourceField.values[index].type === "dashboard") {
38
- matching = [filters.panelId, GLOBAL_ANNOTATION_ID].includes(panelIdField.values[index]);
37
+ matching = panelIdField.values[index] === filters.panelId;
39
38
  }
40
39
  const sourceFilter = sourceField.values[index].filter;
41
40
  if (sourceFilter) {
42
- const includes = [...(_a = sourceFilter.ids) != null ? _a : [], GLOBAL_ANNOTATION_ID].includes(filters.panelId);
41
+ const includes = ((_a = sourceFilter.ids) != null ? _a : []).includes(filters.panelId);
43
42
  if (sourceFilter.exclude) {
44
43
  if (includes) {
45
44
  matching = false;
@@ -1 +1 @@
1
- {"version":3,"file":"filterAnnotations.js","sources":["../../../../../src/querying/layers/annotations/filterAnnotations.ts"],"sourcesContent":["import { DataFrame, Field } from '@grafana/data';\nimport { DataLayerFilter } from '../../../core/types';\n\nconst GLOBAL_ANNOTATION_ID = 0;\n\n// Provided SceneDataLayerProviderResult is an array of DataFrames.\nexport function filterAnnotations(data: DataFrame[], filters: DataLayerFilter) {\n if (!Array.isArray(data) || data.length === 0) {\n return data;\n }\n\n const rows = Array.from({ length: data.length }, () => new Set<number>());\n\n let frameIdx = 0;\n for (const frame of data) {\n for (let index = 0; index < frame.length; index++) {\n if (rows[frameIdx].has(index)) {\n continue;\n }\n let matching = true;\n\n // Let's call those standard fields that annotations data frame has.\n // panelId is a standard field, but it's not always present. It's added to annotations that were added to a particular panel.\n const panelIdField = frame.fields.find((f) => f.name === 'panelId');\n // Source field contains annotation definition, with type and filters included.\n const sourceField = frame.fields.find((f) => f.name === 'source');\n\n if (sourceField) {\n // Here we are filtering Grafana annotations that were added to a particular panel.\n if (panelIdField && sourceField.values[index].type === 'dashboard') {\n matching = [filters.panelId, GLOBAL_ANNOTATION_ID].includes(panelIdField.values[index]);\n }\n\n const sourceFilter = sourceField.values[index].filter;\n\n // Here we are filtering based on annotation filter definition.\n // Those filters are: Show annotation in selected panels, Exclude annotation from selected panels.\n if (sourceFilter) {\n const includes = ([...(sourceFilter.ids ?? []), GLOBAL_ANNOTATION_ID]).includes(filters.panelId);\n if (sourceFilter.exclude) {\n if (includes) {\n matching = false;\n }\n } else if (!includes) {\n matching = false;\n }\n }\n }\n\n if (matching) {\n rows[frameIdx].add(index);\n }\n }\n frameIdx++;\n }\n\n const processed: DataFrame[] = [];\n\n frameIdx = 0;\n for (const frame of data) {\n const frameLength = rows[frameIdx].size;\n const fields: Field[] = [];\n\n for (const field of frame.fields) {\n const buffer = [];\n\n for (let index = 0; index < frame.length; index++) {\n if (rows[frameIdx].has(index)) {\n buffer.push(field.values[index]);\n continue;\n }\n }\n\n fields.push({\n ...field,\n values: buffer,\n });\n }\n\n processed.push({\n ...frame,\n fields: fields,\n length: frameLength,\n });\n frameIdx++;\n }\n\n return processed;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,MAAM,oBAAuB,GAAA,CAAA,CAAA;AAGb,SAAA,iBAAA,CAAkB,MAAmB,OAA0B,EAAA;AAN/E,EAAA,IAAA,EAAA,CAAA;AAOE,EAAA,IAAI,CAAC,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAK,IAAA,IAAA,CAAK,WAAW,CAAG,EAAA;AAC7C,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EAAM,MAAA,IAAA,GAAO,KAAM,CAAA,IAAA,CAAK,EAAE,MAAA,EAAQ,IAAK,CAAA,MAAA,EAAU,EAAA,sBAAU,IAAA,GAAA,EAAa,CAAA,CAAA;AAExE,EAAA,IAAI,QAAW,GAAA,CAAA,CAAA;AACf,EAAA,KAAA,MAAW,SAAS,IAAM,EAAA;AACxB,IAAA,KAAA,IAAS,KAAQ,GAAA,CAAA,EAAG,KAAQ,GAAA,KAAA,CAAM,QAAQ,KAAS,EAAA,EAAA;AACjD,MAAA,IAAI,IAAK,CAAA,QAAA,CAAA,CAAU,GAAI,CAAA,KAAK,CAAG,EAAA;AAC7B,QAAA,SAAA;AAAA,OACF;AACA,MAAA,IAAI,QAAW,GAAA,IAAA,CAAA;AAIf,MAAM,MAAA,YAAA,GAAe,MAAM,MAAO,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA,CAAA,CAAE,SAAS,SAAS,CAAA,CAAA;AAElE,MAAM,MAAA,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M,SAAkB,EAAC,CAAA;AAEzB,IAAW,KAAA,MAAA,KAAA,IAAS,MAAM,MAAQ,EAAA;AAChC,MAAA,MAAM,SAAS,EAAC,CAAA;AAEhB,MAAA,KAAA,IAAS,KAAQ,GAAA,CAAA,EAAG,KAAQ,GAAA,KAAA,CAAM,QAAQ,KAAS,EAAA,EAAA;AACjD,QAAA,IAAI,IAAK,CAAA,QAAA,CAAA,CAAU,GAAI,CAAA,KAAK,CAAG,EAAA;AAC7B,UAAO,MAAA,CAAA,IAAA,CAAK,KAAM,CAAA,MAAA,CAAO,KAAM,CAAA,CAAA,CAAA;AAC/B,UAAA,SAAA;AAAA,SACF;AAAA,OACF;AAEA,MAAO,MAAA,CAAA,IAAA,CAAK,iCACP,KADO,CAAA,EAAA;AAAA,QAEV,MAAQ,EAAA,MAAA;AAAA,OACT,CAAA,CAAA,CAAA;AAAA,KACH;AAEA,IAAU,SAAA,CAAA,IAAA,CAAK,iCACV,KADU,CAAA,EAAA;AAAA,MAEb,MAAA;AAAA,MACA,MAAQ,EAAA,WAAA;AAAA,KACT,CAAA,CAAA,CAAA;AACD,IAAA,QAAA,EAAA,CAAA;AAAA,GACF;AAEA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"filterAnnotations.js","sources":["../../../../../src/querying/layers/annotations/filterAnnotations.ts"],"sourcesContent":["import { DataFrame, Field } from '@grafana/data';\nimport { DataLayerFilter } from '../../../core/types';\n\n// Provided SceneDataLayerProviderResult is an array of DataFrames.\nexport function filterAnnotations(data: DataFrame[], filters: DataLayerFilter) {\n if (!Array.isArray(data) || data.length === 0) {\n return data;\n }\n\n const rows = Array.from({ length: data.length }, () => new Set<number>());\n\n let frameIdx = 0;\n for (const frame of data) {\n for (let index = 0; index < frame.length; index++) {\n if (rows[frameIdx].has(index)) {\n continue;\n }\n let matching = true;\n\n // Let's call those standard fields that annotations data frame has.\n // panelId is a standard field, but it's not always present. It's added to annotations that were added to a particular panel.\n const panelIdField = frame.fields.find((f) => f.name === 'panelId');\n // Source field contains annotation definition, with type and filters included.\n const sourceField = frame.fields.find((f) => f.name === 'source');\n\n if (sourceField) {\n // Here we are filtering Grafana annotations that were added to a particular panel.\n if (panelIdField && sourceField.values[index].type === 'dashboard') {\n matching = panelIdField.values[index] === filters.panelId;\n }\n\n const sourceFilter = sourceField.values[index].filter;\n\n // Here we are filtering based on annotation filter definition.\n // Those fitlers are: Show annotation in selected panels, Exclude annotation from selected panels.\n if (sourceFilter) {\n const includes = (sourceFilter.ids ?? []).includes(filters.panelId);\n if (sourceFilter.exclude) {\n if (includes) {\n matching = false;\n }\n } else if (!includes) {\n matching = false;\n }\n }\n }\n\n if (matching) {\n rows[frameIdx].add(index);\n }\n }\n frameIdx++;\n }\n\n const processed: DataFrame[] = [];\n\n frameIdx = 0;\n for (const frame of data) {\n const frameLength = rows[frameIdx].size;\n const fields: Field[] = [];\n\n for (const field of frame.fields) {\n const buffer = [];\n\n for (let index = 0; index < frame.length; index++) {\n if (rows[frameIdx].has(index)) {\n buffer.push(field.values[index]);\n continue;\n }\n }\n\n fields.push({\n ...field,\n values: buffer,\n });\n }\n\n processed.push({\n ...frame,\n fields: fields,\n length: frameLength,\n });\n frameIdx++;\n }\n return processed;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAIgB,SAAA,iBAAA,CAAkB,MAAmB,OAA0B,EAAA;AAJ/E,EAAA,IAAA,EAAA,CAAA;AAKE,EAAA,IAAI,CAAC,KAAM,CAAA,OAAA,CAAQ,IAAI,CAAK,IAAA,IAAA,CAAK,WAAW,CAAG,EAAA;AAC7C,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EAAM,MAAA,IAAA,GAAO,KAAM,CAAA,IAAA,CAAK,EAAE,MAAA,EAAQ,IAAK,CAAA,MAAA,EAAU,EAAA,sBAAU,IAAA,GAAA,EAAa,CAAA,CAAA;AAExE,EAAA,IAAI,QAAW,GAAA,CAAA,CAAA;AACf,EAAA,KAAA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A;AACZ,QAAK,IAAA,CAAA,QAAA,CAAA,CAAU,IAAI,KAAK,CAAA,CAAA;AAAA,OAC1B;AAAA,KACF;AACA,IAAA,QAAA,EAAA,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,YAAyB,EAAC,CAAA;AAEhC,EAAW,QAAA,GAAA,CAAA,CAAA;AACX,EAAA,KAAA,MAAW,SAAS,IAAM,EAAA;AACxB,IAAM,MAAA,WAAA,GAAc,KAAK,QAAU,CAAA,CAAA,IAAA,CAAA;AACnC,IAAA,MAAM,SAAkB,EAAC,CAAA;AAEzB,IAAW,KAAA,MAAA,KAAA,IAAS,MAAM,MAAQ,EAAA;AAChC,MAAA,MAAM,SAAS,EAAC,CAAA;AAEhB,MAAA,KAAA,IAAS,KAAQ,GAAA,CAAA,EAAG,KAAQ,GAAA,KAAA,CAAM,QAAQ,KAAS,EAAA,EAAA;AACjD,QAAA,IAAI,IAAK,CAAA,QAAA,CAAA,CAAU,GAAI,CAAA,KAAK,CAAG,EAAA;AAC7B,UAAO,MAAA,CAAA,IAAA,CAAK,KAAM,CAAA,MAAA,CAAO,KAAM,CAAA,CAAA,CAAA;AAC/B,UAAA,SAAA;AAAA,SACF;AAAA,OACF;AAEA,MAAO,MAAA,CAAA,IAAA,CAAK,iCACP,KADO,CAAA,EAAA;AAAA,QAEV,MAAQ,EAAA,MAAA;AAAA,OACT,CAAA,CAAA,CAAA;AAAA,KACH;AAEA,IAAU,SAAA,CAAA,IAAA,CAAK,iCACV,KADU,CAAA,EAAA;AAAA,MAEb,MAAA;AAAA,MACA,MAAQ,EAAA,WAAA;AAAA,KACT,CAAA,CAAA,CAAA;AACD,IAAA,QAAA,EAAA,CAAA;AAAA,GACF;AACA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
@@ -31,7 +31,7 @@ function keyLabelToOption(key, label) {
31
31
  }
32
32
  const filterNoOp = () => true;
33
33
  function AdHocFilterRenderer({ filter, model }) {
34
- var _a, _b, _c;
34
+ var _a, _b, _c, _d, _e;
35
35
  const styles = useStyles2(getStyles);
36
36
  const [keys, setKeys] = useState([]);
37
37
  const [values, setValues] = useState([]);
@@ -105,7 +105,7 @@ function AdHocFilterRenderer({ filter, model }) {
105
105
  };
106
106
  const valueSelect = /* @__PURE__ */ React.createElement(Select, __spreadValues({
107
107
  virtualized: true,
108
- allowCustomValue: true,
108
+ allowCustomValue: (_b = model.state.allowCustomValue) != null ? _b : true,
109
109
  isValidNewOption: (inputValue) => inputValue.trim().length > 0,
110
110
  allowCreateWhileLoading: true,
111
111
  formatCreateLabel: (inputValue) => `Use custom value: ${inputValue}`,
@@ -151,7 +151,7 @@ function AdHocFilterRenderer({ filter, model }) {
151
151
  disabled: model.state.readOnly,
152
152
  className: cx(styles.key, isKeysOpen ? styles.widthWhenOpen : void 0),
153
153
  width: "auto",
154
- allowCustomValue: true,
154
+ allowCustomValue: (_c = model.state.allowCustomValue) != null ? _c : true,
155
155
  value: keyValue,
156
156
  placeholder: "Select label",
157
157
  options: handleOptionGroups(keys),
@@ -204,7 +204,7 @@ function AdHocFilterRenderer({ filter, model }) {
204
204
  if (filter.key) {
205
205
  const label = /* @__PURE__ */ React.createElement(ControlsLabel, {
206
206
  layout: "vertical",
207
- label: (_b = filter.key) != null ? _b : "",
207
+ label: (_d = filter.key) != null ? _d : "",
208
208
  onRemove: () => model._removeFilter(filter)
209
209
  });
210
210
  return /* @__PURE__ */ React.createElement(Field, {
@@ -231,7 +231,7 @@ function AdHocFilterRenderer({ filter, model }) {
231
231
  title: "Remove filter",
232
232
  className: styles.removeButton,
233
233
  icon: "times",
234
- "data-testid": `AdHocFilter-remove-${(_c = filter.key) != null ? _c : ""}`,
234
+ "data-testid": `AdHocFilter-remove-${(_e = filter.key) != null ? _e : ""}`,
235
235
  onClick: () => model._removeFilter(filter)
236
236
  }));
237
237
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AdHocFilterRenderer.js","sources":["../../../../src/variables/adhoc/AdHocFilterRenderer.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\n\nimport { AdHocFiltersVariable, AdHocFilterWithLabels, isMultiValueOperator } from './AdHocFiltersVariable';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Button, Field, InputActionMeta, Select, useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { ControlsLabel } from '../../utils/ControlsLabel';\nimport { getAdhocOptionSearcher } from './getAdhocOptionSearcher';\nimport { handleOptionGroups } from '../utils';\nimport { OptionWithCheckbox } from '../components/VariableValueSelect';\n\ninterface Props {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n}\n\nfunction keyLabelToOption(key: string, label?: string): SelectableValue | null {\n return key !== ''\n ? {\n value: key,\n label: label || key,\n }\n : null;\n}\n\nconst filterNoOp = () => true;\n\nexport function AdHocFilterRenderer({ filter, model }: Props) {\n const styles = useStyles2(getStyles);\n\n const [keys, setKeys] = useState<SelectableValue[]>([]);\n const [values, setValues] = useState<SelectableValue[]>([]);\n const [isKeysLoading, setIsKeysLoading] = useState(false);\n const [isValuesLoading, setIsValuesLoading] = useState(false);\n const [isKeysOpen, setIsKeysOpen] = useState(false);\n const [isValuesOpen, setIsValuesOpen] = useState(false);\n const [isOperatorOpen, setIsOperatorOpen] = useState(false);\n const [valueInputValue, setValueInputValue] = useState('');\n const [valueHasCustomValue, setValueHasCustomValue] = useState(false);\n // To not trigger queries on every selection we store this state locally here and only update the variable onBlur\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n const [uncommittedValue, setUncommittedValue] = useState<SelectableValue>(filter.values ? filter.values.map((value, index) => keyLabelToOption(value, filter.valueLabels?.[index])) : []);\n const isMultiValue = isMultiValueOperator(filter.operator);\n\n const keyValue = keyLabelToOption(filter.key, filter.keyLabel);\n const valueValue = keyLabelToOption(filter.value, filter.valueLabels?.[0]);\n\n const optionSearcher = useMemo(() => getAdhocOptionSearcher(values), [values]);\n\n const onValueInputChange = (value: string, { action }: InputActionMeta) => {\n if (action === 'input-change') {\n setValueInputValue(value);\n }\n return value;\n };\n\n const onOperatorChange = (v: SelectableValue) => {\n const existingOperator = filter.operator;\n const newOperator = v.value;\n\n const update: Partial<AdHocFilterWithLabels> = { operator: newOperator };\n // clear value if operator has changed from multi to single\n if (isMultiValueOperator(existingOperator) && !isMultiValueOperator(newOperator)) {\n update.value = '';\n update.valueLabels = [''];\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n update.values = undefined;\n setUncommittedValue([]);\n // set values if operator has changed from single to multi\n } else if (!isMultiValueOperator(existingOperator) && isMultiValueOperator(newOperator) && filter.value) {\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n update.values = [filter.value];\n setUncommittedValue([{\n value: filter.value,\n label: filter.valueLabels?.[0] ?? filter.value,\n }]);\n }\n model._updateFilter(filter, update);\n }\n\n const filteredValueOptions = useMemo(\n () => handleOptionGroups(optionSearcher(valueInputValue)),\n [optionSearcher, valueInputValue]\n );\n\n const multiValueProps = {\n isMulti: true,\n value: uncommittedValue,\n components: {\n Option: OptionWithCheckbox,\n },\n hideSelectedOptions: false,\n closeMenuOnSelect: false,\n openMenuOnFocus: false,\n onChange: (v: SelectableValue) => {\n setUncommittedValue(v);\n // clear input value when creating a new custom multi value\n if (v.some((value: SelectableValue) => value.__isNew__)) {\n setValueInputValue('');\n }\n },\n onBlur: () => {\n model._updateFilter(filter, {\n value: uncommittedValue[0]?.value ?? '',\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n values: uncommittedValue.map((option: SelectableValue<string>) => option.value),\n valueLabels: uncommittedValue.map((option: SelectableValue<string>) => option.label),\n });\n }\n }\n\n const valueSelect = (\n <Select\n virtualized\n allowCustomValue\n isValidNewOption={(inputValue) => inputValue.trim().length > 0}\n allowCreateWhileLoading\n formatCreateLabel={(inputValue) => `Use custom value: ${inputValue}`}\n disabled={model.state.readOnly}\n className={cx(styles.value, isValuesOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n value={valueValue}\n filterOption={filterNoOp}\n placeholder={'Select value'}\n options={filteredValueOptions}\n inputValue={valueInputValue}\n onInputChange={onValueInputChange}\n onChange={(v) => {\n model._updateFilter(filter, {\n value: v.value,\n valueLabels: v.label ? [v.label] : [v.value]\n });\n\n if (valueHasCustomValue !== v.__isNew__) {\n setValueHasCustomValue(v.__isNew__);\n }\n }}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isValuesOpen && !isValuesLoading}\n isLoading={isValuesLoading}\n openMenuOnFocus={true}\n onOpenMenu={async () => {\n setIsValuesLoading(true);\n setIsValuesOpen(true);\n const values = await model._getValuesFor(filter);\n setIsValuesLoading(false);\n setValues(values);\n if (valueHasCustomValue) {\n setValueInputValue(valueValue?.label ?? '');\n }\n }}\n onCloseMenu={() => {\n setIsValuesOpen(false);\n setValueInputValue('');\n }}\n {...(isMultiValue && multiValueProps)}\n />\n );\n\n const keySelect = (\n <Select\n // By changing the key, we reset the Select component,\n // to ensure that the loaded values are shown after they are loaded\n key={`${isValuesLoading ? 'loading' : 'loaded'}`}\n disabled={model.state.readOnly}\n className={cx(styles.key, isKeysOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n allowCustomValue={true}\n value={keyValue}\n placeholder={'Select label'}\n options={handleOptionGroups(keys)}\n onChange={(v) => {\n model._updateFilter(filter, {\n key: v.value,\n keyLabel: v.label,\n // clear value if key has changed\n value: '',\n valueLabels: [''],\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n values: undefined\n })\n setUncommittedValue([]);\n }}\n autoFocus={filter.key === ''}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isKeysOpen && !isKeysLoading}\n isLoading={isKeysLoading}\n onOpenMenu={async () => {\n setIsKeysOpen(true);\n setIsKeysLoading(true);\n const keys = await model._getKeys(filter.key);\n setIsKeysLoading(false);\n setKeys(keys);\n }}\n onCloseMenu={() => {\n setIsKeysOpen(false);\n }}\n onBlur={() => {\n if (filter.key === '') {\n model._removeFilter(filter);\n }\n }}\n openMenuOnFocus={true}\n />\n );\n\n const operatorSelect = (\n <Select\n className={cx(styles.operator, {\n [styles.widthWhenOpen]: isOperatorOpen,\n })}\n value={filter.operator}\n disabled={model.state.readOnly}\n options={model._getOperators()}\n onChange={onOperatorChange}\n onOpenMenu={() => {\n setIsOperatorOpen(true)\n }}\n onCloseMenu={() => {\n setIsOperatorOpen(false)\n }}\n />\n );\n\n if (model.state.layout === 'vertical') {\n if (filter.key) {\n const label = (\n <ControlsLabel layout=\"vertical\" label={filter.key ?? ''} onRemove={() => model._removeFilter(filter)} />\n );\n\n return (\n <Field label={label} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n <div className={styles.wrapper}>\n {operatorSelect}\n {valueSelect}\n </div>\n </Field>\n );\n } else {\n return (\n <Field label={'Select label'} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n {keySelect}\n </Field>\n );\n }\n }\n\n return (\n <div className={styles.wrapper} data-testid={`AdHocFilter-${filter.key}`}>\n {keySelect}\n {operatorSelect}\n {valueSelect}\n <Button\n variant=\"secondary\"\n aria-label=\"Remove filter\"\n title=\"Remove filter\"\n className={styles.removeButton}\n icon=\"times\"\n data-testid={`AdHocFilter-remove-${filter.key ?? ''}`}\n onClick={() => model._removeFilter(filter)}\n />\n </div>\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n field: css({\n marginBottom: 0,\n }),\n wrapper: css({\n display: 'flex',\n '> *': {\n '&:not(:first-child)': {\n // Negative margin hides the double-border on adjacent selects\n marginLeft: -1,\n },\n\n '&:first-child': {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n '&:last-child': {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n\n '&:not(:first-child):not(:last-child)': {\n borderRadius: 0,\n },\n\n // Fix focus state zIndex issues\n position: 'relative',\n zIndex: 0,\n\n // Adjacent borders are overlapping, so raise children up when hovering etc\n // so all that child's borders are visible.\n '&:hover': {\n zIndex: 1,\n },\n\n '&:focus-within': {\n zIndex: 2,\n },\n },\n }),\n widthWhenOpen: css({\n minWidth: theme.spacing(16),\n }),\n value: css({\n flexBasis: 'content',\n flexShrink: 1,\n minWidth: '90px',\n }),\n key: css({\n flexBasis: 'content',\n minWidth: '90px',\n flexShrink: 1,\n }),\n operator: css({\n flexShrink: 0,\n flexBasis: 'content',\n }),\n removeButton: css({\n paddingLeft: theme.spacing(3 / 2),\n paddingRight: theme.spacing(3 / 2),\n borderLeft: 'none',\n width: theme.spacing(3),\n marginRight: theme.spacing(1),\n boxSizing: 'border-box',\n // To not have button background and last select border intersect\n position: 'relative',\n left: '1px',\n }),\n});\n"],"names":["_a","_b","values","keys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,gBAAA,CAAiB,KAAa,KAAwC,EAAA;AAC7E,EAAA,OAAO,QAAQ,EACX,GAAA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,OAAO,KAAS,IAAA,GAAA;AAAA,GAElB,GAAA,IAAA,CAAA;AACN,CAAA;AAEA,MAAM,aAAa,MAAM,IAAA,CAAA;AAElB,SAAS,mBAAoB,CAAA,EAAE,MAAQ,EAAA,KAAA,EAAgB,EAAA;AA3B9D,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA4BE,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AAEnC,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAA,QAAA,CAA4B,EAAE,CAAA,CAAA;AACtD,EAAA,MAAM,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAA,QAAA,CAA4B,EAAE,CAAA,CAA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cesContent":["import React, { useMemo, useState } from 'react';\n\nimport { AdHocFiltersVariable, AdHocFilterWithLabels, isMultiValueOperator } from './AdHocFiltersVariable';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Button, Field, InputActionMeta, Select, useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { ControlsLabel } from '../../utils/ControlsLabel';\nimport { getAdhocOptionSearcher } from './getAdhocOptionSearcher';\nimport { handleOptionGroups } from '../utils';\nimport { OptionWithCheckbox } from '../components/VariableValueSelect';\n\ninterface Props {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n}\n\nfunction keyLabelToOption(key: string, label?: string): SelectableValue | null {\n return key !== ''\n ? {\n value: key,\n label: label || key,\n }\n : null;\n}\n\nconst filterNoOp = () => true;\n\nexport function AdHocFilterRenderer({ filter, model }: Props) {\n const styles = useStyles2(getStyles);\n\n const [keys, setKeys] = useState<SelectableValue[]>([]);\n const [values, setValues] = useState<SelectableValue[]>([]);\n const [isKeysLoading, setIsKeysLoading] = useState(false);\n const [isValuesLoading, setIsValuesLoading] = useState(false);\n const [isKeysOpen, setIsKeysOpen] = useState(false);\n const [isValuesOpen, setIsValuesOpen] = useState(false);\n const [isOperatorOpen, setIsOperatorOpen] = useState(false);\n const [valueInputValue, setValueInputValue] = useState('');\n const [valueHasCustomValue, setValueHasCustomValue] = useState(false);\n // To not trigger queries on every selection we store this state locally here and only update the variable onBlur\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n const [uncommittedValue, setUncommittedValue] = useState<SelectableValue>(filter.values ? filter.values.map((value, index) => keyLabelToOption(value, filter.valueLabels?.[index])) : []);\n const isMultiValue = isMultiValueOperator(filter.operator);\n\n const keyValue = keyLabelToOption(filter.key, filter.keyLabel);\n const valueValue = keyLabelToOption(filter.value, filter.valueLabels?.[0]);\n\n const optionSearcher = useMemo(() => getAdhocOptionSearcher(values), [values]);\n\n const onValueInputChange = (value: string, { action }: InputActionMeta) => {\n if (action === 'input-change') {\n setValueInputValue(value);\n }\n return value;\n };\n\n const onOperatorChange = (v: SelectableValue) => {\n const existingOperator = filter.operator;\n const newOperator = v.value;\n\n const update: Partial<AdHocFilterWithLabels> = { operator: newOperator };\n // clear value if operator has changed from multi to single\n if (isMultiValueOperator(existingOperator) && !isMultiValueOperator(newOperator)) {\n update.value = '';\n update.valueLabels = [''];\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n update.values = undefined;\n setUncommittedValue([]);\n // set values if operator has changed from single to multi\n } else if (!isMultiValueOperator(existingOperator) && isMultiValueOperator(newOperator) && filter.value) {\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n update.values = [filter.value];\n setUncommittedValue([{\n value: filter.value,\n label: filter.valueLabels?.[0] ?? filter.value,\n }]);\n }\n model._updateFilter(filter, update);\n }\n\n const filteredValueOptions = useMemo(\n () => handleOptionGroups(optionSearcher(valueInputValue)),\n [optionSearcher, valueInputValue]\n );\n\n const multiValueProps = {\n isMulti: true,\n value: uncommittedValue,\n components: {\n Option: OptionWithCheckbox,\n },\n hideSelectedOptions: false,\n closeMenuOnSelect: false,\n openMenuOnFocus: false,\n onChange: (v: SelectableValue) => {\n setUncommittedValue(v);\n // clear input value when creating a new custom multi value\n if (v.some((value: SelectableValue) => value.__isNew__)) {\n setValueInputValue('');\n }\n },\n onBlur: () => {\n model._updateFilter(filter, {\n value: uncommittedValue[0]?.value ?? '',\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n values: uncommittedValue.map((option: SelectableValue<string>) => option.value),\n valueLabels: uncommittedValue.map((option: SelectableValue<string>) => option.label),\n });\n }\n }\n\n const valueSelect = (\n <Select\n virtualized\n allowCustomValue={model.state.allowCustomValue ?? true}\n isValidNewOption={(inputValue) => inputValue.trim().length > 0}\n allowCreateWhileLoading\n formatCreateLabel={(inputValue) => `Use custom value: ${inputValue}`}\n disabled={model.state.readOnly}\n className={cx(styles.value, isValuesOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n value={valueValue}\n filterOption={filterNoOp}\n placeholder={'Select value'}\n options={filteredValueOptions}\n inputValue={valueInputValue}\n onInputChange={onValueInputChange}\n onChange={(v) => {\n model._updateFilter(filter, {\n value: v.value,\n valueLabels: v.label ? [v.label] : [v.value]\n });\n\n if (valueHasCustomValue !== v.__isNew__) {\n setValueHasCustomValue(v.__isNew__);\n }\n }}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isValuesOpen && !isValuesLoading}\n isLoading={isValuesLoading}\n openMenuOnFocus={true}\n onOpenMenu={async () => {\n setIsValuesLoading(true);\n setIsValuesOpen(true);\n const values = await model._getValuesFor(filter);\n setIsValuesLoading(false);\n setValues(values);\n if (valueHasCustomValue) {\n setValueInputValue(valueValue?.label ?? '');\n }\n }}\n onCloseMenu={() => {\n setIsValuesOpen(false);\n setValueInputValue('');\n }}\n {...(isMultiValue && multiValueProps)}\n />\n );\n\n const keySelect = (\n <Select\n // By changing the key, we reset the Select component,\n // to ensure that the loaded values are shown after they are loaded\n key={`${isValuesLoading ? 'loading' : 'loaded'}`}\n disabled={model.state.readOnly}\n className={cx(styles.key, isKeysOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n allowCustomValue={model.state.allowCustomValue ?? true}\n value={keyValue}\n placeholder={'Select label'}\n options={handleOptionGroups(keys)}\n onChange={(v) => {\n model._updateFilter(filter, {\n key: v.value,\n keyLabel: v.label,\n // clear value if key has changed\n value: '',\n valueLabels: [''],\n // TODO remove expect-error when we're on the latest version of @grafana/data\n // @ts-expect-error\n values: undefined\n })\n setUncommittedValue([]);\n }}\n autoFocus={filter.key === ''}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isKeysOpen && !isKeysLoading}\n isLoading={isKeysLoading}\n onOpenMenu={async () => {\n setIsKeysOpen(true);\n setIsKeysLoading(true);\n const keys = await model._getKeys(filter.key);\n setIsKeysLoading(false);\n setKeys(keys);\n }}\n onCloseMenu={() => {\n setIsKeysOpen(false);\n }}\n onBlur={() => {\n if (filter.key === '') {\n model._removeFilter(filter);\n }\n }}\n openMenuOnFocus={true}\n />\n );\n\n const operatorSelect = (\n <Select\n className={cx(styles.operator, {\n [styles.widthWhenOpen]: isOperatorOpen,\n })}\n value={filter.operator}\n disabled={model.state.readOnly}\n options={model._getOperators()}\n onChange={onOperatorChange}\n onOpenMenu={() => {\n setIsOperatorOpen(true)\n }}\n onCloseMenu={() => {\n setIsOperatorOpen(false)\n }}\n />\n );\n\n if (model.state.layout === 'vertical') {\n if (filter.key) {\n const label = (\n <ControlsLabel layout=\"vertical\" label={filter.key ?? ''} onRemove={() => model._removeFilter(filter)} />\n );\n\n return (\n <Field label={label} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n <div className={styles.wrapper}>\n {operatorSelect}\n {valueSelect}\n </div>\n </Field>\n );\n } else {\n return (\n <Field label={'Select label'} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n {keySelect}\n </Field>\n );\n }\n }\n\n return (\n <div className={styles.wrapper} data-testid={`AdHocFilter-${filter.key}`}>\n {keySelect}\n {operatorSelect}\n {valueSelect}\n <Button\n variant=\"secondary\"\n aria-label=\"Remove filter\"\n title=\"Remove filter\"\n className={styles.removeButton}\n icon=\"times\"\n data-testid={`AdHocFilter-remove-${filter.key ?? ''}`}\n onClick={() => model._removeFilter(filter)}\n />\n </div>\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n field: css({\n marginBottom: 0,\n }),\n wrapper: css({\n display: 'flex',\n '> *': {\n '&:not(:first-child)': {\n // Negative margin hides the double-border on adjacent selects\n marginLeft: -1,\n },\n\n '&:first-child': {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n '&:last-child': {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n\n '&:not(:first-child):not(:last-child)': {\n borderRadius: 0,\n },\n\n // Fix focus state zIndex issues\n position: 'relative',\n zIndex: 0,\n\n // Adjacent borders are overlapping, so raise children up when hovering etc\n // so all that child's borders are visible.\n '&:hover': {\n zIndex: 1,\n },\n\n '&:focus-within': {\n zIndex: 2,\n },\n },\n }),\n widthWhenOpen: css({\n minWidth: theme.spacing(16),\n }),\n value: css({\n flexBasis: 'content',\n flexShrink: 1,\n minWidth: '90px',\n }),\n key: css({\n flexBasis: 'content',\n minWidth: '90px',\n flexShrink: 1,\n }),\n operator: css({\n flexShrink: 0,\n flexBasis: 'content',\n }),\n removeButton: css({\n paddingLeft: theme.spacing(3 / 2),\n paddingRight: theme.spacing(3 / 2),\n borderLeft: 'none',\n width: theme.spacing(3),\n marginRight: theme.spacing(1),\n boxSizing: 'border-box',\n // To not have button background and last select border intersect\n position: 'relative',\n left: '1px',\n }),\n});\n"],"names":["_a","_b","values","keys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,gBAAA,CAAiB,KAAa,KAAwC,EAAA;AAC7E,EAAA,OAAO,QAAQ,EACX,GAAA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,OAAO,KAAS,IAAA,GAAA;AAAA,GAElB,GAAA,IAAA,CAAA;AACN,CAAA;AAEA,MAAM,aAAa,MAAM,IAAA,CAAA;AAElB,SAAS,mBAAoB,CAAA,EAAE,MAAQ,EAAA,KAAA,EAAgB,EAAA;AA3B9D,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA4BE,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AAEnC,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAA,QAAA,CAA4B,EAAE,CAAA,CAAA;AACtD,EAAA,M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AAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,SAAW,EAAA,YAAA;AAAA,IAEX,QAAU,EAAA,UAAA;AAAA,IACV,IAAM,EAAA,KAAA;AAAA,GACP,CAAA;AACH,CAAA,CAAA;;;;"}
@@ -30,7 +30,7 @@ var __spreadValues = (a, b) => {
30
30
  };
31
31
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
32
32
  const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, isAlwaysWip, handleChangeViewMode, focusOnWipInputRef, populateInputOnEdit }, parentRef) {
33
- var _a, _b, _c;
33
+ var _a, _b, _c, _d;
34
34
  const [open, setOpen] = useState(false);
35
35
  const [options, setOptions] = useState([]);
36
36
  const [optionsLoading, setOptionsLoading] = useState(false);
@@ -41,6 +41,7 @@ const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, isAlwa
41
41
  const styles = useStyles2(getStyles);
42
42
  const [filterMultiValues, setFilterMultiValues] = useState([]);
43
43
  const [_, setForceRefresh] = useState({});
44
+ const allowCustomValue = (_a = model.state.allowCustomValue) != null ? _a : true;
44
45
  const multiValuePillWrapperRef = useRef(null);
45
46
  const hasMultiValueOperator = isMultiValueOperator((filter == null ? void 0 : filter.operator) || "");
46
47
  const isMultiValueEdit = hasMultiValueOperator && filterInputType === "value";
@@ -153,7 +154,7 @@ const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, isAlwa
153
154
  [refs.domReference]
154
155
  );
155
156
  const filteredDropDownItems = flattenOptionGroups(handleOptionGroups(optionsSearcher(inputValue, filterInputType)));
156
- if (filterInputType !== "operator" && inputValue) {
157
+ if (allowCustomValue && filterInputType !== "operator" && inputValue) {
157
158
  filteredDropDownItems.push({
158
159
  value: inputValue.trim(),
159
160
  label: inputValue.trim(),
@@ -372,7 +373,7 @@ const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, isAlwa
372
373
  rowVirtualizer.scrollToIndex(activeIndex);
373
374
  }
374
375
  }, [activeIndex, rowVirtualizer]);
375
- const keyLabel = (_a = filter == null ? void 0 : filter.keyLabel) != null ? _a : filter == null ? void 0 : filter.key;
376
+ const keyLabel = (_b = filter == null ? void 0 : filter.keyLabel) != null ? _b : filter == null ? void 0 : filter.key;
376
377
  return /* @__PURE__ */ React.createElement("div", {
377
378
  className: styles.comboboxWrapper
378
379
  }, filter ? /* @__PURE__ */ React.createElement("div", {
@@ -444,7 +445,7 @@ const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, isAlwa
444
445
  }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
445
446
  style: __spreadProps(__spreadValues({}, floatingStyles), {
446
447
  width: `${optionsError ? ERROR_STATE_DROPDOWN_WIDTH : maxOptionWidth}px`,
447
- transform: isMultiValueEdit ? `translate(${((_b = multiValuePillWrapperRef.current) == null ? void 0 : _b.getBoundingClientRect().left) || 0}px, ${(((_c = refs.domReference.current) == null ? void 0 : _c.getBoundingClientRect().bottom) || 0) + 10}px )` : floatingStyles.transform
448
+ transform: isMultiValueEdit ? `translate(${((_c = multiValuePillWrapperRef.current) == null ? void 0 : _c.getBoundingClientRect().left) || 0}px, ${(((_d = refs.domReference.current) == null ? void 0 : _d.getBoundingClientRect().bottom) || 0) + 10}px )` : floatingStyles.transform
448
449
  }),
449
450
  ref: refs.setFloating,
450
451
  className: styles.dropdownWrapper,
@@ -457,7 +458,7 @@ const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, isAlwa
457
458
  tabIndex: -1
458
459
  }), optionsLoading ? /* @__PURE__ */ React.createElement(LoadingOptionsPlaceholder, null) : optionsError ? /* @__PURE__ */ React.createElement(OptionsErrorPlaceholder, {
459
460
  handleFetchOptions: () => handleFetchOptions(filterInputType)
460
- }) : !filteredDropDownItems.length && (filterInputType === "operator" || !inputValue) ? /* @__PURE__ */ React.createElement(NoOptionsPlaceholder, null) : rowVirtualizer.getVirtualItems().map((virtualItem) => {
461
+ }) : !filteredDropDownItems.length && (!allowCustomValue || filterInputType === "operator" || !inputValue) ? /* @__PURE__ */ React.createElement(NoOptionsPlaceholder, null) : rowVirtualizer.getVirtualItems().map((virtualItem) => {
461
462
  var _a2;
462
463
  const item = filteredDropDownItems[virtualItem.index];
463
464
  const index = virtualItem.index;
@@ -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 { 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,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACtC,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAAyC,EAAE,CAAA,CAAA;AACzE,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AACnE,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AAC/D,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,EAAE,CAAA,CAAA;AAC/C,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAwB,IAAI,CAAA,CAAA;AAClE,EAAM,MAAA,CAAC,iBAAiB,YAAY,CAAA,GAAI,SAAyB,CAAC,WAAA,GAAc,UAAU,KAAK,CAAA,CAAA;AAC/F,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AAEnC,EAAA,MAAM,CAAC,iBAAmB,EAAA,oBAAoB,CAAI,GAAA,QAAA,CAAyC,EAAE,CAAA,CAAA;AAC7F,EAAA,MAAM,CAAC,CAAG,EAAA,eAAe,CAAI,GAAA,QAAA,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,EAAA,CAAA;AAAA,IACN,KAAO,EAAA,MAAA;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,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;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 const allowCustomValue = model.state.allowCustomValue ?? true;\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 (allowCustomValue && 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 // note: custom item is added to filteredDropDownItems if allowed\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 &&\n (!allowCustomValue || 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,EAAA,EAAA,CAAA;AAyDE,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACtC,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAAyC,EAAE,CAAA,CAAA;AACzE,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AACnE,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AAC/D,EAAA,MAAM,CAAC,UAAA,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