@grafana/scenes 5.5.1--canary.830.9990123542.0 → 5.5.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -14,8 +14,6 @@ var ui = require('@grafana/ui');
14
14
  var e2eSelectors = require('@grafana/e2e-selectors');
15
15
  var css = require('@emotion/css');
16
16
  var uFuzzy = require('@leeoniya/ufuzzy');
17
- var react = require('@floating-ui/react');
18
- var reactDom = require('react-dom');
19
17
  var reactUse = require('react-use');
20
18
  var operators = require('rxjs/operators');
21
19
  var ReactGridLayout = require('react-grid-layout');
@@ -43,19 +41,19 @@ var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
43
41
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
44
42
  var AutoSizer__default = /*#__PURE__*/_interopDefaultLegacy(AutoSizer);
45
43
 
46
- var __defProp$M = Object.defineProperty;
47
- var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
48
- var __hasOwnProp$M = Object.prototype.hasOwnProperty;
49
- var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
50
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
51
- var __spreadValues$M = (a, b) => {
44
+ var __defProp$K = Object.defineProperty;
45
+ var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
46
+ var __hasOwnProp$K = Object.prototype.hasOwnProperty;
47
+ var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
48
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues$K = (a, b) => {
52
50
  for (var prop in b || (b = {}))
53
- if (__hasOwnProp$M.call(b, prop))
54
- __defNormalProp$M(a, prop, b[prop]);
55
- if (__getOwnPropSymbols$M)
56
- for (var prop of __getOwnPropSymbols$M(b)) {
57
- if (__propIsEnum$M.call(b, prop))
58
- __defNormalProp$M(a, prop, b[prop]);
51
+ if (__hasOwnProp$K.call(b, prop))
52
+ __defNormalProp$K(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols$K)
54
+ for (var prop of __getOwnPropSymbols$K(b)) {
55
+ if (__propIsEnum$K.call(b, prop))
56
+ __defNormalProp$K(a, prop, b[prop]);
59
57
  }
60
58
  return a;
61
59
  };
@@ -64,7 +62,7 @@ function useAppQueryParams() {
64
62
  return runtime.locationSearchToObject(location.search || "");
65
63
  }
66
64
  function getUrlWithAppState(path, preserveParams) {
67
- const paramsCopy = __spreadValues$M({}, runtime.locationService.getSearchObject());
65
+ const paramsCopy = __spreadValues$K({}, runtime.locationService.getSearchObject());
68
66
  if (preserveParams) {
69
67
  for (const key of Object.keys(paramsCopy)) {
70
68
  if (!preserveParams.includes(key)) {
@@ -78,31 +76,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
78
76
  return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
79
77
  }
80
78
 
81
- var __defProp$L = Object.defineProperty;
82
- var __defProps$v = Object.defineProperties;
83
- var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
84
- var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
85
- var __hasOwnProp$L = Object.prototype.hasOwnProperty;
86
- var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
87
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
88
- var __spreadValues$L = (a, b) => {
79
+ var __defProp$J = Object.defineProperty;
80
+ var __defProps$t = Object.defineProperties;
81
+ var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
82
+ var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
83
+ var __hasOwnProp$J = Object.prototype.hasOwnProperty;
84
+ var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
85
+ var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
+ var __spreadValues$J = (a, b) => {
89
87
  for (var prop in b || (b = {}))
90
- if (__hasOwnProp$L.call(b, prop))
91
- __defNormalProp$L(a, prop, b[prop]);
92
- if (__getOwnPropSymbols$L)
93
- for (var prop of __getOwnPropSymbols$L(b)) {
94
- if (__propIsEnum$L.call(b, prop))
95
- __defNormalProp$L(a, prop, b[prop]);
88
+ if (__hasOwnProp$J.call(b, prop))
89
+ __defNormalProp$J(a, prop, b[prop]);
90
+ if (__getOwnPropSymbols$J)
91
+ for (var prop of __getOwnPropSymbols$J(b)) {
92
+ if (__propIsEnum$J.call(b, prop))
93
+ __defNormalProp$J(a, prop, b[prop]);
96
94
  }
97
95
  return a;
98
96
  };
99
- var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
97
+ var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
100
98
  const runtimePanelPlugins = /* @__PURE__ */ new Map();
101
99
  function registerRuntimePanelPlugin({ pluginId, plugin }) {
102
100
  if (runtimePanelPlugins.has(pluginId)) {
103
101
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
104
102
  }
105
- plugin.meta = __spreadProps$v(__spreadValues$L({}, plugin.meta), {
103
+ plugin.meta = __spreadProps$t(__spreadValues$J({}, plugin.meta), {
106
104
  id: pluginId,
107
105
  name: pluginId,
108
106
  module: "runtime plugin",
@@ -130,39 +128,39 @@ function loadPanelPluginSync(pluginId) {
130
128
  return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
131
129
  }
132
130
 
133
- var __defProp$K = Object.defineProperty;
134
- var __defProps$u = Object.defineProperties;
135
- var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
136
- var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
137
- var __hasOwnProp$K = Object.prototype.hasOwnProperty;
138
- var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
139
- var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
140
- var __spreadValues$K = (a, b) => {
131
+ var __defProp$I = Object.defineProperty;
132
+ var __defProps$s = Object.defineProperties;
133
+ var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
134
+ var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
135
+ var __hasOwnProp$I = Object.prototype.hasOwnProperty;
136
+ var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
137
+ var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138
+ var __spreadValues$I = (a, b) => {
141
139
  for (var prop in b || (b = {}))
142
- if (__hasOwnProp$K.call(b, prop))
143
- __defNormalProp$K(a, prop, b[prop]);
144
- if (__getOwnPropSymbols$K)
145
- for (var prop of __getOwnPropSymbols$K(b)) {
146
- if (__propIsEnum$K.call(b, prop))
147
- __defNormalProp$K(a, prop, b[prop]);
140
+ if (__hasOwnProp$I.call(b, prop))
141
+ __defNormalProp$I(a, prop, b[prop]);
142
+ if (__getOwnPropSymbols$I)
143
+ for (var prop of __getOwnPropSymbols$I(b)) {
144
+ if (__propIsEnum$I.call(b, prop))
145
+ __defNormalProp$I(a, prop, b[prop]);
148
146
  }
149
147
  return a;
150
148
  };
151
- var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
152
- var __objRest$5 = (source, exclude) => {
149
+ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
150
+ var __objRest$4 = (source, exclude) => {
153
151
  var target = {};
154
152
  for (var prop in source)
155
- if (__hasOwnProp$K.call(source, prop) && exclude.indexOf(prop) < 0)
153
+ if (__hasOwnProp$I.call(source, prop) && exclude.indexOf(prop) < 0)
156
154
  target[prop] = source[prop];
157
- if (source != null && __getOwnPropSymbols$K)
158
- for (var prop of __getOwnPropSymbols$K(source)) {
159
- if (exclude.indexOf(prop) < 0 && __propIsEnum$K.call(source, prop))
155
+ if (source != null && __getOwnPropSymbols$I)
156
+ for (var prop of __getOwnPropSymbols$I(source)) {
157
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$I.call(source, prop))
160
158
  target[prop] = source[prop];
161
159
  }
162
160
  return target;
163
161
  };
164
162
  function SceneComponentWrapperWithoutMemo(_a) {
165
- var _b = _a, { model } = _b, otherProps = __objRest$5(_b, ["model"]);
163
+ var _b = _a, { model } = _b, otherProps = __objRest$4(_b, ["model"]);
166
164
  var _a2;
167
165
  const Component = (_a2 = model.constructor["Component"]) != null ? _a2 : EmptyRenderer;
168
166
  const [_, setValue] = React.useState(0);
@@ -174,7 +172,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
174
172
  if (!model.isActive) {
175
173
  return null;
176
174
  }
177
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$u(__spreadValues$K({}, otherProps), {
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$s(__spreadValues$I({}, otherProps), {
178
176
  model
179
177
  }));
180
178
  }
@@ -220,19 +218,19 @@ class SceneObjectRef {
220
218
  }
221
219
  _ref = new WeakMap();
222
220
 
223
- var __defProp$J = Object.defineProperty;
224
- var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
225
- var __hasOwnProp$J = Object.prototype.hasOwnProperty;
226
- var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
227
- var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
228
- var __spreadValues$J = (a, b) => {
221
+ var __defProp$H = Object.defineProperty;
222
+ var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
223
+ var __hasOwnProp$H = Object.prototype.hasOwnProperty;
224
+ var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
225
+ var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
226
+ var __spreadValues$H = (a, b) => {
229
227
  for (var prop in b || (b = {}))
230
- if (__hasOwnProp$J.call(b, prop))
231
- __defNormalProp$J(a, prop, b[prop]);
232
- if (__getOwnPropSymbols$J)
233
- for (var prop of __getOwnPropSymbols$J(b)) {
234
- if (__propIsEnum$J.call(b, prop))
235
- __defNormalProp$J(a, prop, b[prop]);
228
+ if (__hasOwnProp$H.call(b, prop))
229
+ __defNormalProp$H(a, prop, b[prop]);
230
+ if (__getOwnPropSymbols$H)
231
+ for (var prop of __getOwnPropSymbols$H(b)) {
232
+ if (__propIsEnum$H.call(b, prop))
233
+ __defNormalProp$H(a, prop, b[prop]);
236
234
  }
237
235
  return a;
238
236
  };
@@ -292,7 +290,7 @@ class SceneObjectBase {
292
290
  }
293
291
  setState(update) {
294
292
  const prevState = this._state;
295
- const newState = __spreadValues$J(__spreadValues$J({}, this._state), update);
293
+ const newState = __spreadValues$H(__spreadValues$H({}, this._state), update);
296
294
  this._state = Object.freeze(newState);
297
295
  this._setParent(update);
298
296
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -488,19 +486,19 @@ function forEachChild(state, callback) {
488
486
  }
489
487
  }
490
488
 
491
- var __defProp$I = Object.defineProperty;
492
- var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
493
- var __hasOwnProp$I = Object.prototype.hasOwnProperty;
494
- var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
495
- var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
496
- var __spreadValues$I = (a, b) => {
489
+ var __defProp$G = Object.defineProperty;
490
+ var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
491
+ var __hasOwnProp$G = Object.prototype.hasOwnProperty;
492
+ var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
493
+ var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
494
+ var __spreadValues$G = (a, b) => {
497
495
  for (var prop in b || (b = {}))
498
- if (__hasOwnProp$I.call(b, prop))
499
- __defNormalProp$I(a, prop, b[prop]);
500
- if (__getOwnPropSymbols$I)
501
- for (var prop of __getOwnPropSymbols$I(b)) {
502
- if (__propIsEnum$I.call(b, prop))
503
- __defNormalProp$I(a, prop, b[prop]);
496
+ if (__hasOwnProp$G.call(b, prop))
497
+ __defNormalProp$G(a, prop, b[prop]);
498
+ if (__getOwnPropSymbols$G)
499
+ for (var prop of __getOwnPropSymbols$G(b)) {
500
+ if (__propIsEnum$G.call(b, prop))
501
+ __defNormalProp$G(a, prop, b[prop]);
504
502
  }
505
503
  return a;
506
504
  };
@@ -509,7 +507,7 @@ function cloneSceneObject(sceneObject, withState) {
509
507
  return new sceneObject.constructor(clonedState);
510
508
  }
511
509
  function cloneSceneObjectState(sceneState, withState) {
512
- const clonedState = __spreadValues$I({}, sceneState);
510
+ const clonedState = __spreadValues$G({}, sceneState);
513
511
  for (const key in clonedState) {
514
512
  const propValue = clonedState[key];
515
513
  if (propValue instanceof SceneObjectBase) {
@@ -606,25 +604,25 @@ function lookupVariable(name, sceneObject) {
606
604
  return null;
607
605
  }
608
606
 
609
- var __defProp$H = Object.defineProperty;
610
- var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
611
- var __hasOwnProp$H = Object.prototype.hasOwnProperty;
612
- var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
613
- var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
614
- var __spreadValues$H = (a, b) => {
607
+ var __defProp$F = Object.defineProperty;
608
+ var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
609
+ var __hasOwnProp$F = Object.prototype.hasOwnProperty;
610
+ var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
611
+ var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
612
+ var __spreadValues$F = (a, b) => {
615
613
  for (var prop in b || (b = {}))
616
- if (__hasOwnProp$H.call(b, prop))
617
- __defNormalProp$H(a, prop, b[prop]);
618
- if (__getOwnPropSymbols$H)
619
- for (var prop of __getOwnPropSymbols$H(b)) {
620
- if (__propIsEnum$H.call(b, prop))
621
- __defNormalProp$H(a, prop, b[prop]);
614
+ if (__hasOwnProp$F.call(b, prop))
615
+ __defNormalProp$F(a, prop, b[prop]);
616
+ if (__getOwnPropSymbols$F)
617
+ for (var prop of __getOwnPropSymbols$F(b)) {
618
+ if (__propIsEnum$F.call(b, prop))
619
+ __defNormalProp$F(a, prop, b[prop]);
622
620
  }
623
621
  return a;
624
622
  };
625
623
  class SceneDataNode extends SceneObjectBase {
626
624
  constructor(state) {
627
- super(__spreadValues$H({
625
+ super(__spreadValues$F({
628
626
  data: emptyPanelData
629
627
  }, state));
630
628
  }
@@ -705,19 +703,19 @@ function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
705
703
  };
706
704
  }
707
705
 
708
- var __defProp$G = Object.defineProperty;
709
- var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
710
- var __hasOwnProp$G = Object.prototype.hasOwnProperty;
711
- var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
712
- var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
713
- var __spreadValues$G = (a, b) => {
706
+ var __defProp$E = Object.defineProperty;
707
+ var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
708
+ var __hasOwnProp$E = Object.prototype.hasOwnProperty;
709
+ var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
710
+ var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
711
+ var __spreadValues$E = (a, b) => {
714
712
  for (var prop in b || (b = {}))
715
- if (__hasOwnProp$G.call(b, prop))
716
- __defNormalProp$G(a, prop, b[prop]);
717
- if (__getOwnPropSymbols$G)
718
- for (var prop of __getOwnPropSymbols$G(b)) {
719
- if (__propIsEnum$G.call(b, prop))
720
- __defNormalProp$G(a, prop, b[prop]);
713
+ if (__hasOwnProp$E.call(b, prop))
714
+ __defNormalProp$E(a, prop, b[prop]);
715
+ if (__getOwnPropSymbols$E)
716
+ for (var prop of __getOwnPropSymbols$E(b)) {
717
+ if (__propIsEnum$E.call(b, prop))
718
+ __defNormalProp$E(a, prop, b[prop]);
721
719
  }
722
720
  return a;
723
721
  };
@@ -734,7 +732,7 @@ class SceneTimeRange extends SceneObjectBase {
734
732
  state.fiscalYearStartMonth,
735
733
  state.UNSAFE_nowDelay
736
734
  );
737
- super(__spreadValues$G({ from, to, timeZone, value }, state));
735
+ super(__spreadValues$E({ from, to, timeZone, value }, state));
738
736
  this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone"] });
739
737
  this.onTimeRangeChange = (timeRange) => {
740
738
  const update = {};
@@ -777,6 +775,7 @@ class SceneTimeRange extends SceneObjectBase {
777
775
  this.state.UNSAFE_nowDelay
778
776
  )
779
777
  });
778
+ this.publishEvent(new runtime.RefreshEvent());
780
779
  };
781
780
  this.addActivationHandler(this._onActivate.bind(this));
782
781
  }
@@ -1364,25 +1363,25 @@ function collectAllVariables(sceneObject, record = {}) {
1364
1363
  return record;
1365
1364
  }
1366
1365
 
1367
- var __defProp$F = Object.defineProperty;
1368
- var __defProps$t = Object.defineProperties;
1369
- var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
1370
- var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
1371
- var __hasOwnProp$F = Object.prototype.hasOwnProperty;
1372
- var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
1373
- var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1374
- var __spreadValues$F = (a, b) => {
1366
+ var __defProp$D = Object.defineProperty;
1367
+ var __defProps$r = Object.defineProperties;
1368
+ var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
1369
+ var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
1370
+ var __hasOwnProp$D = Object.prototype.hasOwnProperty;
1371
+ var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
1372
+ var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1373
+ var __spreadValues$D = (a, b) => {
1375
1374
  for (var prop in b || (b = {}))
1376
- if (__hasOwnProp$F.call(b, prop))
1377
- __defNormalProp$F(a, prop, b[prop]);
1378
- if (__getOwnPropSymbols$F)
1379
- for (var prop of __getOwnPropSymbols$F(b)) {
1380
- if (__propIsEnum$F.call(b, prop))
1381
- __defNormalProp$F(a, prop, b[prop]);
1375
+ if (__hasOwnProp$D.call(b, prop))
1376
+ __defNormalProp$D(a, prop, b[prop]);
1377
+ if (__getOwnPropSymbols$D)
1378
+ for (var prop of __getOwnPropSymbols$D(b)) {
1379
+ if (__propIsEnum$D.call(b, prop))
1380
+ __defNormalProp$D(a, prop, b[prop]);
1382
1381
  }
1383
1382
  return a;
1384
1383
  };
1385
- var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
1384
+ var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
1386
1385
  function getTemplateProxyForField(field, frame, frames) {
1387
1386
  return new Proxy(
1388
1387
  {},
@@ -1398,7 +1397,7 @@ function getTemplateProxyForField(field, frame, frames) {
1398
1397
  if (!field.labels) {
1399
1398
  return "";
1400
1399
  }
1401
- return __spreadProps$t(__spreadValues$F({}, field.labels), {
1400
+ return __spreadProps$r(__spreadValues$D({}, field.labels), {
1402
1401
  __values: Object.values(field.labels).sort().join(", "),
1403
1402
  toString: () => {
1404
1403
  return data.formatLabels(field.labels, "", true);
@@ -2283,25 +2282,25 @@ function isExtraQueryProvider(obj) {
2283
2282
  return typeof obj === "object" && "getExtraQueries" in obj;
2284
2283
  }
2285
2284
 
2286
- var __defProp$E = Object.defineProperty;
2287
- var __defProps$s = Object.defineProperties;
2288
- var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
2289
- var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
2290
- var __hasOwnProp$E = Object.prototype.hasOwnProperty;
2291
- var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
2292
- var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2293
- var __spreadValues$E = (a, b) => {
2285
+ var __defProp$C = Object.defineProperty;
2286
+ var __defProps$q = Object.defineProperties;
2287
+ var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2288
+ var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2289
+ var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2290
+ var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
2291
+ var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2292
+ var __spreadValues$C = (a, b) => {
2294
2293
  for (var prop in b || (b = {}))
2295
- if (__hasOwnProp$E.call(b, prop))
2296
- __defNormalProp$E(a, prop, b[prop]);
2297
- if (__getOwnPropSymbols$E)
2298
- for (var prop of __getOwnPropSymbols$E(b)) {
2299
- if (__propIsEnum$E.call(b, prop))
2300
- __defNormalProp$E(a, prop, b[prop]);
2294
+ if (__hasOwnProp$C.call(b, prop))
2295
+ __defNormalProp$C(a, prop, b[prop]);
2296
+ if (__getOwnPropSymbols$C)
2297
+ for (var prop of __getOwnPropSymbols$C(b)) {
2298
+ if (__propIsEnum$C.call(b, prop))
2299
+ __defNormalProp$C(a, prop, b[prop]);
2301
2300
  }
2302
2301
  return a;
2303
2302
  };
2304
- var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
2303
+ var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2305
2304
  const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
2306
2305
  const extraQueryProcessingOperator = (processors) => (data) => {
2307
2306
  return data.pipe(
@@ -2314,7 +2313,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2314
2313
  }),
2315
2314
  rxjs.map(([primary, ...processedSecondaries]) => {
2316
2315
  var _a;
2317
- return __spreadProps$s(__spreadValues$E({}, primary), {
2316
+ return __spreadProps$q(__spreadValues$C({}, primary), {
2318
2317
  series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
2319
2318
  annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
2320
2319
  var _a2;
@@ -2325,25 +2324,25 @@ const extraQueryProcessingOperator = (processors) => (data) => {
2325
2324
  );
2326
2325
  };
2327
2326
 
2328
- var __defProp$D = Object.defineProperty;
2329
- var __defProps$r = Object.defineProperties;
2330
- var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
2331
- var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
2332
- var __hasOwnProp$D = Object.prototype.hasOwnProperty;
2333
- var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
2334
- var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2335
- var __spreadValues$D = (a, b) => {
2327
+ var __defProp$B = Object.defineProperty;
2328
+ var __defProps$p = Object.defineProperties;
2329
+ var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
2330
+ var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
2331
+ var __hasOwnProp$B = Object.prototype.hasOwnProperty;
2332
+ var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
2333
+ var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2334
+ var __spreadValues$B = (a, b) => {
2336
2335
  for (var prop in b || (b = {}))
2337
- if (__hasOwnProp$D.call(b, prop))
2338
- __defNormalProp$D(a, prop, b[prop]);
2339
- if (__getOwnPropSymbols$D)
2340
- for (var prop of __getOwnPropSymbols$D(b)) {
2341
- if (__propIsEnum$D.call(b, prop))
2342
- __defNormalProp$D(a, prop, b[prop]);
2336
+ if (__hasOwnProp$B.call(b, prop))
2337
+ __defNormalProp$B(a, prop, b[prop]);
2338
+ if (__getOwnPropSymbols$B)
2339
+ for (var prop of __getOwnPropSymbols$B(b)) {
2340
+ if (__propIsEnum$B.call(b, prop))
2341
+ __defNormalProp$B(a, prop, b[prop]);
2343
2342
  }
2344
2343
  return a;
2345
2344
  };
2346
- var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
2345
+ var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
2347
2346
  function filterAnnotations(data, filters) {
2348
2347
  var _a;
2349
2348
  if (!Array.isArray(data) || data.length === 0) {
@@ -2394,11 +2393,11 @@ function filterAnnotations(data, filters) {
2394
2393
  continue;
2395
2394
  }
2396
2395
  }
2397
- fields.push(__spreadProps$r(__spreadValues$D({}, field), {
2396
+ fields.push(__spreadProps$p(__spreadValues$B({}, field), {
2398
2397
  values: buffer
2399
2398
  }));
2400
2399
  }
2401
- processed.push(__spreadProps$r(__spreadValues$D({}, frame), {
2400
+ processed.push(__spreadProps$p(__spreadValues$B({}, frame), {
2402
2401
  fields,
2403
2402
  length: frameLength
2404
2403
  }));
@@ -2824,33 +2823,33 @@ function getOptionSearcher(options, includeAll) {
2824
2823
  };
2825
2824
  }
2826
2825
 
2827
- var __defProp$C = Object.defineProperty;
2828
- var __defProps$q = Object.defineProperties;
2829
- var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2830
- var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2831
- var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2832
- var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
2833
- var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2834
- var __spreadValues$C = (a, b) => {
2835
- for (var prop in b || (b = {}))
2836
- if (__hasOwnProp$C.call(b, prop))
2837
- __defNormalProp$C(a, prop, b[prop]);
2838
- if (__getOwnPropSymbols$C)
2839
- for (var prop of __getOwnPropSymbols$C(b)) {
2840
- if (__propIsEnum$C.call(b, prop))
2841
- __defNormalProp$C(a, prop, b[prop]);
2826
+ var __defProp$A = Object.defineProperty;
2827
+ var __defProps$o = Object.defineProperties;
2828
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2829
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2830
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2831
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2832
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2833
+ var __spreadValues$A = (a, b) => {
2834
+ for (var prop in b || (b = {}))
2835
+ if (__hasOwnProp$A.call(b, prop))
2836
+ __defNormalProp$A(a, prop, b[prop]);
2837
+ if (__getOwnPropSymbols$A)
2838
+ for (var prop of __getOwnPropSymbols$A(b)) {
2839
+ if (__propIsEnum$A.call(b, prop))
2840
+ __defNormalProp$A(a, prop, b[prop]);
2842
2841
  }
2843
2842
  return a;
2844
2843
  };
2845
- var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2846
- var __objRest$4 = (source, exclude) => {
2844
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
2845
+ var __objRest$3 = (source, exclude) => {
2847
2846
  var target = {};
2848
2847
  for (var prop in source)
2849
- if (__hasOwnProp$C.call(source, prop) && exclude.indexOf(prop) < 0)
2848
+ if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
2850
2849
  target[prop] = source[prop];
2851
- if (source != null && __getOwnPropSymbols$C)
2852
- for (var prop of __getOwnPropSymbols$C(source)) {
2853
- if (exclude.indexOf(prop) < 0 && __propIsEnum$C.call(source, prop))
2850
+ if (source != null && __getOwnPropSymbols$A)
2851
+ for (var prop of __getOwnPropSymbols$A(source)) {
2852
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
2854
2853
  target[prop] = source[prop];
2855
2854
  }
2856
2855
  return target;
@@ -2978,11 +2977,11 @@ const OptionWithCheckbox = ({
2978
2977
  renderOptionLabel
2979
2978
  }) => {
2980
2979
  var _b;
2981
- const _a = innerProps, rest = __objRest$4(_a, ["onMouseMove", "onMouseOver"]);
2980
+ const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
2982
2981
  const theme = ui.useTheme2();
2983
2982
  const selectStyles = ui.getSelectStyles(theme);
2984
2983
  const optionStyles = ui.useStyles2(getOptionStyles);
2985
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$q(__spreadValues$C({
2984
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
2986
2985
  ref: innerRef,
2987
2986
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
2988
2987
  }, rest), {
@@ -3084,28 +3083,28 @@ function getEnrichedFiltersRequest(sourceRunner) {
3084
3083
  return null;
3085
3084
  }
3086
3085
 
3087
- var __defProp$B = Object.defineProperty;
3088
- var __defProps$p = Object.defineProperties;
3089
- var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
3090
- var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
3091
- var __hasOwnProp$B = Object.prototype.hasOwnProperty;
3092
- var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
3093
- var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3094
- var __spreadValues$B = (a, b) => {
3086
+ var __defProp$z = Object.defineProperty;
3087
+ var __defProps$n = Object.defineProperties;
3088
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
3089
+ var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
3090
+ var __hasOwnProp$z = Object.prototype.hasOwnProperty;
3091
+ var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
3092
+ var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3093
+ var __spreadValues$z = (a, b) => {
3095
3094
  for (var prop in b || (b = {}))
3096
- if (__hasOwnProp$B.call(b, prop))
3097
- __defNormalProp$B(a, prop, b[prop]);
3098
- if (__getOwnPropSymbols$B)
3099
- for (var prop of __getOwnPropSymbols$B(b)) {
3100
- if (__propIsEnum$B.call(b, prop))
3101
- __defNormalProp$B(a, prop, b[prop]);
3095
+ if (__hasOwnProp$z.call(b, prop))
3096
+ __defNormalProp$z(a, prop, b[prop]);
3097
+ if (__getOwnPropSymbols$z)
3098
+ for (var prop of __getOwnPropSymbols$z(b)) {
3099
+ if (__propIsEnum$z.call(b, prop))
3100
+ __defNormalProp$z(a, prop, b[prop]);
3102
3101
  }
3103
3102
  return a;
3104
3103
  };
3105
- var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
3104
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
3106
3105
  class GroupByVariable extends MultiValueVariable {
3107
3106
  constructor(initialState) {
3108
- super(__spreadProps$p(__spreadValues$B({
3107
+ super(__spreadProps$n(__spreadValues$z({
3109
3108
  isMulti: true,
3110
3109
  name: "",
3111
3110
  value: [],
@@ -3138,7 +3137,7 @@ class GroupByVariable extends MultiValueVariable {
3138
3137
  const queries = getQueriesForVariables(this);
3139
3138
  const otherFilters = this.state.baseFilters || [];
3140
3139
  const timeRange = sceneGraph.getTimeRange(this).state.value;
3141
- const response = await ds.getTagKeys(__spreadValues$B({ filters: otherFilters, queries, timeRange }, getEnrichedFiltersRequest(this)));
3140
+ const response = await ds.getTagKeys(__spreadValues$z({ filters: otherFilters, queries, timeRange }, getEnrichedFiltersRequest(this)));
3142
3141
  if (responseHasError(response)) {
3143
3142
  this.setState({ error: response.error.message });
3144
3143
  }
@@ -3329,7 +3328,7 @@ function LoadingIndicator(props) {
3329
3328
  }
3330
3329
 
3331
3330
  function ControlsLabel(props) {
3332
- const styles = ui.useStyles2(getStyles$c);
3331
+ const styles = ui.useStyles2(getStyles$a);
3333
3332
  const theme = ui.useTheme2();
3334
3333
  const isVertical = props.layout === "vertical";
3335
3334
  const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3392,7 +3391,7 @@ function ControlsLabel(props) {
3392
3391
  }
3393
3392
  return labelElement;
3394
3393
  }
3395
- const getStyles$c = (theme) => ({
3394
+ const getStyles$a = (theme) => ({
3396
3395
  horizontalLabel: css.css({
3397
3396
  background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
3398
3397
  display: `flex`,
@@ -3472,7 +3471,7 @@ function keyLabelToOption(key, label) {
3472
3471
  const filterNoOp = () => true;
3473
3472
  function AdHocFilterRenderer({ filter, model }) {
3474
3473
  var _a, _b;
3475
- const styles = ui.useStyles2(getStyles$b);
3474
+ const styles = ui.useStyles2(getStyles$9);
3476
3475
  const [keys, setKeys] = React.useState([]);
3477
3476
  const [values, setValues] = React.useState([]);
3478
3477
  const [isKeysLoading, setIsKeysLoading] = React.useState(false);
@@ -3483,7 +3482,10 @@ function AdHocFilterRenderer({ filter, model }) {
3483
3482
  const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3484
3483
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3485
3484
  const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
3486
- const optionSearcher = React.useMemo(() => getAdhocOptionSearcher(values), [values]);
3485
+ const optionSearcher = React.useMemo(
3486
+ () => getAdhocOptionSearcher(values),
3487
+ [values]
3488
+ );
3487
3489
  const onValueInputChange = (value, { action }) => {
3488
3490
  if (action === "input-change") {
3489
3491
  setValueInputValue(value);
@@ -3613,7 +3615,7 @@ function AdHocFilterRenderer({ filter, model }) {
3613
3615
  onClick: () => model._removeFilter(filter)
3614
3616
  }));
3615
3617
  }
3616
- const getStyles$b = (theme) => ({
3618
+ const getStyles$9 = (theme) => ({
3617
3619
  field: css.css({
3618
3620
  marginBottom: 0
3619
3621
  }),
@@ -3751,532 +3753,6 @@ function isFilter(filter) {
3751
3753
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3752
3754
  }
3753
3755
 
3754
- var __defProp$A = Object.defineProperty;
3755
- var __defProps$o = Object.defineProperties;
3756
- var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
3757
- var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
3758
- var __hasOwnProp$A = Object.prototype.hasOwnProperty;
3759
- var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
3760
- var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3761
- var __spreadValues$A = (a, b) => {
3762
- for (var prop in b || (b = {}))
3763
- if (__hasOwnProp$A.call(b, prop))
3764
- __defNormalProp$A(a, prop, b[prop]);
3765
- if (__getOwnPropSymbols$A)
3766
- for (var prop of __getOwnPropSymbols$A(b)) {
3767
- if (__propIsEnum$A.call(b, prop))
3768
- __defNormalProp$A(a, prop, b[prop]);
3769
- }
3770
- return a;
3771
- };
3772
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
3773
- var __objRest$3 = (source, exclude) => {
3774
- var target = {};
3775
- for (var prop in source)
3776
- if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
3777
- target[prop] = source[prop];
3778
- if (source != null && __getOwnPropSymbols$A)
3779
- for (var prop of __getOwnPropSymbols$A(source)) {
3780
- if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
3781
- target[prop] = source[prop];
3782
- }
3783
- return target;
3784
- };
3785
- const Item = React.forwardRef(
3786
- (_a, ref) => {
3787
- var _b = _a, { children, active } = _b, rest = __objRest$3(_b, ["children", "active"]);
3788
- const theme = ui.useTheme2();
3789
- const selectStyles = ui.getSelectStyles(theme);
3790
- const id = react.useId();
3791
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$A({
3792
- ref,
3793
- role: "option",
3794
- id,
3795
- "aria-selected": active,
3796
- className: css.cx(selectStyles.option, active && selectStyles.optionFocused)
3797
- }, rest), /* @__PURE__ */ React__default["default"].createElement("div", {
3798
- className: selectStyles.optionBody,
3799
- "data-testid": `data-testid ad hoc filter option value ${children}`
3800
- }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
3801
- }
3802
- );
3803
- const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, wip, handleChangeViewMode }, parentRef) {
3804
- var _a;
3805
- const [open, setOpen] = React.useState(false);
3806
- const [options, setOptions] = React.useState([]);
3807
- const [inputValue, setInputValue] = React.useState("");
3808
- const [activeIndex, setActiveIndex] = React.useState(null);
3809
- const [inputType, setInputType] = React.useState(!wip ? "value" : "key");
3810
- const styles = ui.useStyles2(getStyles2);
3811
- const listRef = React.useRef([]);
3812
- const { _wip } = model.useState();
3813
- const handleResetWip = React.useCallback(() => {
3814
- if (wip) {
3815
- model._addWip();
3816
- setInputType("key");
3817
- setInputValue("");
3818
- }
3819
- }, [model, wip]);
3820
- const filterToUse = filter || _wip;
3821
- const operatorIdentifier = `${(_a = filterToUse == null ? void 0 : filterToUse.key) != null ? _a : ""}-operator`;
3822
- const { refs, floatingStyles, context } = react.useFloating({
3823
- whileElementsMounted: react.autoUpdate,
3824
- open,
3825
- onOpenChange: (nextOpen, _, reason) => {
3826
- setOpen(nextOpen);
3827
- if (["outside-press", "escape-key"].includes(reason || "")) {
3828
- handleResetWip();
3829
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3830
- }
3831
- },
3832
- middleware: [
3833
- react.flip({ padding: 10 }),
3834
- react.size({
3835
- apply({ rects, availableHeight, elements }) {
3836
- Object.assign(elements.floating.style, {
3837
- width: `${rects.reference.width}px`,
3838
- maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`
3839
- });
3840
- },
3841
- padding: 10
3842
- })
3843
- ]
3844
- });
3845
- const role = react.useRole(context, { role: "listbox" });
3846
- const dismiss = react.useDismiss(context, {
3847
- outsidePress: (event) => {
3848
- return !event.currentTarget.classList.contains(
3849
- operatorIdentifier
3850
- );
3851
- }
3852
- });
3853
- const listNav = react.useListNavigation(context, {
3854
- listRef,
3855
- activeIndex,
3856
- onNavigate: setActiveIndex,
3857
- virtual: true,
3858
- loop: true
3859
- });
3860
- const { getReferenceProps, getFloatingProps, getItemProps } = react.useInteractions([role, dismiss, listNav]);
3861
- React.useImperativeHandle(parentRef, () => () => {
3862
- var _a2;
3863
- return (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3864
- }, [refs.domReference]);
3865
- function onChange(event) {
3866
- var _a2, _b;
3867
- if (inputType === "key") {
3868
- const lastChar = event.target.value.slice(-1);
3869
- if (["=", "!", "<", ">"].includes(lastChar)) {
3870
- const key = event.target.value.slice(0, -1);
3871
- const optionIndex = options.findIndex((option) => option.value === key);
3872
- if (optionIndex >= 0) {
3873
- model._updateFilter(filterToUse, inputType, options[optionIndex]);
3874
- setInputValue(lastChar);
3875
- }
3876
- reactDom.flushSync(() => {
3877
- setInputType("operator");
3878
- });
3879
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3880
- return;
3881
- }
3882
- }
3883
- if (inputType === "operator") {
3884
- const lastChar = event.target.value.slice(-1);
3885
- if (/\w/.test(lastChar)) {
3886
- const operator = event.target.value.slice(0, -1);
3887
- if (!/\w/.test(operator)) {
3888
- const optionIndex = options.findIndex((option) => option.value === operator);
3889
- if (optionIndex >= 0) {
3890
- model._updateFilter(filterToUse, inputType, options[optionIndex]);
3891
- setInputValue(lastChar);
3892
- }
3893
- reactDom.flushSync(() => {
3894
- setInputType("value");
3895
- });
3896
- (_b = refs.domReference.current) == null ? void 0 : _b.focus();
3897
- return;
3898
- }
3899
- }
3900
- }
3901
- const value = event.target.value;
3902
- setInputValue(value);
3903
- setActiveIndex(0);
3904
- }
3905
- const items = options.filter(
3906
- (item) => {
3907
- var _a2, _b;
3908
- return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
3909
- }
3910
- );
3911
- const flushInputType = React.useCallback((inputType2) => {
3912
- reactDom.flushSync(() => {
3913
- setInputType(inputType2);
3914
- });
3915
- }, []);
3916
- React.useEffect(() => {
3917
- if (wip && !_wip) {
3918
- model._addWip();
3919
- }
3920
- }, [_wip]);
3921
- React.useEffect(() => {
3922
- if (!wip && refs.domReference.current) {
3923
- setInputType("value");
3924
- setInputValue("");
3925
- refs.domReference.current.focus();
3926
- }
3927
- }, []);
3928
- const handleFetchOptions = React.useCallback(async () => {
3929
- let options2 = [];
3930
- if (inputType === "key") {
3931
- options2 = await model._getKeys(null);
3932
- } else if (inputType === "operator") {
3933
- options2 = model._getOperators();
3934
- } else if (inputType === "value") {
3935
- options2 = await model._getValuesFor(filterToUse);
3936
- }
3937
- setOptions(options2);
3938
- }, [filterToUse, inputType, model]);
3939
- const handleBackspaceInput = React.useCallback(
3940
- (event) => {
3941
- if (event.key === "Backspace" && !inputValue && inputType === "key") {
3942
- model._removeLastFilter();
3943
- setOpen(false);
3944
- }
3945
- },
3946
- [inputValue, inputType]
3947
- );
3948
- const handleTabInput = React.useCallback((event) => {
3949
- if (event.key === "Tab" && !event.shiftKey) {
3950
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3951
- handleResetWip();
3952
- }
3953
- }, []);
3954
- const handleShiftTabInput = React.useCallback((event) => {
3955
- if (event.key === "Tab" && event.shiftKey) {
3956
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3957
- handleResetWip();
3958
- }
3959
- }, []);
3960
- const handleEnterInput = React.useCallback(
3961
- (event) => {
3962
- var _a2;
3963
- if (event.key === "Enter" && activeIndex != null && items[activeIndex]) {
3964
- model._updateFilter(filterToUse, inputType, items[activeIndex]);
3965
- setInputValue("");
3966
- if (inputType === "key") {
3967
- flushInputType("operator");
3968
- } else if (inputType === "operator") {
3969
- flushInputType("value");
3970
- } else if (inputType === "value") {
3971
- flushInputType("key");
3972
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3973
- }
3974
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3975
- }
3976
- },
3977
- [activeIndex, filterToUse, inputType, items, model]
3978
- );
3979
- React.useEffect(() => {
3980
- if (open) {
3981
- handleFetchOptions();
3982
- }
3983
- }, [open, inputType]);
3984
- return /* @__PURE__ */ React__default["default"].createElement("div", {
3985
- className: styles.comboboxWrapper
3986
- }, filterToUse ? /* @__PURE__ */ React__default["default"].createElement("div", {
3987
- className: styles.pillWrapper
3988
- }, (filterToUse == null ? void 0 : filterToUse.key) ? /* @__PURE__ */ React__default["default"].createElement("div", {
3989
- className: css.cx(styles.basePill, styles.keyPill)
3990
- }, filterToUse.key) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && inputType !== "operator" ? /* @__PURE__ */ React__default["default"].createElement("div", {
3991
- className: css.cx(styles.basePill, styles.operatorPill, operatorIdentifier),
3992
- role: "button",
3993
- "aria-label": "Edit filter operator",
3994
- tabIndex: 0,
3995
- onClick: (event) => {
3996
- var _a2;
3997
- event.stopPropagation();
3998
- flushInputType("operator");
3999
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
4000
- },
4001
- onKeyDown: (event) => {
4002
- var _a2;
4003
- handleShiftTabInput(event);
4004
- if (event.key === "Enter") {
4005
- flushInputType("operator");
4006
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
4007
- }
4008
- }
4009
- }, filterToUse.operator) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && (filterToUse == null ? void 0 : filterToUse.value) && !["operator", "value"].includes(inputType) ? /* @__PURE__ */ React__default["default"].createElement("div", {
4010
- className: css.cx(styles.basePill, styles.valuePill)
4011
- }, filterToUse.value) : null) : null, /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$o(__spreadValues$A({}, getReferenceProps({
4012
- ref: refs.setReference,
4013
- onChange,
4014
- value: inputValue,
4015
- placeholder: !wip ? inputType === "operator" ? `${filterToUse[inputType]} ${filterToUse.value || ""}` : filterToUse[inputType] : "Filter by label values",
4016
- "aria-autocomplete": "list",
4017
- onKeyDown(event) {
4018
- if (inputType === "operator") {
4019
- handleShiftTabInput(event);
4020
- }
4021
- handleBackspaceInput(event);
4022
- handleTabInput(event);
4023
- handleEnterInput(event);
4024
- }
4025
- })), {
4026
- className: styles.inputStyle,
4027
- onClick: (event) => {
4028
- event.stopPropagation();
4029
- setOpen(true);
4030
- },
4031
- onFocus: () => {
4032
- setActiveIndex(0);
4033
- setOpen(true);
4034
- }
4035
- })), /* @__PURE__ */ React__default["default"].createElement(react.FloatingPortal, null, open && /* @__PURE__ */ React__default["default"].createElement(react.FloatingFocusManager, {
4036
- context,
4037
- initialFocus: -1,
4038
- visuallyHiddenDismiss: true
4039
- }, /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({}, getFloatingProps({
4040
- ref: refs.setFloating,
4041
- style: __spreadProps$o(__spreadValues$A({}, floatingStyles), {
4042
- overflowY: "auto"
4043
- })
4044
- })), {
4045
- className: styles.dropdownWrapper
4046
- }), items.map((item, index) => {
4047
- var _a2;
4048
- return /* @__PURE__ */ React__default["default"].createElement(Item, __spreadProps$o(__spreadValues$A({}, getItemProps({
4049
- key: item.value,
4050
- ref(node) {
4051
- listRef.current[index] = node;
4052
- },
4053
- onClick() {
4054
- var _a3;
4055
- model._updateFilter(filterToUse, inputType, item);
4056
- setInputValue("");
4057
- if (inputType === "key") {
4058
- flushInputType("operator");
4059
- } else if (inputType === "operator") {
4060
- flushInputType("value");
4061
- } else if (inputType === "value") {
4062
- flushInputType("key");
4063
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
4064
- }
4065
- (_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
4066
- }
4067
- })), {
4068
- active: activeIndex === index
4069
- }), (_a2 = item.label) != null ? _a2 : item.value);
4070
- })))));
4071
- });
4072
- const getStyles2 = (theme) => ({
4073
- comboboxWrapper: css.css({
4074
- display: "flex",
4075
- flexWrap: "nowrap"
4076
- }),
4077
- pillWrapper: css.css({
4078
- display: "flex",
4079
- alignItems: "center",
4080
- whiteSpace: "nowrap"
4081
- }),
4082
- basePill: css.css(__spreadProps$o(__spreadValues$A({
4083
- display: "flex",
4084
- alignItems: "center",
4085
- background: theme.colors.action.disabledBackground,
4086
- border: `1px solid ${theme.colors.border.weak}`,
4087
- padding: theme.spacing(0.125, 1, 0.125, 1),
4088
- color: theme.colors.text.primary,
4089
- overflow: "hidden",
4090
- whiteSpace: "nowrap",
4091
- minHeight: "22px"
4092
- }, theme.typography.bodySmall), {
4093
- cursor: "pointer"
4094
- })),
4095
- keyPill: css.css({
4096
- fontWeight: theme.typography.fontWeightBold,
4097
- cursor: "default"
4098
- }),
4099
- operatorPill: css.css({
4100
- "&:hover": {
4101
- background: theme.colors.action.hover
4102
- }
4103
- }),
4104
- valuePill: css.css({
4105
- background: theme.colors.action.selected
4106
- }),
4107
- dropdownWrapper: css.css({
4108
- backgroundColor: theme.colors.background.primary,
4109
- color: theme.colors.text.primary,
4110
- boxShadow: theme.shadows.z2
4111
- }),
4112
- inputStyle: css.css({
4113
- paddingBlock: 0,
4114
- "&:focus": {
4115
- outline: "none"
4116
- }
4117
- })
4118
- });
4119
-
4120
- var __defProp$z = Object.defineProperty;
4121
- var __defProps$n = Object.defineProperties;
4122
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
4123
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
4124
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
4125
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
4126
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4127
- var __spreadValues$z = (a, b) => {
4128
- for (var prop in b || (b = {}))
4129
- if (__hasOwnProp$z.call(b, prop))
4130
- __defNormalProp$z(a, prop, b[prop]);
4131
- if (__getOwnPropSymbols$z)
4132
- for (var prop of __getOwnPropSymbols$z(b)) {
4133
- if (__propIsEnum$z.call(b, prop))
4134
- __defNormalProp$z(a, prop, b[prop]);
4135
- }
4136
- return a;
4137
- };
4138
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
4139
- function AdHocFiltersComboboxEditSwitch({
4140
- filter,
4141
- model
4142
- }) {
4143
- const styles = ui.useStyles2(getStyles$a);
4144
- const [viewMode, setViewMode] = React.useState(true);
4145
- const pillWrapperRef = React.useRef(null);
4146
- const handleChangeViewMode = React.useCallback((event) => {
4147
- var _a;
4148
- event == null ? void 0 : event.stopPropagation();
4149
- let viewMode2 = false;
4150
- reactDom.flushSync(() => {
4151
- setViewMode((mode) => {
4152
- viewMode2 = mode;
4153
- return !mode;
4154
- });
4155
- });
4156
- if (!viewMode2) {
4157
- (_a = pillWrapperRef.current) == null ? void 0 : _a.focus();
4158
- }
4159
- }, []);
4160
- if (viewMode) {
4161
- return /* @__PURE__ */ React__default["default"].createElement("div", {
4162
- className: styles.combinedFilterPill,
4163
- onClick: handleChangeViewMode,
4164
- onKeyDown: (e) => {
4165
- if (e.key === "Enter") {
4166
- handleChangeViewMode();
4167
- }
4168
- },
4169
- role: "button",
4170
- "aria-label": "Edit filter",
4171
- tabIndex: 0,
4172
- ref: pillWrapperRef
4173
- }, /* @__PURE__ */ React__default["default"].createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
4174
- onClick: (e) => {
4175
- e.stopPropagation();
4176
- model._removeFilter(filter);
4177
- },
4178
- onKeyDownCapture: (e) => {
4179
- if (e.key === "Enter") {
4180
- e.preventDefault();
4181
- e.stopPropagation();
4182
- model._removeFilter(filter);
4183
- }
4184
- },
4185
- name: "times",
4186
- size: "md",
4187
- className: styles.removeButton,
4188
- tooltip: "Remove filter"
4189
- }));
4190
- }
4191
- return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
4192
- filter,
4193
- model,
4194
- handleChangeViewMode
4195
- });
4196
- }
4197
- const getStyles$a = (theme) => ({
4198
- combinedFilterPill: css.css(__spreadProps$n(__spreadValues$z({
4199
- display: "flex",
4200
- alignItems: "center",
4201
- background: theme.colors.action.selected,
4202
- borderRadius: theme.shape.radius.default,
4203
- border: `1px solid ${theme.colors.border.weak}`,
4204
- padding: theme.spacing(0.125, 0, 0.125, 1),
4205
- color: theme.colors.text.primary,
4206
- overflow: "hidden",
4207
- whiteSpace: "nowrap",
4208
- minHeight: "22px"
4209
- }, theme.typography.bodySmall), {
4210
- fontWeight: theme.typography.fontWeightBold,
4211
- cursor: "pointer",
4212
- "&:hover": {
4213
- background: theme.colors.action.hover
4214
- }
4215
- })),
4216
- removeButton: css.css({
4217
- marginInline: theme.spacing(0.5),
4218
- cursor: "pointer",
4219
- "&:hover": {
4220
- color: theme.colors.text.primary
4221
- }
4222
- })
4223
- });
4224
-
4225
- const AdHocFiltersComboboxRenderer = React.memo(function AdHocFiltersComboboxRenderer2({
4226
- model
4227
- }) {
4228
- const { filters } = model.useState();
4229
- const styles = ui.useStyles2(getStyles$9);
4230
- const focusOnInputRef = React.useRef();
4231
- return /* @__PURE__ */ React__default["default"].createElement("div", {
4232
- className: styles.comboboxWrapper,
4233
- onClick: () => {
4234
- var _a;
4235
- (_a = focusOnInputRef.current) == null ? void 0 : _a.call(focusOnInputRef);
4236
- }
4237
- }, /* @__PURE__ */ React__default["default"].createElement(ui.Icon, {
4238
- name: "filter",
4239
- className: styles.filterIcon,
4240
- size: "lg"
4241
- }), filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxEditSwitch, {
4242
- key: index,
4243
- filter,
4244
- model
4245
- })), /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
4246
- model,
4247
- wip: true,
4248
- ref: focusOnInputRef
4249
- }));
4250
- });
4251
- const getStyles$9 = (theme) => ({
4252
- comboboxWrapper: css.css({
4253
- display: "flex",
4254
- flexWrap: "wrap",
4255
- alignItems: "center",
4256
- columnGap: theme.spacing(1),
4257
- rowGap: theme.spacing(0.5),
4258
- minHeight: theme.spacing(4),
4259
- backgroundColor: theme.components.input.background,
4260
- border: `1px solid ${theme.colors.border.strong}`,
4261
- borderRadius: theme.shape.radius.default,
4262
- paddingInline: theme.spacing(1),
4263
- paddingBlock: theme.spacing(0.5),
4264
- flexGrow: 1,
4265
- "&:focus-within": {
4266
- outline: "2px dotted transparent",
4267
- outlineOffset: "2px",
4268
- boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
4269
- transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
4270
- transitionDuration: "0.2s",
4271
- transitionProperty: "outline, outline-offset, box-shadow"
4272
- }
4273
- }),
4274
- filterIcon: css.css({
4275
- color: theme.colors.text.secondary,
4276
- alignSelf: "center"
4277
- })
4278
- });
4279
-
4280
3756
  var __defProp$y = Object.defineProperty;
4281
3757
  var __defProps$m = Object.defineProperties;
4282
3758
  var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
@@ -4362,12 +3838,6 @@ class AdHocFiltersVariable extends SceneObjectBase {
4362
3838
  }
4363
3839
  this.setState({ filters: this.state.filters.filter((f) => f !== filter) });
4364
3840
  }
4365
- _removeLastFilter() {
4366
- const filterToRemove = this.state.filters.at(-1);
4367
- if (filterToRemove) {
4368
- this._removeFilter(filterToRemove);
4369
- }
4370
- }
4371
3841
  async _getKeys(currentKey) {
4372
3842
  var _a, _b, _c;
4373
3843
  const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
@@ -4384,11 +3854,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
4384
3854
  const otherFilters = this.state.filters.filter((f) => f.key !== currentKey).concat((_c = this.state.baseFilters) != null ? _c : []);
4385
3855
  const timeRange = sceneGraph.getTimeRange(this).state.value;
4386
3856
  const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : void 0;
4387
- const response = await ds.getTagKeys(__spreadValues$y({
4388
- filters: otherFilters,
4389
- queries,
4390
- timeRange
4391
- }, getEnrichedFiltersRequest(this)));
3857
+ const response = await ds.getTagKeys(__spreadValues$y({ filters: otherFilters, queries, timeRange }, getEnrichedFiltersRequest(this)));
4392
3858
  if (responseHasError(response)) {
4393
3859
  this.setState({ error: response.error.message });
4394
3860
  }
@@ -4449,11 +3915,6 @@ function renderExpression(builder, filters) {
4449
3915
  function AdHocFiltersVariableRenderer({ model }) {
4450
3916
  const { filters, readOnly, addFilterButtonText } = model.useState();
4451
3917
  const styles = ui.useStyles2(getStyles$8);
4452
- if (model.state.layout === "combobox") {
4453
- return /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxRenderer, {
4454
- model
4455
- });
4456
- }
4457
3918
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4458
3919
  className: styles.wrapper
4459
3920
  }, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
@@ -4474,6 +3935,10 @@ const getStyles$8 = (theme) => ({
4474
3935
  alignItems: "flex-end",
4475
3936
  columnGap: theme.spacing(2),
4476
3937
  rowGap: theme.spacing(1)
3938
+ }),
3939
+ filterIcon: css.css({
3940
+ color: theme.colors.text.secondary,
3941
+ paddingRight: theme.spacing(0.5)
4477
3942
  })
4478
3943
  });
4479
3944
  function toSelectableValue(input) {