@grafana/scenes 5.14.2--canary.889.10738135842.0 → 5.14.2--canary.889.10771581250.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,6 @@ class SceneObjectBase {
30
30
  this._deactivationHandlers = /* @__PURE__ */ new Map();
31
31
  this._subs = new Subscription();
32
32
  this._refCount = 0;
33
- this._UNSAFE_PARENT_ACTIVATION = false;
34
33
  if (!state.key) {
35
34
  state.key = v4();
36
35
  }
@@ -187,19 +186,12 @@ class SceneObjectBase {
187
186
  }
188
187
  }
189
188
  activate() {
190
- let parentDeactivate;
191
- if (this.parent && !this.parent.isActive && this._UNSAFE_PARENT_ACTIVATION) {
192
- parentDeactivate = this.parent.activate();
193
- }
194
189
  if (!this.isActive) {
195
190
  this._internalActivate();
196
191
  }
197
192
  this._refCount++;
198
193
  let called = false;
199
194
  return () => {
200
- if (parentDeactivate) {
201
- parentDeactivate();
202
- }
203
195
  this._refCount--;
204
196
  if (called) {
205
197
  const msg = `SceneObject cancelation handler returned by activate() called a second time`;
@@ -1 +1 @@
1
- {"version":3,"file":"SceneObjectBase.js","sources":["../../../src/core/SceneObjectBase.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { Subscription, Unsubscribable } from 'rxjs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BusEvent, BusEventHandler, BusEventType, EventBus, EventBusSrv } from '@grafana/data';\nimport {\n SceneObject,\n SceneComponent,\n SceneObjectUrlSyncHandler,\n SceneStateChangedHandler,\n SceneActivationHandler,\n SceneDeactivationHandler,\n CancelActivationHandler,\n SceneObjectState,\n UseStateHookOptions,\n SceneStatelessBehavior,\n} from './types';\n\nimport { SceneComponentWrapper } from './SceneComponentWrapper';\nimport { SceneObjectStateChangedEvent } from './events';\nimport { cloneSceneObject } from './sceneGraph/utils';\nimport { SceneVariableDependencyConfigLike } from '../variables/types';\nimport { SceneObjectRef } from './SceneObjectRef';\n\nexport abstract class SceneObjectBase<TState extends SceneObjectState = SceneObjectState>\n implements SceneObject<TState>\n{\n private _isActive = false;\n private _state: TState;\n private _activationHandlers: SceneActivationHandler[] = [];\n private _deactivationHandlers = new Map<object, SceneDeactivationHandler>();\n private _ref?: SceneObjectRef<this>;\n\n protected _events?: EventBus;\n protected _parent?: SceneObject;\n protected _subs = new Subscription();\n protected _refCount = 0;\n\n protected _variableDependency: SceneVariableDependencyConfigLike | undefined;\n protected _urlSync: SceneObjectUrlSyncHandler | undefined;\n\n /**\n * @experimental feature to support rendering a child scene object without it's parent being rendered.\n * This flag will make it so that the parent is activated (if it's inactive) when this object is activated.\n */\n public _UNSAFE_PARENT_ACTIVATION = false;\n\n public constructor(state: TState) {\n if (!state.key) {\n state.key = uuidv4();\n }\n\n this._events = new EventBusSrv();\n\n this._state = Object.freeze(state);\n this._setParent(this._state);\n }\n\n /** Current state */\n public get state(): TState {\n return this._state;\n }\n\n /** True if currently being active (ie displayed for visual objects) */\n public get isActive(): boolean {\n return this._isActive;\n }\n\n /** Returns the parent, undefined for root object */\n public get parent(): SceneObject | undefined {\n return this._parent;\n }\n\n /** Returns variable dependency config */\n public get variableDependency(): SceneVariableDependencyConfigLike | undefined {\n return this._variableDependency;\n }\n\n /** Returns url sync config */\n public get urlSync(): SceneObjectUrlSyncHandler | undefined {\n return this._urlSync;\n }\n\n /**\n * Used in render functions when rendering a SceneObject.\n * Wraps the component in an EditWrapper that handles edit mode\n */\n public get Component(): SceneComponent<this> {\n return SceneComponentWrapper as SceneComponent<this>;\n }\n\n private _setParent(state: Partial<TState>) {\n forEachChild(state, (child) => {\n // If we already have a parent and it's not this, then we likely have a bug\n if (child._parent && child._parent !== this) {\n console.warn(\n 'SceneObject already has a parent set that is different from the new parent. You cannot share the same SceneObject instance in multiple scenes or in multiple different places of the same scene graph. Use SceneObject.clone() to duplicate a SceneObject or store a state key reference and use sceneGraph.findObject to locate it.',\n child,\n this\n );\n }\n child._parent = this;\n });\n }\n\n /**\n * Subscribe to the scene state subject\n **/\n public subscribeToState(handler: SceneStateChangedHandler<TState>): Unsubscribable {\n return this._events!.subscribe(SceneObjectStateChangedEvent, (event) => {\n if (event.payload.changedObject === this) {\n handler(event.payload.newState as TState, event.payload.prevState as TState);\n }\n });\n }\n\n /**\n * Subscribe to the scene event\n **/\n public subscribeToEvent<T extends BusEvent>(eventType: BusEventType<T>, handler: BusEventHandler<T>): Unsubscribable {\n return this._events!.subscribe(eventType, handler);\n }\n\n public setState(update: Partial<TState>) {\n const prevState = this._state;\n const newState: TState = {\n ...this._state,\n ...update,\n };\n\n this._state = Object.freeze(newState);\n this._setParent(update);\n\n // Handles cases when $data, $timeRange, or $variables are changed\n this._handleActivationOfChangedStateProps(prevState, newState);\n\n // Bubble state change event. This is event is subscribed to by UrlSyncManager and UndoManager\n this.publishEvent(\n new SceneObjectStateChangedEvent({\n prevState,\n newState,\n partialUpdate: update,\n changedObject: this,\n }),\n true\n );\n }\n\n /**\n * This handles activation and deactivation of $data, $timeRange and $variables when they change\n * during the active phase of the scene object.\n */\n private _handleActivationOfChangedStateProps(prevState: TState, newState: TState) {\n if (!this.isActive) {\n return;\n }\n\n if (prevState.$behaviors !== newState.$behaviors) {\n this._handleChangedBehaviors(prevState.$behaviors, newState.$behaviors);\n }\n\n if (prevState.$data !== newState.$data) {\n this._handleChangedStateActivation(prevState.$data, newState.$data);\n }\n\n if (prevState.$variables !== newState.$variables) {\n this._handleChangedStateActivation(prevState.$variables, newState.$variables);\n }\n\n if (prevState.$timeRange !== newState.$timeRange) {\n this._handleChangedStateActivation(prevState.$timeRange, newState.$timeRange);\n }\n }\n\n private _handleChangedStateActivation(oldValue: SceneObject | undefined, newValue: SceneObject | undefined) {\n if (oldValue) {\n const deactivationHandler = this._deactivationHandlers.get(oldValue);\n if (deactivationHandler) {\n deactivationHandler();\n this._deactivationHandlers.delete(oldValue);\n }\n }\n\n if (newValue) {\n this._deactivationHandlers.set(newValue, newValue.activate());\n }\n }\n\n private _handleChangedBehaviors(\n oldValue: Array<SceneObject | SceneStatelessBehavior> | undefined,\n newValue: Array<SceneObject | SceneStatelessBehavior> | undefined\n ) {\n // Handle removed behaviors\n if (oldValue) {\n for (const oldBehavior of oldValue) {\n if (!newValue || !newValue.includes(oldBehavior)) {\n const deactivationHandler = this._deactivationHandlers.get(oldBehavior);\n if (deactivationHandler) {\n deactivationHandler();\n this._deactivationHandlers.delete(oldBehavior);\n }\n }\n }\n }\n\n // Handle new behaviors\n if (newValue) {\n for (const newBehavior of newValue) {\n if (!oldValue || !oldValue.includes(newBehavior)) {\n this._activateBehavior(newBehavior);\n }\n }\n }\n }\n\n /*\n * Publish an event and optionally bubble it up the scene\n **/\n public publishEvent(event: BusEvent, bubble?: boolean) {\n this._events!.publish(event);\n\n if (bubble && this.parent) {\n this.parent.publishEvent(event, bubble);\n }\n }\n\n public getRoot(): SceneObject {\n return !this._parent ? this : this._parent.getRoot();\n }\n\n private _internalActivate() {\n this._isActive = true;\n\n const { $data, $variables, $timeRange, $behaviors } = this.state;\n\n this._activationHandlers.forEach((handler) => {\n const result = handler();\n if (result) {\n this._deactivationHandlers.set(result, result);\n }\n });\n\n if ($timeRange && !$timeRange.isActive) {\n this._deactivationHandlers.set($timeRange, $timeRange.activate());\n }\n\n if ($variables && !$variables.isActive) {\n this._deactivationHandlers.set($variables, $variables.activate());\n }\n\n if ($data && !$data.isActive) {\n this._deactivationHandlers.set($data, $data.activate());\n }\n\n if ($behaviors) {\n for (const behavior of $behaviors) {\n this._activateBehavior(behavior);\n }\n }\n }\n\n private _activateBehavior(behavior: SceneObject | SceneStatelessBehavior): SceneDeactivationHandler | void {\n if (behavior instanceof SceneObjectBase) {\n this._deactivationHandlers.set(behavior, behavior.activate());\n } else if (typeof behavior === 'function') {\n const deactivate = behavior(this);\n if (deactivate) {\n this._deactivationHandlers.set(behavior, deactivate);\n }\n }\n }\n\n /**\n * This is primarily called from SceneComponentWrapper when the SceneObject's Component is mounted.\n * But in some scenarios this can also be called directly from another scene object. When called manually from another scene object\n * make sure to call the returned function when the source scene object is deactivated.\n */\n public activate(): CancelActivationHandler {\n // If parent is not active, activate parent first\n let parentDeactivate: CancelActivationHandler | undefined;\n if (this.parent && !this.parent.isActive && this._UNSAFE_PARENT_ACTIVATION) {\n parentDeactivate = this.parent.activate();\n }\n\n if (!this.isActive) {\n this._internalActivate();\n }\n\n this._refCount++;\n\n let called = false;\n\n return () => {\n if (parentDeactivate) {\n parentDeactivate();\n }\n\n this._refCount--;\n\n if (called) {\n const msg = `SceneObject cancelation handler returned by activate() called a second time`;\n throw new Error(msg);\n }\n\n called = true;\n\n if (this._refCount === 0) {\n this._internalDeactivate();\n }\n };\n }\n\n /**\n * Called by the SceneComponentWrapper when the react component is unmounted.\n * Don't override this, instead use addActivationHandler. The activation handler can return a deactivation handler.\n */\n private _internalDeactivate(): void {\n this._isActive = false;\n\n for (let handler of this._deactivationHandlers.values()) {\n handler();\n }\n\n this._deactivationHandlers.clear();\n\n // Clear subscriptions and listeners\n this._events!.removeAllListeners();\n this._subs.unsubscribe();\n this._subs = new Subscription();\n }\n\n /**\n * Utility hook to get and subscribe to state\n */\n public useState(): TState {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSceneObjectState(this);\n }\n\n /** Force a re-render, should only be needed when variable values change */\n public forceRender(): void {\n this.setState({});\n }\n\n /**\n * Will create new SceneObject with shallow-cloned state, but all state items of type SceneObject are deep cloned\n */\n public clone(withState?: Partial<TState>): this {\n return cloneSceneObject(this, withState);\n }\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 public addActivationHandler(handler: SceneActivationHandler) {\n this._activationHandlers.push(handler);\n }\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 public forEachChild(callback: (child: SceneObjectBase) => void) {\n forEachChild(this.state, callback);\n }\n\n /** Returns a SceneObjectRef that will resolve to this object */\n public getRef(): SceneObjectRef<this> {\n if (!this._ref) {\n this._ref = new SceneObjectRef(this);\n }\n\n return this._ref;\n }\n}\n\n/**\n * This hook is always returning model.state instead of a useState that remembers the last state emitted on the subject\n * The reason for this is so that if the model instance change this function will always return the latest state.\n */\nexport function useSceneObjectState<TState extends SceneObjectState>(\n model: SceneObject<TState>,\n options?: UseStateHookOptions\n): TState {\n const [_, setState] = useState<TState>(model.state);\n const stateAtFirstRender = model.state;\n const shouldActivateOrKeepAlive = options?.shouldActivateOrKeepAlive ?? false;\n\n useEffect(() => {\n let unactivate: CancelActivationHandler | undefined;\n\n if (shouldActivateOrKeepAlive) {\n unactivate = model.activate();\n }\n\n const s = model.subscribeToState((state) => {\n setState(state);\n });\n\n // Re-render component if the state changed between first render and useEffect (mount)\n if (model.state !== stateAtFirstRender) {\n setState(model.state);\n }\n\n return () => {\n s.unsubscribe();\n\n if (unactivate) {\n unactivate();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [model, shouldActivateOrKeepAlive]);\n\n return model.state;\n}\n\nfunction forEachChild<T extends object>(state: T, callback: (child: SceneObjectBase) => void) {\n for (const propValue of Object.values(state)) {\n if (propValue instanceof SceneObjectBase) {\n callback(propValue);\n }\n\n if (Array.isArray(propValue)) {\n for (const child of propValue) {\n if (child instanceof SceneObjectBase) {\n callback(child);\n }\n }\n }\n }\n}\n"],"names":["uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAe,eAEtB,CAAA;AAAA,EAqBS,YAAY,KAAe,EAAA;AApBlC,IAAA,IAAA,CAAQ,SAAY,GAAA,KAAA,CAAA;AAEpB,IAAA,IAAA,CAAQ,sBAAgD,EAAC,CAAA;AACzD,IAAQ,IAAA,CAAA,qBAAA,uBAA4B,GAAsC,EAAA,CAAA;AAK1E,IAAU,IAAA,CAAA,KAAA,GAAQ,IAAI,YAAa,EAAA,CAAA;AACnC,IAAA,IAAA,CAAU,SAAY,GAAA,CAAA,CAAA;AAStB,IAAA,IAAA,CAAO,yBAA4B,GAAA,KAAA,CAAA;AAGjC,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MAAA,UAAA,GAAa,MAAM,QAAS,EAAA,CAAA;AAAA,KAC9B;AAEA,IAAA,MAAM,CAAI,GAAA,KAAA,CAAM,gBAAiB,CAAA,CAAC,KAAU,KAAA;AAC1C,MAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAAA,KACf,CAAA,CAAA;AAGD,IAAI,IAAA,KAAA,CAAM,UAAU,kBAAoB,EAAA;AACtC,MAAA,QAAA,CAAS,MAAM,KAAK,CAAA,CAAA;AAAA,KACtB;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,CAAA,CAAE,WAAY,EAAA,CAAA;AAEd,MAAA,IAAI,UAAY,EAAA;AACd,QAAW,UAAA,EAAA,CAAA;AAAA,OACb;AAAA,KACF,CAAA;AAAA,GAEC,EAAA,CAAC,KAAO,EAAA,yBAAyB,CAAC,CAAA,CAAA;AAErC,EAAA,OAAO,KAAM,CAAA,KAAA,CAAA;AACf,CAAA;AAEA,SAAS,YAAA,CAA+B,OAAU,QAA4C,EAAA;AAC5F,EAAA,KAAA,MAAW,SAAa,IAAA,MAAA,CAAO,MAAO,CAAA,KAAK,CAAG,EAAA;AAC5C,IAAA,IAAI,qBAAqB,eAAiB,EAAA;AACxC,MAAA,QAAA,CAAS,SAAS,CAAA,CAAA;AAAA,KACpB;AAEA,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,SAAS,CAAG,EAAA;AAC5B,MAAA,KAAA,MAAW,SAAS,SAAW,EAAA;AAC7B,QAAA,IAAI,iBAAiB,eAAiB,EAAA;AACpC,UAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAAA,SAChB;AAAA,OACF;AAAA,KACF;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"SceneObjectBase.js","sources":["../../../src/core/SceneObjectBase.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { Subscription, Unsubscribable } from 'rxjs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BusEvent, BusEventHandler, BusEventType, EventBus, EventBusSrv } from '@grafana/data';\nimport {\n SceneObject,\n SceneComponent,\n SceneObjectUrlSyncHandler,\n SceneStateChangedHandler,\n SceneActivationHandler,\n SceneDeactivationHandler,\n CancelActivationHandler,\n SceneObjectState,\n UseStateHookOptions,\n SceneStatelessBehavior,\n} from './types';\n\nimport { SceneComponentWrapper } from './SceneComponentWrapper';\nimport { SceneObjectStateChangedEvent } from './events';\nimport { cloneSceneObject } from './sceneGraph/utils';\nimport { SceneVariableDependencyConfigLike } from '../variables/types';\nimport { SceneObjectRef } from './SceneObjectRef';\n\nexport abstract class SceneObjectBase<TState extends SceneObjectState = SceneObjectState>\n implements SceneObject<TState>\n{\n private _isActive = false;\n private _state: TState;\n private _activationHandlers: SceneActivationHandler[] = [];\n private _deactivationHandlers = new Map<object, SceneDeactivationHandler>();\n private _ref?: SceneObjectRef<this>;\n\n protected _events?: EventBus;\n protected _parent?: SceneObject;\n protected _subs = new Subscription();\n protected _refCount = 0;\n\n protected _variableDependency: SceneVariableDependencyConfigLike | undefined;\n protected _urlSync: SceneObjectUrlSyncHandler | undefined;\n\n public constructor(state: TState) {\n if (!state.key) {\n state.key = uuidv4();\n }\n\n this._events = new EventBusSrv();\n\n this._state = Object.freeze(state);\n this._setParent(this._state);\n }\n\n /** Current state */\n public get state(): TState {\n return this._state;\n }\n\n /** True if currently being active (ie displayed for visual objects) */\n public get isActive(): boolean {\n return this._isActive;\n }\n\n /** Returns the parent, undefined for root object */\n public get parent(): SceneObject | undefined {\n return this._parent;\n }\n\n /** Returns variable dependency config */\n public get variableDependency(): SceneVariableDependencyConfigLike | undefined {\n return this._variableDependency;\n }\n\n /** Returns url sync config */\n public get urlSync(): SceneObjectUrlSyncHandler | undefined {\n return this._urlSync;\n }\n\n /**\n * Used in render functions when rendering a SceneObject.\n * Wraps the component in an EditWrapper that handles edit mode\n */\n public get Component(): SceneComponent<this> {\n return SceneComponentWrapper as SceneComponent<this>;\n }\n\n private _setParent(state: Partial<TState>) {\n forEachChild(state, (child) => {\n // If we already have a parent and it's not this, then we likely have a bug\n if (child._parent && child._parent !== this) {\n console.warn(\n 'SceneObject already has a parent set that is different from the new parent. You cannot share the same SceneObject instance in multiple scenes or in multiple different places of the same scene graph. Use SceneObject.clone() to duplicate a SceneObject or store a state key reference and use sceneGraph.findObject to locate it.',\n child,\n this\n );\n }\n child._parent = this;\n });\n }\n\n /**\n * Subscribe to the scene state subject\n **/\n public subscribeToState(handler: SceneStateChangedHandler<TState>): Unsubscribable {\n return this._events!.subscribe(SceneObjectStateChangedEvent, (event) => {\n if (event.payload.changedObject === this) {\n handler(event.payload.newState as TState, event.payload.prevState as TState);\n }\n });\n }\n\n /**\n * Subscribe to the scene event\n **/\n public subscribeToEvent<T extends BusEvent>(eventType: BusEventType<T>, handler: BusEventHandler<T>): Unsubscribable {\n return this._events!.subscribe(eventType, handler);\n }\n\n public setState(update: Partial<TState>) {\n const prevState = this._state;\n const newState: TState = {\n ...this._state,\n ...update,\n };\n\n this._state = Object.freeze(newState);\n this._setParent(update);\n\n // Handles cases when $data, $timeRange, or $variables are changed\n this._handleActivationOfChangedStateProps(prevState, newState);\n\n // Bubble state change event. This is event is subscribed to by UrlSyncManager and UndoManager\n this.publishEvent(\n new SceneObjectStateChangedEvent({\n prevState,\n newState,\n partialUpdate: update,\n changedObject: this,\n }),\n true\n );\n }\n\n /**\n * This handles activation and deactivation of $data, $timeRange and $variables when they change\n * during the active phase of the scene object.\n */\n private _handleActivationOfChangedStateProps(prevState: TState, newState: TState) {\n if (!this.isActive) {\n return;\n }\n\n if (prevState.$behaviors !== newState.$behaviors) {\n this._handleChangedBehaviors(prevState.$behaviors, newState.$behaviors);\n }\n\n if (prevState.$data !== newState.$data) {\n this._handleChangedStateActivation(prevState.$data, newState.$data);\n }\n\n if (prevState.$variables !== newState.$variables) {\n this._handleChangedStateActivation(prevState.$variables, newState.$variables);\n }\n\n if (prevState.$timeRange !== newState.$timeRange) {\n this._handleChangedStateActivation(prevState.$timeRange, newState.$timeRange);\n }\n }\n\n private _handleChangedStateActivation(oldValue: SceneObject | undefined, newValue: SceneObject | undefined) {\n if (oldValue) {\n const deactivationHandler = this._deactivationHandlers.get(oldValue);\n if (deactivationHandler) {\n deactivationHandler();\n this._deactivationHandlers.delete(oldValue);\n }\n }\n\n if (newValue) {\n this._deactivationHandlers.set(newValue, newValue.activate());\n }\n }\n\n private _handleChangedBehaviors(\n oldValue: Array<SceneObject | SceneStatelessBehavior> | undefined,\n newValue: Array<SceneObject | SceneStatelessBehavior> | undefined\n ) {\n // Handle removed behaviors\n if (oldValue) {\n for (const oldBehavior of oldValue) {\n if (!newValue || !newValue.includes(oldBehavior)) {\n const deactivationHandler = this._deactivationHandlers.get(oldBehavior);\n if (deactivationHandler) {\n deactivationHandler();\n this._deactivationHandlers.delete(oldBehavior);\n }\n }\n }\n }\n\n // Handle new behaviors\n if (newValue) {\n for (const newBehavior of newValue) {\n if (!oldValue || !oldValue.includes(newBehavior)) {\n this._activateBehavior(newBehavior);\n }\n }\n }\n }\n\n /*\n * Publish an event and optionally bubble it up the scene\n **/\n public publishEvent(event: BusEvent, bubble?: boolean) {\n this._events!.publish(event);\n\n if (bubble && this.parent) {\n this.parent.publishEvent(event, bubble);\n }\n }\n\n public getRoot(): SceneObject {\n return !this._parent ? this : this._parent.getRoot();\n }\n\n private _internalActivate() {\n this._isActive = true;\n\n const { $data, $variables, $timeRange, $behaviors } = this.state;\n\n this._activationHandlers.forEach((handler) => {\n const result = handler();\n if (result) {\n this._deactivationHandlers.set(result, result);\n }\n });\n\n if ($timeRange && !$timeRange.isActive) {\n this._deactivationHandlers.set($timeRange, $timeRange.activate());\n }\n\n if ($variables && !$variables.isActive) {\n this._deactivationHandlers.set($variables, $variables.activate());\n }\n\n if ($data && !$data.isActive) {\n this._deactivationHandlers.set($data, $data.activate());\n }\n\n if ($behaviors) {\n for (const behavior of $behaviors) {\n this._activateBehavior(behavior);\n }\n }\n }\n\n private _activateBehavior(behavior: SceneObject | SceneStatelessBehavior): SceneDeactivationHandler | void {\n if (behavior instanceof SceneObjectBase) {\n this._deactivationHandlers.set(behavior, behavior.activate());\n } else if (typeof behavior === 'function') {\n const deactivate = behavior(this);\n if (deactivate) {\n this._deactivationHandlers.set(behavior, deactivate);\n }\n }\n }\n\n /**\n * This is primarily called from SceneComponentWrapper when the SceneObject's Component is mounted.\n * But in some scenarios this can also be called directly from another scene object. When called manually from another scene object\n * make sure to call the returned function when the source scene object is deactivated.\n */\n public activate(): CancelActivationHandler {\n if (!this.isActive) {\n this._internalActivate();\n }\n\n this._refCount++;\n\n let called = false;\n\n return () => {\n this._refCount--;\n\n if (called) {\n const msg = `SceneObject cancelation handler returned by activate() called a second time`;\n throw new Error(msg);\n }\n\n called = true;\n\n if (this._refCount === 0) {\n this._internalDeactivate();\n }\n };\n }\n\n /**\n * Called by the SceneComponentWrapper when the react component is unmounted.\n * Don't override this, instead use addActivationHandler. The activation handler can return a deactivation handler.\n */\n private _internalDeactivate(): void {\n this._isActive = false;\n\n for (let handler of this._deactivationHandlers.values()) {\n handler();\n }\n\n this._deactivationHandlers.clear();\n\n // Clear subscriptions and listeners\n this._events!.removeAllListeners();\n this._subs.unsubscribe();\n this._subs = new Subscription();\n }\n\n /**\n * Utility hook to get and subscribe to state\n */\n public useState(): TState {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSceneObjectState(this);\n }\n\n /** Force a re-render, should only be needed when variable values change */\n public forceRender(): void {\n this.setState({});\n }\n\n /**\n * Will create new SceneObject with shallow-cloned state, but all state items of type SceneObject are deep cloned\n */\n public clone(withState?: Partial<TState>): this {\n return cloneSceneObject(this, withState);\n }\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 public addActivationHandler(handler: SceneActivationHandler) {\n this._activationHandlers.push(handler);\n }\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 public forEachChild(callback: (child: SceneObjectBase) => void) {\n forEachChild(this.state, callback);\n }\n\n /** Returns a SceneObjectRef that will resolve to this object */\n public getRef(): SceneObjectRef<this> {\n if (!this._ref) {\n this._ref = new SceneObjectRef(this);\n }\n\n return this._ref;\n }\n}\n\n/**\n * This hook is always returning model.state instead of a useState that remembers the last state emitted on the subject\n * The reason for this is so that if the model instance change this function will always return the latest state.\n */\nexport function useSceneObjectState<TState extends SceneObjectState>(\n model: SceneObject<TState>,\n options?: UseStateHookOptions\n): TState {\n const [_, setState] = useState<TState>(model.state);\n const stateAtFirstRender = model.state;\n const shouldActivateOrKeepAlive = options?.shouldActivateOrKeepAlive ?? false;\n\n useEffect(() => {\n let unactivate: CancelActivationHandler | undefined;\n\n if (shouldActivateOrKeepAlive) {\n unactivate = model.activate();\n }\n\n const s = model.subscribeToState((state) => {\n setState(state);\n });\n\n // Re-render component if the state changed between first render and useEffect (mount)\n if (model.state !== stateAtFirstRender) {\n setState(model.state);\n }\n\n return () => {\n s.unsubscribe();\n\n if (unactivate) {\n unactivate();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [model, shouldActivateOrKeepAlive]);\n\n return model.state;\n}\n\nfunction forEachChild<T extends object>(state: T, callback: (child: SceneObjectBase) => void) {\n for (const propValue of Object.values(state)) {\n if (propValue instanceof SceneObjectBase) {\n callback(propValue);\n }\n\n if (Array.isArray(propValue)) {\n for (const child of propValue) {\n if (child instanceof SceneObjectBase) {\n callback(child);\n }\n }\n }\n }\n}\n"],"names":["uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAe,eAEtB,CAAA;AAAA,EAeS,YAAY,KAAe,EAAA;AAdlC,IAAA,IAAA,CAAQ,SAAY,GAAA,KAAA,CAAA;AAEpB,IAAA,IAAA,CAAQ,sBAAgD,EAAC,CAAA;AACzD,IAAQ,IAAA,CAAA,qBAAA,uBAA4B,GAAsC,EAAA,CAAA;AAK1E,IAAU,IAAA,CAAA,KAAA,GAAQ,IAAI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AI,IAAA,KAAA,CAAM,UAAU,kBAAoB,EAAA;AACtC,MAAA,QAAA,CAAS,MAAM,KAAK,CAAA,CAAA;AAAA,KACtB;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,CAAA,CAAE,WAAY,EAAA,CAAA;AAEd,MAAA,IAAI,UAAY,EAAA;AACd,QAAW,UAAA,EAAA,CAAA;AAAA,OACb;AAAA,KACF,CAAA;AAAA,GAEC,EAAA,CAAC,KAAO,EAAA,yBAAyB,CAAC,CAAA,CAAA;AAErC,EAAA,OAAO,KAAM,CAAA,KAAA,CAAA;AACf,CAAA;AAEA,SAAS,YAAA,CAA+B,OAAU,QAA4C,EAAA;AAC5F,EAAA,KAAA,MAAW,SAAa,IAAA,MAAA,CAAO,MAAO,CAAA,KAAK,CAAG,EAAA;AAC5C,IAAA,IAAI,qBAAqB,eAAiB,EAAA;AACxC,MAAA,QAAA,CAAS,SAAS,CAAA,CAAA;AAAA,KACpB;AAEA,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,SAAS,CAAG,EAAA;AAC5B,MAAA,KAAA,MAAW,SAAS,SAAW,EAAA;AAC7B,QAAA,IAAI,iBAAiB,eAAiB,EAAA;AACpC,UAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAAA,SAChB;AAAA,OACF;AAAA,KACF;AAAA,GACF;AACF;;;;"}
@@ -49,6 +49,9 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnInputRef }) {
49
49
  }
50
50
  }, [shouldFocus]);
51
51
  if (viewMode) {
52
+ const pillText = /* @__PURE__ */ React.createElement("span", {
53
+ className: styles.pillText
54
+ }, keyLabel, " ", filter.operator, " ", valueLabel);
52
55
  return /* @__PURE__ */ React.createElement("div", {
53
56
  className: cx(styles.combinedFilterPill, { [styles.readOnlyCombinedFilter]: readOnly }),
54
57
  onClick: handleChangeViewMode,
@@ -61,15 +64,12 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnInputRef }) {
61
64
  "aria-label": `Edit filter with key ${keyLabel}`,
62
65
  tabIndex: 0,
63
66
  ref: pillWrapperRef
64
- }, /* @__PURE__ */ React.createElement(Tooltip, {
65
- show: valueLabel.length < 20 ? false : void 0,
67
+ }, valueLabel.length < 20 ? pillText : /* @__PURE__ */ React.createElement(Tooltip, {
66
68
  content: /* @__PURE__ */ React.createElement("div", {
67
69
  className: styles.tooltipText
68
70
  }, valueLabel),
69
71
  placement: "top"
70
- }, /* @__PURE__ */ React.createElement("span", {
71
- className: styles.pillText
72
- }, keyLabel, " ", filter.operator, " ", valueLabel)), !readOnly ? /* @__PURE__ */ React.createElement(IconButton, {
72
+ }, pillText), !readOnly ? /* @__PURE__ */ React.createElement(IconButton, {
73
73
  onClick: (e) => {
74
74
  e.stopPropagation();
75
75
  model._removeFilter(filter);
@@ -1 +1 @@
1
- {"version":3,"file":"AdHocFilterPill.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.tsx"],"sourcesContent":["import { css, cx } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2, IconButton, Tooltip } from '@grafana/ui';\nimport React, { useState, useRef, useCallback, useEffect } from 'react';\nimport { AdHocCombobox } from './AdHocFiltersCombobox';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable } from '../AdHocFiltersVariable';\n\ninterface Props {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n readOnly?: boolean;\n focusOnInputRef?: () => void;\n}\n\nexport function AdHocFilterPill({ filter, model, readOnly, focusOnInputRef }: Props) {\n const styles = useStyles2(getStyles);\n const [viewMode, setViewMode] = useState(true);\n const [shouldFocus, setShouldFocus] = useState(false);\n const pillWrapperRef = useRef<HTMLDivElement>(null);\n\n const keyLabel = filter.keyLabel ?? filter.key;\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const valueLabel = filter.valueLabels?.join(', ') || filter.values?.join(', ') || filter.value;\n\n const handleChangeViewMode = useCallback(\n (event?: React.MouseEvent) => {\n event?.stopPropagation();\n if (readOnly) {\n return;\n }\n\n setShouldFocus(!viewMode);\n setViewMode(!viewMode);\n },\n [readOnly, viewMode]\n );\n\n useEffect(() => {\n if (shouldFocus) {\n pillWrapperRef.current?.focus();\n setShouldFocus(false);\n }\n }, [shouldFocus]);\n\n if (viewMode) {\n return (\n <div\n className={cx(styles.combinedFilterPill, { [styles.readOnlyCombinedFilter]: readOnly })}\n onClick={handleChangeViewMode}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n handleChangeViewMode();\n }\n }}\n role=\"button\"\n aria-label={`Edit filter with key ${keyLabel}`}\n tabIndex={0}\n ref={pillWrapperRef}\n >\n <Tooltip\n show={valueLabel.length < 20 ? false : undefined}\n content={<div className={styles.tooltipText}>{valueLabel}</div>}\n placement=\"top\"\n >\n <span className={styles.pillText}>\n {keyLabel} {filter.operator} {valueLabel}\n </span>\n </Tooltip>\n {!readOnly ? (\n <IconButton\n onClick={(e) => {\n e.stopPropagation();\n model._removeFilter(filter);\n setTimeout(() => focusOnInputRef?.());\n }}\n onKeyDownCapture={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n model._removeFilter(filter);\n setTimeout(() => focusOnInputRef?.());\n }\n }}\n name=\"times\"\n size=\"md\"\n className={styles.removeButton}\n tooltip={`Remove filter with key ${keyLabel}`}\n />\n ) : null}\n </div>\n );\n }\n\n return <AdHocCombobox filter={filter} model={model} handleChangeViewMode={handleChangeViewMode} />;\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n combinedFilterPill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.selected,\n borderRadius: theme.shape.radius.default,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 0, 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 fontWeight: theme.typography.fontWeightBold,\n cursor: 'pointer',\n\n '&:hover': {\n background: theme.colors.action.hover,\n },\n }),\n readOnlyCombinedFilter: css({\n paddingRight: theme.spacing(1),\n cursor: 'text',\n '&:hover': {\n background: theme.colors.action.selected,\n },\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n pillText: css({\n maxWidth: '200px',\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n }),\n tooltipText: css({\n textAlign: 'center',\n }),\n});\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcO,SAAS,gBAAgB,EAAE,MAAA,EAAQ,KAAO,EAAA,QAAA,EAAU,iBAA0B,EAAA;AAdrF,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAeE,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AACnC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,IAAI,CAAA,CAAA;AAC7C,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACpD,EAAM,MAAA,cAAA,GAAiB,OAAuB,IAAI,CAAA,CAAA;AAElD,EAAA,MAAM,QAAW,GAAA,CAAA,EAAA,GAAA,MAAA,CAAO,QAAP,KAAA,IAAA,GAAA,EAAA,GAAmB,MAAO,CAAA,GAAA,CAAA;AAG3C,EAAM,MAAA,UAAA,GAAA,CAAA,CAAa,EAAO,GAAA,MAAA,CAAA,WAAA,KAAP,IAAoB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAK,IAAS,CAAA,MAAA,CAAA,EAAA,GAAA,MAAA,CAAO,MAAP,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAe,IAAK,CAAA,IAAA,CAAA,CAAA,IAAS,MAAO,CAAA,KAAA,CAAA;AAEzF,EAAA,MAAM,oBAAuB,GAAA,WAAA;AAAA,IAC3B,CAAC,KAA6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A,MACT,UAAA,EAAY,KAAM,CAAA,MAAA,CAAO,MAAO,CAAA,QAAA;AAAA,KAClC;AAAA,GACD,CAAA;AAAA,EACD,cAAc,GAAI,CAAA;AAAA,IAChB,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC/B,MAAQ,EAAA,SAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,KAC3B;AAAA,GACD,CAAA;AAAA,EACD,UAAU,GAAI,CAAA;AAAA,IACZ,QAAU,EAAA,OAAA;AAAA,IACV,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA,QAAA;AAAA,GACX,CAAA;AAAA,EACD,aAAa,GAAI,CAAA;AAAA,IACf,SAAW,EAAA,QAAA;AAAA,GACZ,CAAA;AACH,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"AdHocFilterPill.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.tsx"],"sourcesContent":["import { css, cx } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2, IconButton, Tooltip } from '@grafana/ui';\nimport React, { useState, useRef, useCallback, useEffect } from 'react';\nimport { AdHocCombobox } from './AdHocFiltersCombobox';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable } from '../AdHocFiltersVariable';\n\ninterface Props {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n readOnly?: boolean;\n focusOnInputRef?: () => void;\n}\n\nexport function AdHocFilterPill({ filter, model, readOnly, focusOnInputRef }: Props) {\n const styles = useStyles2(getStyles);\n const [viewMode, setViewMode] = useState(true);\n const [shouldFocus, setShouldFocus] = useState(false);\n const pillWrapperRef = useRef<HTMLDivElement>(null);\n\n const keyLabel = filter.keyLabel ?? filter.key;\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const valueLabel = filter.valueLabels?.join(', ') || filter.values?.join(', ') || filter.value;\n\n const handleChangeViewMode = useCallback(\n (event?: React.MouseEvent) => {\n event?.stopPropagation();\n if (readOnly) {\n return;\n }\n\n setShouldFocus(!viewMode);\n setViewMode(!viewMode);\n },\n [readOnly, viewMode]\n );\n\n useEffect(() => {\n if (shouldFocus) {\n pillWrapperRef.current?.focus();\n setShouldFocus(false);\n }\n }, [shouldFocus]);\n\n if (viewMode) {\n const pillText = (\n <span className={styles.pillText}>\n {keyLabel} {filter.operator} {valueLabel}\n </span>\n );\n return (\n <div\n className={cx(styles.combinedFilterPill, { [styles.readOnlyCombinedFilter]: readOnly })}\n onClick={handleChangeViewMode}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n handleChangeViewMode();\n }\n }}\n role=\"button\"\n aria-label={`Edit filter with key ${keyLabel}`}\n tabIndex={0}\n ref={pillWrapperRef}\n >\n {valueLabel.length < 20 ? (\n pillText\n ) : (\n <Tooltip content={<div className={styles.tooltipText}>{valueLabel}</div>} placement=\"top\">\n {pillText}\n </Tooltip>\n )}\n\n {!readOnly ? (\n <IconButton\n onClick={(e) => {\n e.stopPropagation();\n model._removeFilter(filter);\n setTimeout(() => focusOnInputRef?.());\n }}\n onKeyDownCapture={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n model._removeFilter(filter);\n setTimeout(() => focusOnInputRef?.());\n }\n }}\n name=\"times\"\n size=\"md\"\n className={styles.removeButton}\n tooltip={`Remove filter with key ${keyLabel}`}\n />\n ) : null}\n </div>\n );\n }\n\n return <AdHocCombobox filter={filter} model={model} handleChangeViewMode={handleChangeViewMode} />;\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n combinedFilterPill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.selected,\n borderRadius: theme.shape.radius.default,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 0, 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 fontWeight: theme.typography.fontWeightBold,\n cursor: 'pointer',\n\n '&:hover': {\n background: theme.colors.action.hover,\n },\n }),\n readOnlyCombinedFilter: css({\n paddingRight: theme.spacing(1),\n cursor: 'text',\n '&:hover': {\n background: theme.colors.action.selected,\n },\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n pillText: css({\n maxWidth: '200px',\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n }),\n tooltipText: css({\n textAlign: 'center',\n }),\n});\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcO,SAAS,gBAAgB,EAAE,MAAA,EAAQ,KAAO,EAAA,QAAA,EAAU,iBAA0B,EAAA;AAdrF,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAeE,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AACnC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,IAAI,CAAA,CAAA;AAC7C,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACpD,EAAM,MAAA,cAAA,GAAiB,OAAuB,IAAI,CAAA,CAAA;AAElD,EAAA,MAAM,QAAW,GAAA,CAAA,EAAA,GAAA,MAAA,CAAO,QAAP,KAAA,IAAA,GAAA,EAAA,GAAmB,MAAO,CAAA,GAAA,CAAA;AAG3C,EAAM,MAAA,UAAA,GAAA,CAAA,CAAa,EAAO,GAAA,MAAA,CAAA,WAAA,KAAP,IAAoB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAK,IAAS,CAAA,MAAA,CAAA,EAAA,GAAA,MAAA,CAAO,MAAP,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,C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AAA;AAAA,IAC1B,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC7B,MAAQ,EAAA,MAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,UAAA,EAAY,KAAM,CAAA,MAAA,CAAO,MAAO,CAAA,QAAA;AAAA,KAClC;AAAA,GACD,CAAA;AAAA,EACD,cAAc,GAAI,CAAA;AAAA,IAChB,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC/B,MAAQ,EAAA,SAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,KAC3B;AAAA,GACD,CAAA;AAAA,EACD,UAAU,GAAI,CAAA;AAAA,IACZ,QAAU,EAAA,OAAA;AAAA,IACV,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA,QAAA;AAAA,GACX,CAAA;AAAA,EACD,aAAa,GAAI,CAAA;AAAA,IACf,SAAW,EAAA,QAAA;AAAA,GACZ,CAAA;AACH,CAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AdHocFiltersCombobox.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { FloatingFocusManager, FloatingPortal, UseFloatingOptions } from '@floating-ui/react';\nimport { Button, Icon, Spinner, Text, useStyles2 } from '@grafana/ui';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable, OPERATORS } from '../AdHocFiltersVariable';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport {\n DropdownItem,\n LoadingOptionsPlaceholder,\n MultiValueApplyButton,\n NoOptionsPlaceholder,\n OptionsErrorPlaceholder,\n} from './DropdownItem';\nimport {\n ERROR_STATE_DROPDOWN_WIDTH,\n flattenOptionGroups,\n fuzzySearchOptions,\n generateFilterUpdatePayload,\n generatePlaceholder,\n setupDropdownAccessibility,\n switchInputType,\n switchToNextInputType,\n VIRTUAL_LIST_ITEM_HEIGHT,\n VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION,\n VIRTUAL_LIST_OVERSCAN,\n} from './utils';\nimport { handleOptionGroups } from '../../utils';\nimport { useFloatingInteractions } from './useFloatingInteractions';\n\ninterface AdHocComboboxProps {\n filter?: AdHocFilterWithLabels;\n isAlwaysWip?: boolean;\n model: AdHocFiltersVariable;\n handleChangeViewMode?: () => void;\n}\n\nexport type AdHocInputType = 'key' | 'operator' | 'value';\n\nexport const AdHocCombobox = forwardRef(function AdHocCombobox(\n { filter, model, isAlwaysWip, handleChangeViewMode }: 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 multiValueOperators = useMemo(\n () => OPERATORS.reduce<string[]>((acc, operator) => (operator.isMulti ? [...acc, operator.value!] : acc), []),\n []\n );\n\n const hasMultiValueOperator = multiValueOperators.includes(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 // reset wip filter. Used when navigating away with incomplete wip filer or when selecting wip filter value\n const handleResetWip = useCallback(() => {\n if (isAlwaysWip) {\n model._addWip();\n setInputType('key');\n setInputValue('');\n }\n }, [model, isAlwaysWip]);\n\n const handleMultiValueFilterCommit = useCallback(\n (\n model: AdHocFiltersVariable,\n filter: AdHocFilterWithLabels,\n filterMultiValues: Array<SelectableValue<string>>,\n preventFocus?: boolean\n ) => {\n if (filterMultiValues.length) {\n const valueLabels: string[] = [];\n const values: string[] = [];\n filterMultiValues.forEach((item) => {\n valueLabels.push(item.label ?? item.value!);\n values.push(item.value!);\n });\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n model._updateFilter(filter!, { valueLabels, values, value: values[0] });\n setFilterMultiValues([]);\n }\n if (!preventFocus) {\n setTimeout(() => refs.domReference.current?.focus());\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const handleLocalMultiValueChange = useCallback((selectedItem: SelectableValue<string>) => {\n setFilterMultiValues((items) => {\n if (items.some((item) => item.value === selectedItem.value)) {\n return items.filter((item) => item.value !== selectedItem.value);\n }\n return [...items, selectedItem];\n });\n }, []);\n\n const onOpenChange = useCallback<NonNullable<UseFloatingOptions['onOpenChange']>>(\n (nextOpen, _, reason) => {\n setOpen(nextOpen);\n // change from filter edit mode to filter view mode when clicked\n // outside input or dropdown\n\n if (reason && ['outside-press', 'escape-key'].includes(reason)) {\n if (isMultiValueEdit) {\n // commit multi value filter values on escape and click-away\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n }\n handleResetWip();\n handleChangeViewMode?.();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n isMultiValueEdit,\n model,\n ]\n );\n\n // generate ids from multi values in order to prevent outside click based on those ids\n const outsidePressIdsToIgnore = useMemo(() => {\n return [operatorIdentifier, ...filterMultiValues.map((item, i) => `${item.value}-${i}`)];\n }, [operatorIdentifier, filterMultiValues]);\n\n const { refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps } = useFloatingInteractions({\n open,\n onOpenChange,\n activeIndex,\n setActiveIndex,\n outsidePressIdsToIgnore,\n listRef,\n disabledIndicesRef,\n });\n\n // pass ability to focus on input element back to parent\n // parentRef is coming from AdHocFiltersComboboxRenderer\n useImperativeHandle(parentRef, () => () => refs.domReference.current?.focus(), [refs.domReference]);\n\n function onChange(event: React.ChangeEvent<HTMLInputElement>) {\n // part of POC for seamless filter parser\n // filterAutoParser({ event, filterInputType, options, model, filter, setInputValue, setInputType, refs });\n\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 }\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 (multiValueEdit) {\n setFilterMultiValues((items) => {\n const updated = [...items];\n updated.splice(-1, 1);\n\n return updated;\n });\n } else if (filterInputType === 'key') {\n model._removeLastFilter();\n handleFetchOptions(filterInputType);\n }\n }\n },\n [inputValue, filterInputType, model, handleFetchOptions]\n );\n\n const handleTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n // change filter to view mode when navigating away with Tab key\n // this is needed because useDismiss only reacts to mousedown\n if (event.key === 'Tab' && !event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n refs.domReference.current?.focus();\n }\n\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n model,\n refs.domReference,\n ]\n );\n\n const handleShiftTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Tab' && event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on shift tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues, true);\n }\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [filter, filterMultiValues, handleChangeViewMode, handleMultiValueFilterCommit, handleResetWip, model]\n );\n\n const handleEnterInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Enter' && activeIndex != null) {\n // safeguard for non existing items\n if (!filteredDropDownItems[activeIndex]) {\n return;\n }\n const selectedItem = filteredDropDownItems[activeIndex];\n\n if (multiValueEdit) {\n handleLocalMultiValueChange(selectedItem);\n } else {\n model._updateFilter(filter!, generateFilterUpdatePayload(filterInputType, selectedItem));\n\n switchToNextInputType(filterInputType, setInputType, handleChangeViewMode, refs.domReference.current);\n setActiveIndex(0);\n }\n\n setInputValue('');\n }\n },\n [\n activeIndex,\n filter,\n filterInputType,\n filteredDropDownItems,\n handleLocalMultiValueChange,\n handleChangeViewMode,\n model,\n refs.domReference,\n ]\n );\n\n //\n // Effects\n //\n\n useEffect(() => {\n // fetch options when dropdown is opened.\n if (open) {\n handleFetchOptions(filterInputType);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, filterInputType]);\n\n // when not in wip mode this is the point of switching from view to edit mode\n // and in this case we default to 'value' input type and focus input\n useEffect(() => {\n if (!isAlwaysWip) {\n setInputType('value');\n setInputValue('');\n\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n if (hasMultiValueOperator && filter?.values?.length) {\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const multiValueOptions = (filter.values as string[]).reduce<Array<SelectableValue<string>>>(\n (acc, value, i) => [\n ...acc,\n {\n label: filter.valueLabels?.[i] || value,\n value: value,\n },\n ],\n []\n );\n // populate filter multi values to local state on pill edit enter\n setFilterMultiValues(multiValueOptions);\n }\n\n refs.domReference.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // this is required only with multi value select in order to update position\n // of the multi value apply button\n useEffect(() => {\n if (isMultiValueEdit && filterMultiValues) {\n setTimeout(() => setForceRefresh({}));\n }\n }, [filterMultiValues, isMultiValueEdit]);\n\n useLayoutEffect(() => {\n // this is needed to scroll virtual list to the position of currently selected\n // dropdown item when navigating with arrow up/down keys to end/start of list\n if (\n activeIndex !== null &&\n rowVirtualizer.range &&\n (activeIndex > rowVirtualizer.range?.endIndex || activeIndex < rowVirtualizer.range?.startIndex)\n ) {\n rowVirtualizer.scrollToIndex(activeIndex);\n }\n }, [activeIndex, rowVirtualizer]);\n\n const keyLabel = filter?.keyLabel ?? filter?.key;\n\n return (\n <div className={styles.comboboxWrapper}>\n {filter ? (\n <div className={styles.pillWrapper}>\n {/* Filter key pill render */}\n {filter?.key ? <div className={cx(styles.basePill, styles.keyPill)}>{keyLabel}</div> : null}\n {/* Filter operator pill render */}\n {filter?.key && filter?.operator && filterInputType !== 'operator' ? (\n <div\n id={operatorIdentifier}\n className={cx(styles.basePill, styles.operatorPill, operatorIdentifier)}\n role=\"button\"\n aria-label=\"Edit filter operator\"\n tabIndex={0}\n onClick={(event) => {\n event.stopPropagation();\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }}\n onKeyDown={(event) => {\n handleShiftTabInput(event, hasMultiValueOperator);\n if (event.key === 'Enter') {\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }\n }}\n >\n {filter.operator}\n </div>\n ) : null}\n\n <div ref={multiValuePillWrapperRef}></div>\n {isMultiValueEdit\n ? filterMultiValues.map((item, i) => (\n <MultiValuePill\n key={`${item.value}-${i}`}\n item={item}\n index={i}\n handleRemoveMultiValue={handleRemoveMultiValue}\n />\n ))\n : null}\n </div>\n ) : null}\n\n <input\n {...getReferenceProps({\n ref: refs.setReference,\n onChange,\n value: inputValue,\n // dynamic placeholder to display operator and/or value in filter edit mode\n placeholder: generatePlaceholder(filter!, filterInputType, isMultiValueEdit, isAlwaysWip),\n 'aria-autocomplete': 'list',\n onKeyDown(event) {\n if (!open) {\n setOpen(true);\n return;\n }\n\n if (filterInputType === 'operator') {\n handleShiftTabInput(event);\n }\n handleBackspaceInput(event, isMultiValueEdit);\n handleTabInput(event, isMultiValueEdit);\n handleEnterInput(event, isMultiValueEdit);\n },\n })}\n className={cx(styles.inputStyle, { [styles.loadingInputPadding]: !optionsLoading })}\n onClick={(event) => {\n event.stopPropagation();\n setOpen(true);\n }}\n onFocus={() => {\n setActiveIndex(0);\n setOpen(true);\n }}\n />\n {optionsLoading ? <Spinner className={styles.loadingIndicator} inline={true} /> : null}\n <FloatingPortal>\n {open && (\n <FloatingFocusManager context={context} initialFocus={-1} visuallyHiddenDismiss modal={false}>\n <>\n <div\n style={{\n ...floatingStyles,\n width: `${optionsError ? ERROR_STATE_DROPDOWN_WIDTH : maxOptionWidth}px`,\n transform: isMultiValueEdit\n ? `translate(${multiValuePillWrapperRef.current?.getBoundingClientRect().left || 0}px, ${\n (refs.domReference.current?.getBoundingClientRect().bottom || 0) + 10\n }px )`\n : floatingStyles.transform,\n }}\n ref={refs.setFloating}\n className={styles.dropdownWrapper}\n tabIndex={-1}\n >\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize() || VIRTUAL_LIST_ITEM_HEIGHT}px`, // fallback to 38px for loading/error/no options placeholders\n }}\n {...getFloatingProps()}\n tabIndex={-1}\n >\n {optionsLoading ? (\n <LoadingOptionsPlaceholder />\n ) : optionsError ? (\n <OptionsErrorPlaceholder handleFetchOptions={() => handleFetchOptions(filterInputType)} />\n ) : !filteredDropDownItems.length && (filterInputType === 'operator' || !inputValue) ? (\n <NoOptionsPlaceholder />\n ) : (\n rowVirtualizer.getVirtualItems().map((virtualItem) => {\n const item = filteredDropDownItems[virtualItem.index];\n const index = virtualItem.index;\n\n // render group label\n if (item.options) {\n return (\n <div\n key={`${item.label}+${index}`}\n className={cx(styles.optionGroupLabel, styles.groupTopBorder)}\n style={{\n height: `${virtualItem.size}px`,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n >\n <Text weight=\"bold\" variant=\"bodySmall\" color=\"secondary\">\n {item.label!}\n </Text>\n </div>\n );\n }\n\n const nextItem: SelectableValue<string> | undefined =\n filteredDropDownItems[virtualItem.index + 1];\n const shouldAddBottomBorder = nextItem && !nextItem.group && !nextItem.options && item.group;\n\n return (\n // key is included in getItemProps()\n // eslint-disable-next-line react/jsx-key\n <DropdownItem\n {...getItemProps({\n key: `${item.value!}-${index}`,\n ref(node) {\n listRef.current[index] = node;\n },\n // ref: rowVirtualizer.measureElement,\n onClick(event) {\n if (filterInputType !== 'value') {\n event.stopPropagation();\n }\n if (isMultiValueEdit) {\n event.preventDefault();\n event.stopPropagation();\n handleLocalMultiValueChange(item);\n refs.domReference.current?.focus();\n } else {\n model._updateFilter(filter!, generateFilterUpdatePayload(filterInputType, item));\n setInputValue('');\n\n switchToNextInputType(\n filterInputType,\n setInputType,\n handleChangeViewMode,\n refs.domReference.current\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 />\n ) : null}\n </>\n </FloatingFocusManager>\n )}\n </FloatingPortal>\n </div>\n );\n});\n\ninterface MultiValuePillProps {\n item: SelectableValue<string>;\n handleRemoveMultiValue: (item: SelectableValue<string>) => void;\n index: number;\n}\nconst MultiValuePill = ({ item, handleRemoveMultiValue, index }: MultiValuePillProps) => {\n const styles = useStyles2(getStyles);\n\n return (\n <div className={cx(styles.basePill, styles.valuePill)}>\n <span> {item.label ?? item.value}</span>\n <Button\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleRemoveMultiValue(item);\n }}\n onKeyDownCapture={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n handleRemoveMultiValue(item);\n }\n }}\n fill=\"text\"\n size=\"sm\"\n variant=\"secondary\"\n className={styles.removeButton}\n tooltip={`Remove filter value - ${item.label ?? item.value}`}\n >\n <Icon name=\"times\" size=\"md\" id={`${item.value}-${index}`} />\n </Button>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n comboboxWrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n }),\n pillWrapper: css({\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }),\n basePill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.disabledBackground,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 1, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: theme.spacing(2.75),\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n keyPill: css({\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'default',\n }),\n operatorPill: css({\n '&:hover': {\n background: theme.colors.action.hover,\n },\n }),\n valuePill: css({\n background: theme.colors.action.selected,\n padding: theme.spacing(0.125, 0, 0.125, 1),\n }),\n dropdownWrapper: css({\n backgroundColor: theme.colors.background.primary,\n color: theme.colors.text.primary,\n boxShadow: theme.shadows.z2,\n overflowY: 'auto',\n zIndex: theme.zIndex.dropdown,\n }),\n inputStyle: css({\n paddingBlock: 0,\n '&:focus': {\n outline: 'none',\n },\n }),\n loadingIndicator: css({\n color: theme.colors.text.secondary,\n marginLeft: theme.spacing(0.5),\n }),\n loadingInputPadding: css({\n paddingRight: theme.spacing(2.5),\n }),\n optionGroupLabel: css({\n padding: theme.spacing(1),\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n }),\n groupTopBorder: css({\n '&:not(:first-child)': {\n borderTop: `1px solid ${theme.colors.border.weak}`,\n },\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n height: '100%',\n padding: 0,\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n descriptionText: css({\n ...theme.typography.bodySmall,\n color: theme.colors.text.secondary,\n paddingTop: theme.spacing(0.5),\n }),\n multiValueApply: css({\n position: 'absolute',\n top: 0,\n left: 0,\n display: 'flex',\n }),\n});\n"],"names":["AdHocCombobox","model","filter","filterMultiValues","_a","_","options","_b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDa,MAAA,aAAA,GAAgB,UAAW,CAAA,SAASA,cAC/C,CAAA,EAAE,QAAQ,KAAO,EAAA,WAAA,EAAa,oBAAqB,EAAA,EACnD,SACA,EAAA;AApDF,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAqDE,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,EA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,EAAA,CAAA;AAAA,IACT,MAAQ,EAAA,SAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,KAC3B;AAAA,GACD,CAAA;AAAA,EACD,eAAiB,EAAA,GAAA,CAAI,aAChB,CAAA,cAAA,CAAA,EAAA,EAAA,KAAA,CAAM,WAAW,SADD,CAAA,EAAA;AAAA,IAEnB,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,IACzB,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GAC9B,CAAA,CAAA;AAAA,EACD,iBAAiB,GAAI,CAAA;AAAA,IACnB,QAAU,EAAA,UAAA;AAAA,IACV,GAAK,EAAA,CAAA;AAAA,IACL,IAAM,EAAA,CAAA;AAAA,IACN,OAAS,EAAA,MAAA;AAAA,GACV,CAAA;AACH,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"AdHocFiltersCombobox.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { FloatingFocusManager, FloatingPortal, UseFloatingOptions } from '@floating-ui/react';\nimport { Button, Icon, Spinner, Text, useStyles2 } from '@grafana/ui';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable, OPERATORS } from '../AdHocFiltersVariable';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport {\n DropdownItem,\n LoadingOptionsPlaceholder,\n MultiValueApplyButton,\n NoOptionsPlaceholder,\n OptionsErrorPlaceholder,\n} from './DropdownItem';\nimport {\n ERROR_STATE_DROPDOWN_WIDTH,\n flattenOptionGroups,\n fuzzySearchOptions,\n generateFilterUpdatePayload,\n generatePlaceholder,\n setupDropdownAccessibility,\n switchInputType,\n switchToNextInputType,\n VIRTUAL_LIST_ITEM_HEIGHT,\n VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION,\n VIRTUAL_LIST_OVERSCAN,\n} from './utils';\nimport { handleOptionGroups } from '../../utils';\nimport { useFloatingInteractions } from './useFloatingInteractions';\n\ninterface AdHocComboboxProps {\n filter?: AdHocFilterWithLabels;\n isAlwaysWip?: boolean;\n model: AdHocFiltersVariable;\n handleChangeViewMode?: () => void;\n}\n\nexport type AdHocInputType = 'key' | 'operator' | 'value';\n\nexport const AdHocCombobox = forwardRef(function AdHocCombobox(\n { filter, model, isAlwaysWip, handleChangeViewMode }: 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 multiValueOperators = useMemo(\n () => OPERATORS.reduce<string[]>((acc, operator) => (operator.isMulti ? [...acc, operator.value!] : acc), []),\n []\n );\n\n const hasMultiValueOperator = multiValueOperators.includes(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 // reset wip filter. Used when navigating away with incomplete wip filer or when selecting wip filter value\n const handleResetWip = useCallback(() => {\n if (isAlwaysWip) {\n model._addWip();\n setInputType('key');\n setInputValue('');\n }\n }, [model, isAlwaysWip]);\n\n const handleMultiValueFilterCommit = useCallback(\n (\n model: AdHocFiltersVariable,\n filter: AdHocFilterWithLabels,\n filterMultiValues: Array<SelectableValue<string>>,\n preventFocus?: boolean\n ) => {\n if (filterMultiValues.length) {\n const valueLabels: string[] = [];\n const values: string[] = [];\n filterMultiValues.forEach((item) => {\n valueLabels.push(item.label ?? item.value!);\n values.push(item.value!);\n });\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n model._updateFilter(filter!, { valueLabels, values, value: values[0] });\n setFilterMultiValues([]);\n }\n if (!preventFocus) {\n setTimeout(() => refs.domReference.current?.focus());\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const handleLocalMultiValueChange = useCallback((selectedItem: SelectableValue<string>) => {\n setFilterMultiValues((items) => {\n if (items.some((item) => item.value === selectedItem.value)) {\n return items.filter((item) => item.value !== selectedItem.value);\n }\n return [...items, selectedItem];\n });\n }, []);\n\n const onOpenChange = useCallback<NonNullable<UseFloatingOptions['onOpenChange']>>(\n (nextOpen, _, reason) => {\n setOpen(nextOpen);\n // change from filter edit mode to filter view mode when clicked\n // outside input or dropdown\n\n if (reason && ['outside-press', 'escape-key'].includes(reason)) {\n if (isMultiValueEdit) {\n // commit multi value filter values on escape and click-away\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n }\n handleResetWip();\n handleChangeViewMode?.();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n isMultiValueEdit,\n model,\n ]\n );\n\n // generate ids from multi values in order to prevent outside click based on those ids\n const outsidePressIdsToIgnore = useMemo(() => {\n return [operatorIdentifier, ...filterMultiValues.map((item, i) => `${item.value}-${i}`)];\n }, [operatorIdentifier, filterMultiValues]);\n\n const { refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps } = useFloatingInteractions({\n open,\n onOpenChange,\n activeIndex,\n setActiveIndex,\n outsidePressIdsToIgnore,\n listRef,\n disabledIndicesRef,\n });\n\n // pass ability to focus on input element back to parent\n // parentRef is coming from AdHocFiltersComboboxRenderer\n useImperativeHandle(parentRef, () => () => refs.domReference.current?.focus(), [refs.domReference]);\n\n function onChange(event: React.ChangeEvent<HTMLInputElement>) {\n // part of POC for seamless filter parser\n // filterAutoParser({ event, filterInputType, options, model, filter, setInputValue, setInputType, refs });\n\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 }\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 (multiValueEdit) {\n setFilterMultiValues((items) => {\n const updated = [...items];\n updated.splice(-1, 1);\n\n return updated;\n });\n } else if (filterInputType === 'key') {\n model._removeLastFilter();\n handleFetchOptions(filterInputType);\n }\n }\n },\n [inputValue, filterInputType, model, handleFetchOptions]\n );\n\n const handleTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n // change filter to view mode when navigating away with Tab key\n // this is needed because useDismiss only reacts to mousedown\n if (event.key === 'Tab' && !event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues);\n refs.domReference.current?.focus();\n }\n\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [\n filter,\n filterMultiValues,\n handleChangeViewMode,\n handleMultiValueFilterCommit,\n handleResetWip,\n model,\n refs.domReference,\n ]\n );\n\n const handleShiftTabInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Tab' && event.shiftKey) {\n if (multiValueEdit) {\n // commit multi value filter values on shift tab away\n event.preventDefault();\n handleMultiValueFilterCommit(model, filter!, filterMultiValues, true);\n }\n handleChangeViewMode?.();\n handleResetWip();\n }\n },\n [filter, filterMultiValues, handleChangeViewMode, handleMultiValueFilterCommit, handleResetWip, model]\n );\n\n const handleEnterInput = useCallback(\n (event: React.KeyboardEvent, multiValueEdit?: boolean) => {\n if (event.key === 'Enter' && activeIndex != null) {\n // safeguard for non existing items\n if (!filteredDropDownItems[activeIndex]) {\n return;\n }\n const selectedItem = filteredDropDownItems[activeIndex];\n\n if (multiValueEdit) {\n handleLocalMultiValueChange(selectedItem);\n } else {\n model._updateFilter(filter!, generateFilterUpdatePayload(filterInputType, selectedItem));\n\n switchToNextInputType(filterInputType, setInputType, handleChangeViewMode, refs.domReference.current);\n setActiveIndex(0);\n }\n\n setInputValue('');\n }\n },\n [\n activeIndex,\n filter,\n filterInputType,\n filteredDropDownItems,\n handleLocalMultiValueChange,\n handleChangeViewMode,\n model,\n refs.domReference,\n ]\n );\n\n //\n // Effects\n //\n\n useEffect(() => {\n // fetch options when dropdown is opened.\n if (open) {\n handleFetchOptions(filterInputType);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, filterInputType]);\n\n // when not in wip mode this is the point of switching from view to edit mode\n // and in this case we default to 'value' input type and focus input\n useEffect(() => {\n if (!isAlwaysWip) {\n setInputType('value');\n setInputValue('');\n\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n if (hasMultiValueOperator && filter?.values?.length) {\n // TODO remove when we're on the latest version of @grafana/data\n //@ts-expect-error\n const multiValueOptions = (filter.values as string[]).reduce<Array<SelectableValue<string>>>(\n (acc, value, i) => [\n ...acc,\n {\n label: filter.valueLabels?.[i] || value,\n value: value,\n },\n ],\n []\n );\n // populate filter multi values to local state on pill edit enter\n setFilterMultiValues(multiValueOptions);\n }\n\n refs.domReference.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // this is required only with multi value select in order to update position\n // of the multi value apply button\n useEffect(() => {\n if (isMultiValueEdit && filterMultiValues) {\n setTimeout(() => setForceRefresh({}));\n }\n }, [filterMultiValues, isMultiValueEdit]);\n\n useLayoutEffect(() => {\n // this is needed to scroll virtual list to the position of currently selected\n // dropdown item when navigating with arrow up/down keys to end/start of list\n if (\n activeIndex !== null &&\n rowVirtualizer.range &&\n (activeIndex > rowVirtualizer.range?.endIndex || activeIndex < rowVirtualizer.range?.startIndex)\n ) {\n rowVirtualizer.scrollToIndex(activeIndex);\n }\n }, [activeIndex, rowVirtualizer]);\n\n const keyLabel = filter?.keyLabel ?? filter?.key;\n\n return (\n <div className={styles.comboboxWrapper}>\n {filter ? (\n <div className={styles.pillWrapper}>\n {/* Filter key pill render */}\n {filter?.key ? <div className={cx(styles.basePill, styles.keyPill)}>{keyLabel}</div> : null}\n {/* Filter operator pill render */}\n {filter?.key && filter?.operator && filterInputType !== 'operator' ? (\n <div\n id={operatorIdentifier}\n className={cx(styles.basePill, styles.operatorPill, operatorIdentifier)}\n role=\"button\"\n aria-label=\"Edit filter operator\"\n tabIndex={0}\n onClick={(event) => {\n event.stopPropagation();\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }}\n onKeyDown={(event) => {\n handleShiftTabInput(event, hasMultiValueOperator);\n if (event.key === 'Enter') {\n switchInputType('operator', setInputType, undefined, refs.domReference.current);\n }\n }}\n >\n {filter.operator}\n </div>\n ) : null}\n\n <div ref={multiValuePillWrapperRef}></div>\n {isMultiValueEdit\n ? filterMultiValues.map((item, i) => (\n <MultiValuePill\n key={`${item.value}-${i}`}\n item={item}\n index={i}\n handleRemoveMultiValue={handleRemoveMultiValue}\n />\n ))\n : null}\n </div>\n ) : null}\n\n <input\n {...getReferenceProps({\n ref: refs.setReference,\n onChange,\n value: inputValue,\n // dynamic placeholder to display operator and/or value in filter edit mode\n placeholder: generatePlaceholder(filter!, filterInputType, isMultiValueEdit, isAlwaysWip),\n 'aria-autocomplete': 'list',\n onKeyDown(event) {\n if (!open) {\n setOpen(true);\n return;\n }\n\n if (filterInputType === 'operator') {\n handleShiftTabInput(event);\n }\n handleBackspaceInput(event, isMultiValueEdit);\n handleTabInput(event, isMultiValueEdit);\n handleEnterInput(event, isMultiValueEdit);\n },\n })}\n className={cx(styles.inputStyle, { [styles.loadingInputPadding]: !optionsLoading })}\n onClick={(event) => {\n event.stopPropagation();\n setOpen(true);\n }}\n onFocus={() => {\n setActiveIndex(0);\n setOpen(true);\n }}\n />\n {optionsLoading ? <Spinner className={styles.loadingIndicator} inline={true} /> : null}\n <FloatingPortal>\n {open && (\n <FloatingFocusManager context={context} initialFocus={-1} visuallyHiddenDismiss modal={false}>\n <>\n <div\n style={{\n ...floatingStyles,\n width: `${optionsError ? ERROR_STATE_DROPDOWN_WIDTH : maxOptionWidth}px`,\n transform: isMultiValueEdit\n ? `translate(${multiValuePillWrapperRef.current?.getBoundingClientRect().left || 0}px, ${\n (refs.domReference.current?.getBoundingClientRect().bottom || 0) + 10\n }px )`\n : floatingStyles.transform,\n }}\n ref={refs.setFloating}\n className={styles.dropdownWrapper}\n tabIndex={-1}\n >\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize() || VIRTUAL_LIST_ITEM_HEIGHT}px`, // fallback to 38px for loading/error/no options placeholders\n }}\n {...getFloatingProps()}\n tabIndex={-1}\n >\n {optionsLoading ? (\n <LoadingOptionsPlaceholder />\n ) : optionsError ? (\n <OptionsErrorPlaceholder handleFetchOptions={() => handleFetchOptions(filterInputType)} />\n ) : !filteredDropDownItems.length && (filterInputType === 'operator' || !inputValue) ? (\n <NoOptionsPlaceholder />\n ) : (\n rowVirtualizer.getVirtualItems().map((virtualItem) => {\n const item = filteredDropDownItems[virtualItem.index];\n const index = virtualItem.index;\n\n // render group label\n if (item.options) {\n return (\n <div\n key={`${item.label}+${index}`}\n className={cx(styles.optionGroupLabel, styles.groupTopBorder)}\n style={{\n height: `${virtualItem.size}px`,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n >\n <Text weight=\"bold\" variant=\"bodySmall\" color=\"secondary\">\n {item.label!}\n </Text>\n </div>\n );\n }\n\n const nextItem: SelectableValue<string> | undefined =\n filteredDropDownItems[virtualItem.index + 1];\n const shouldAddBottomBorder = nextItem && !nextItem.group && !nextItem.options && item.group;\n\n return (\n // key is included in getItemProps()\n // eslint-disable-next-line react/jsx-key\n <DropdownItem\n {...getItemProps({\n key: `${item.value!}-${index}`,\n ref(node) {\n listRef.current[index] = node;\n },\n onClick(event) {\n if (filterInputType !== 'value') {\n event.stopPropagation();\n }\n if (isMultiValueEdit) {\n event.preventDefault();\n event.stopPropagation();\n handleLocalMultiValueChange(item);\n refs.domReference.current?.focus();\n } else {\n model._updateFilter(filter!, generateFilterUpdatePayload(filterInputType, item));\n setInputValue('');\n\n switchToNextInputType(\n filterInputType,\n setInputType,\n handleChangeViewMode,\n refs.domReference.current\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 />\n ) : null}\n </>\n </FloatingFocusManager>\n )}\n </FloatingPortal>\n </div>\n );\n});\n\ninterface MultiValuePillProps {\n item: SelectableValue<string>;\n handleRemoveMultiValue: (item: SelectableValue<string>) => void;\n index: number;\n}\nconst MultiValuePill = ({ item, handleRemoveMultiValue, index }: MultiValuePillProps) => {\n const styles = useStyles2(getStyles);\n\n return (\n <div className={cx(styles.basePill, styles.valuePill)}>\n <span> {item.label ?? item.value}</span>\n <Button\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleRemoveMultiValue(item);\n }}\n onKeyDownCapture={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n handleRemoveMultiValue(item);\n }\n }}\n fill=\"text\"\n size=\"sm\"\n variant=\"secondary\"\n className={styles.removeButton}\n tooltip={`Remove filter value - ${item.label ?? item.value}`}\n >\n <Icon name=\"times\" size=\"md\" id={`${item.value}-${index}`} />\n </Button>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n comboboxWrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n }),\n pillWrapper: css({\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }),\n basePill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.disabledBackground,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 1, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: theme.spacing(2.75),\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n keyPill: css({\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'default',\n }),\n operatorPill: css({\n '&:hover': {\n background: theme.colors.action.hover,\n },\n }),\n valuePill: css({\n background: theme.colors.action.selected,\n padding: theme.spacing(0.125, 0, 0.125, 1),\n }),\n dropdownWrapper: css({\n backgroundColor: theme.colors.background.primary,\n color: theme.colors.text.primary,\n boxShadow: theme.shadows.z2,\n overflowY: 'auto',\n zIndex: theme.zIndex.dropdown,\n }),\n inputStyle: css({\n paddingBlock: 0,\n '&:focus': {\n outline: 'none',\n },\n }),\n loadingIndicator: css({\n color: theme.colors.text.secondary,\n marginLeft: theme.spacing(0.5),\n }),\n loadingInputPadding: css({\n paddingRight: theme.spacing(2.5),\n }),\n optionGroupLabel: css({\n padding: theme.spacing(1),\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n }),\n groupTopBorder: css({\n '&:not(:first-child)': {\n borderTop: `1px solid ${theme.colors.border.weak}`,\n },\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n height: '100%',\n padding: 0,\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n descriptionText: css({\n ...theme.typography.bodySmall,\n color: theme.colors.text.secondary,\n paddingTop: theme.spacing(0.5),\n }),\n multiValueApply: css({\n position: 'absolute',\n top: 0,\n left: 0,\n display: 'flex',\n }),\n});\n"],"names":["AdHocCombobox","model","filter","filterMultiValues","_a","_","options","_b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDa,MAAA,aAAA,GAAgB,UAAW,CAAA,SAASA,cAC/C,CAAA,EAAE,QAAQ,KAAO,EAAA,WAAA,EAAa,oBAAqB,EAAA,EACnD,SACA,EAAA;AApDF,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAqDE,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,CA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AA,GACD,CAAA;AAAA,EACD,eAAiB,EAAA,GAAA,CAAI,aAChB,CAAA,cAAA,CAAA,EAAA,EAAA,KAAA,CAAM,WAAW,SADD,CAAA,EAAA;AAAA,IAEnB,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,IACzB,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GAC9B,CAAA,CAAA;AAAA,EACD,iBAAiB,GAAI,CAAA;AAAA,IACnB,QAAU,EAAA,UAAA;AAAA,IACV,GAAK,EAAA,CAAA;AAAA,IACL,IAAM,EAAA,CAAA;AAAA,IACN,OAAS,EAAA,MAAA;AAAA,GACV,CAAA;AACH,CAAA,CAAA;;;;"}
@@ -31,13 +31,15 @@ const useFloatingInteractions = ({
31
31
  const dismiss = useDismiss(context, {
32
32
  outsidePress: (event) => {
33
33
  var _a;
34
- const target = event.currentTarget || event.target;
35
- let idToCompare = (target == null ? void 0 : target.id) || "";
36
- if ((target == null ? void 0 : target.nodeName) === "path") {
37
- idToCompare = ((_a = target.parentElement) == null ? void 0 : _a.id) || "";
38
- }
39
- if (outsidePressIdsToIgnore.includes(idToCompare)) {
40
- return false;
34
+ if (event.currentTarget instanceof Element) {
35
+ const target = event.currentTarget;
36
+ let idToCompare = target.id;
37
+ if (target.nodeName === "path") {
38
+ idToCompare = ((_a = target.parentElement) == null ? void 0 : _a.id) || "";
39
+ }
40
+ if (outsidePressIdsToIgnore.includes(idToCompare)) {
41
+ return false;
42
+ }
41
43
  }
42
44
  return true;
43
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFloatingInteractions.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/useFloatingInteractions.ts"],"sourcesContent":["import {\n useFloating,\n autoUpdate,\n offset,\n useRole,\n useDismiss,\n useListNavigation,\n UseFloatingOptions,\n flip,\n size,\n UseListNavigationProps,\n useInteractions,\n} from '@floating-ui/react';\n\ntype useFloatingInteractionsProps = {\n open: UseFloatingOptions['open'];\n onOpenChange: UseFloatingOptions['onOpenChange'];\n activeIndex: UseListNavigationProps['activeIndex'];\n setActiveIndex: UseListNavigationProps['onNavigate'];\n outsidePressIdsToIgnore: string[];\n listRef: React.MutableRefObject<Array<HTMLElement | null>>;\n disabledIndicesRef: React.MutableRefObject<number[]>;\n};\n\nconst MAX_MENU_HEIGHT = 300;\n\nexport const useFloatingInteractions = ({\n open,\n onOpenChange,\n activeIndex,\n setActiveIndex,\n outsidePressIdsToIgnore,\n listRef,\n disabledIndicesRef,\n}: useFloatingInteractionsProps) => {\n const { refs, floatingStyles, context } = useFloating<HTMLInputElement>({\n whileElementsMounted: autoUpdate,\n open,\n onOpenChange,\n placement: 'bottom-start',\n middleware: [\n offset(10),\n flip({ padding: 10 }),\n size({\n apply({ availableHeight, availableWidth, elements }) {\n // limit maxHeight and maxWidth of dropdown\n elements.floating.style.maxHeight = `${Math.min(MAX_MENU_HEIGHT, availableHeight)}px`;\n elements.floating.style.maxWidth = `${availableWidth}px`;\n },\n padding: 10,\n }),\n ],\n });\n\n const role = useRole(context, { role: 'listbox' });\n const dismiss = useDismiss(context, {\n // if outside click lands on operator pill, then ignore outside click\n outsidePress: (event) => {\n const target = (event.currentTarget || event.target) as HTMLElement | null;\n let idToCompare = target?.id || '';\n if (target?.nodeName === 'path') {\n idToCompare = target.parentElement?.id || '';\n }\n\n if (outsidePressIdsToIgnore.includes(idToCompare)) {\n return false;\n }\n return true;\n },\n });\n const listNav = useListNavigation(context, {\n listRef,\n activeIndex,\n onNavigate: setActiveIndex,\n virtual: true,\n loop: true,\n disabledIndices: disabledIndicesRef.current,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNav]);\n\n return {\n refs,\n floatingStyles,\n context,\n getReferenceProps,\n getFloatingProps,\n getItemProps,\n };\n};\n"],"names":[],"mappings":";;AAwBA,MAAM,eAAkB,GAAA,GAAA,CAAA;AAEjB,MAAM,0BAA0B,CAAC;AAA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GAAA,KAAA,CAAA,GAAA,MAAA,CAAQ,cAAa,MAAQ,EAAA;AAC/B,QAAc,WAAA,GAAA,CAAA,CAAA,EAAA,GAAA,MAAA,CAAO,aAAP,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAsB,EAAM,KAAA,EAAA,CAAA;AAAA,OAC5C;AAEA,MAAI,IAAA,uBAAA,CAAwB,QAAS,CAAA,WAAW,CAAG,EAAA;AACjD,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AACA,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AACD,EAAM,MAAA,OAAA,GAAU,kBAAkB,OAAS,EAAA;AAAA,IACzC,OAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAY,EAAA,cAAA;AAAA,IACZ,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,IAAA;AAAA,IACN,iBAAiB,kBAAmB,CAAA,OAAA;AAAA,GACrC,CAAA,CAAA;AAED,EAAM,MAAA,EAAE,iBAAmB,EAAA,gBAAA,EAAkB,YAAa,EAAA,GAAI,gBAAgB,CAAC,IAAA,EAAM,OAAS,EAAA,OAAO,CAAC,CAAA,CAAA;AAEtG,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA;AAAA,IACA,iBAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,GACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"useFloatingInteractions.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/useFloatingInteractions.ts"],"sourcesContent":["import {\n useFloating,\n autoUpdate,\n offset,\n useRole,\n useDismiss,\n useListNavigation,\n UseFloatingOptions,\n flip,\n size,\n UseListNavigationProps,\n useInteractions,\n} from '@floating-ui/react';\n\ntype useFloatingInteractionsProps = {\n open: UseFloatingOptions['open'];\n onOpenChange: UseFloatingOptions['onOpenChange'];\n activeIndex: UseListNavigationProps['activeIndex'];\n setActiveIndex: UseListNavigationProps['onNavigate'];\n outsidePressIdsToIgnore: string[];\n listRef: React.MutableRefObject<Array<HTMLElement | null>>;\n disabledIndicesRef: React.MutableRefObject<number[]>;\n};\n\nconst MAX_MENU_HEIGHT = 300;\n\nexport const useFloatingInteractions = ({\n open,\n onOpenChange,\n activeIndex,\n setActiveIndex,\n outsidePressIdsToIgnore,\n listRef,\n disabledIndicesRef,\n}: useFloatingInteractionsProps) => {\n const { refs, floatingStyles, context } = useFloating<HTMLInputElement>({\n whileElementsMounted: autoUpdate,\n open,\n onOpenChange,\n placement: 'bottom-start',\n middleware: [\n offset(10),\n flip({ padding: 10 }),\n size({\n apply({ availableHeight, availableWidth, elements }) {\n // limit maxHeight and maxWidth of dropdown\n elements.floating.style.maxHeight = `${Math.min(MAX_MENU_HEIGHT, availableHeight)}px`;\n elements.floating.style.maxWidth = `${availableWidth}px`;\n },\n padding: 10,\n }),\n ],\n });\n\n const role = useRole(context, { role: 'listbox' });\n const dismiss = useDismiss(context, {\n // if outside click lands on operator pill, then ignore outside click\n outsidePress: (event) => {\n if (event.currentTarget instanceof Element) {\n const target = event.currentTarget;\n let idToCompare = target.id;\n if (target.nodeName === 'path') {\n idToCompare = target.parentElement?.id || '';\n }\n\n if (outsidePressIdsToIgnore.includes(idToCompare)) {\n return false;\n }\n }\n return true;\n },\n });\n const listNav = useListNavigation(context, {\n listRef,\n activeIndex,\n onNavigate: setActiveIndex,\n virtual: true,\n loop: true,\n disabledIndices: disabledIndicesRef.current,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNav]);\n\n return {\n refs,\n floatingStyles,\n context,\n getReferenceProps,\n getFloatingProps,\n getItemProps,\n };\n};\n"],"names":[],"mappings":";;AAwBA,MAAM,eAAkB,GAAA,GAAA,CAAA;AAEjB,MAAM,0BAA0B,CAAC;AAAA,EACtC,IAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA,uBAAA;AAAA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AA,KAAA,CAAA,GAAA,EAAA,CAAsB,EAAM,KAAA,EAAA,CAAA;AAAA,SAC5C;AAEA,QAAI,IAAA,uBAAA,CAAwB,QAAS,CAAA,WAAW,CAAG,EAAA;AACjD,UAAO,OAAA,KAAA,CAAA;AAAA,SACT;AAAA,OACF;AACA,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AACD,EAAM,MAAA,OAAA,GAAU,kBAAkB,OAAS,EAAA;AAAA,IACzC,OAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAY,EAAA,cAAA;AAAA,IACZ,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,IAAA;AAAA,IACN,iBAAiB,kBAAmB,CAAA,OAAA;AAAA,GACrC,CAAA,CAAA;AAED,EAAM,MAAA,EAAE,iBAAmB,EAAA,gBAAA,EAAkB,YAAa,EAAA,GAAI,gBAAgB,CAAC,IAAA,EAAM,OAAS,EAAA,OAAO,CAAC,CAAA,CAAA;AAEtG,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,cAAA;AAAA,IACA,OAAA;AAAA,IACA,iBAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,GACF,CAAA;AACF;;;;"}
package/dist/index.d.ts CHANGED
@@ -379,11 +379,6 @@ declare abstract class SceneObjectBase<TState extends SceneObjectState = SceneOb
379
379
  protected _refCount: number;
380
380
  protected _variableDependency: SceneVariableDependencyConfigLike | undefined;
381
381
  protected _urlSync: SceneObjectUrlSyncHandler | undefined;
382
- /**
383
- * @experimental feature to support rendering a child scene object without it's parent being rendered.
384
- * This flag will make it so that the parent is activated (if it's inactive) when this object is activated.
385
- */
386
- _UNSAFE_PARENT_ACTIVATION: boolean;
387
382
  constructor(state: TState);
388
383
  /** Current state */
389
384
  get state(): TState;
package/dist/index.js CHANGED
@@ -241,7 +241,6 @@ class SceneObjectBase {
241
241
  this._deactivationHandlers = /* @__PURE__ */ new Map();
242
242
  this._subs = new rxjs.Subscription();
243
243
  this._refCount = 0;
244
- this._UNSAFE_PARENT_ACTIVATION = false;
245
244
  if (!state.key) {
246
245
  state.key = uuid.v4();
247
246
  }
@@ -398,19 +397,12 @@ class SceneObjectBase {
398
397
  }
399
398
  }
400
399
  activate() {
401
- let parentDeactivate;
402
- if (this.parent && !this.parent.isActive && this._UNSAFE_PARENT_ACTIVATION) {
403
- parentDeactivate = this.parent.activate();
404
- }
405
400
  if (!this.isActive) {
406
401
  this._internalActivate();
407
402
  }
408
403
  this._refCount++;
409
404
  let called = false;
410
405
  return () => {
411
- if (parentDeactivate) {
412
- parentDeactivate();
413
- }
414
406
  this._refCount--;
415
407
  if (called) {
416
408
  const msg = `SceneObject cancelation handler returned by activate() called a second time`;
@@ -3900,13 +3892,15 @@ const useFloatingInteractions = ({
3900
3892
  const dismiss = react.useDismiss(context, {
3901
3893
  outsidePress: (event) => {
3902
3894
  var _a;
3903
- const target = event.currentTarget || event.target;
3904
- let idToCompare = (target == null ? void 0 : target.id) || "";
3905
- if ((target == null ? void 0 : target.nodeName) === "path") {
3906
- idToCompare = ((_a = target.parentElement) == null ? void 0 : _a.id) || "";
3907
- }
3908
- if (outsidePressIdsToIgnore.includes(idToCompare)) {
3909
- return false;
3895
+ if (event.currentTarget instanceof Element) {
3896
+ const target = event.currentTarget;
3897
+ let idToCompare = target.id;
3898
+ if (target.nodeName === "path") {
3899
+ idToCompare = ((_a = target.parentElement) == null ? void 0 : _a.id) || "";
3900
+ }
3901
+ if (outsidePressIdsToIgnore.includes(idToCompare)) {
3902
+ return false;
3903
+ }
3910
3904
  }
3911
3905
  return true;
3912
3906
  }
@@ -4537,6 +4531,9 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnInputRef }) {
4537
4531
  }
4538
4532
  }, [shouldFocus]);
4539
4533
  if (viewMode) {
4534
+ const pillText = /* @__PURE__ */ React__default["default"].createElement("span", {
4535
+ className: styles.pillText
4536
+ }, keyLabel, " ", filter.operator, " ", valueLabel);
4540
4537
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4541
4538
  className: css.cx(styles.combinedFilterPill, { [styles.readOnlyCombinedFilter]: readOnly }),
4542
4539
  onClick: handleChangeViewMode,
@@ -4549,15 +4546,12 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnInputRef }) {
4549
4546
  "aria-label": `Edit filter with key ${keyLabel}`,
4550
4547
  tabIndex: 0,
4551
4548
  ref: pillWrapperRef
4552
- }, /* @__PURE__ */ React__default["default"].createElement(ui.Tooltip, {
4553
- show: valueLabel.length < 20 ? false : void 0,
4549
+ }, valueLabel.length < 20 ? pillText : /* @__PURE__ */ React__default["default"].createElement(ui.Tooltip, {
4554
4550
  content: /* @__PURE__ */ React__default["default"].createElement("div", {
4555
4551
  className: styles.tooltipText
4556
4552
  }, valueLabel),
4557
4553
  placement: "top"
4558
- }, /* @__PURE__ */ React__default["default"].createElement("span", {
4559
- className: styles.pillText
4560
- }, keyLabel, " ", filter.operator, " ", valueLabel)), !readOnly ? /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
4554
+ }, pillText), !readOnly ? /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
4561
4555
  onClick: (e) => {
4562
4556
  e.stopPropagation();
4563
4557
  model._removeFilter(filter);