@grafana/scenes 5.10.1--canary.830.10456603604.0 → 5.10.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -14,9 +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 reactDom = require('react-dom');
18
- var react = require('@floating-ui/react');
19
- var reactVirtual = require('@tanstack/react-virtual');
20
17
  var reactUse = require('react-use');
21
18
  var operators = require('rxjs/operators');
22
19
  var ReactGridLayout = require('react-grid-layout');
@@ -42,19 +39,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
39
  var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
43
40
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
44
41
 
45
- var __defProp$N = Object.defineProperty;
46
- var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
47
- var __hasOwnProp$N = Object.prototype.hasOwnProperty;
48
- var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
49
- var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
50
- var __spreadValues$N = (a, b) => {
42
+ var __defProp$K = Object.defineProperty;
43
+ var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
44
+ var __hasOwnProp$K = Object.prototype.hasOwnProperty;
45
+ var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
46
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47
+ var __spreadValues$K = (a, b) => {
51
48
  for (var prop in b || (b = {}))
52
- if (__hasOwnProp$N.call(b, prop))
53
- __defNormalProp$N(a, prop, b[prop]);
54
- if (__getOwnPropSymbols$N)
55
- for (var prop of __getOwnPropSymbols$N(b)) {
56
- if (__propIsEnum$N.call(b, prop))
57
- __defNormalProp$N(a, prop, b[prop]);
49
+ if (__hasOwnProp$K.call(b, prop))
50
+ __defNormalProp$K(a, prop, b[prop]);
51
+ if (__getOwnPropSymbols$K)
52
+ for (var prop of __getOwnPropSymbols$K(b)) {
53
+ if (__propIsEnum$K.call(b, prop))
54
+ __defNormalProp$K(a, prop, b[prop]);
58
55
  }
59
56
  return a;
60
57
  };
@@ -63,7 +60,7 @@ function useAppQueryParams() {
63
60
  return runtime.locationSearchToObject(location.search || "");
64
61
  }
65
62
  function getUrlWithAppState(path, preserveParams) {
66
- const paramsCopy = __spreadValues$N({}, runtime.locationService.getSearchObject());
63
+ const paramsCopy = __spreadValues$K({}, runtime.locationService.getSearchObject());
67
64
  if (preserveParams) {
68
65
  for (const key of Object.keys(paramsCopy)) {
69
66
  if (!preserveParams.includes(key)) {
@@ -77,31 +74,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
77
74
  return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
78
75
  }
79
76
 
80
- var __defProp$M = Object.defineProperty;
81
- var __defProps$v = Object.defineProperties;
82
- var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
83
- var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
84
- var __hasOwnProp$M = Object.prototype.hasOwnProperty;
85
- var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
86
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
87
- var __spreadValues$M = (a, b) => {
77
+ var __defProp$J = Object.defineProperty;
78
+ var __defProps$t = Object.defineProperties;
79
+ var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
80
+ var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
81
+ var __hasOwnProp$J = Object.prototype.hasOwnProperty;
82
+ var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
83
+ var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
84
+ var __spreadValues$J = (a, b) => {
88
85
  for (var prop in b || (b = {}))
89
- if (__hasOwnProp$M.call(b, prop))
90
- __defNormalProp$M(a, prop, b[prop]);
91
- if (__getOwnPropSymbols$M)
92
- for (var prop of __getOwnPropSymbols$M(b)) {
93
- if (__propIsEnum$M.call(b, prop))
94
- __defNormalProp$M(a, prop, b[prop]);
86
+ if (__hasOwnProp$J.call(b, prop))
87
+ __defNormalProp$J(a, prop, b[prop]);
88
+ if (__getOwnPropSymbols$J)
89
+ for (var prop of __getOwnPropSymbols$J(b)) {
90
+ if (__propIsEnum$J.call(b, prop))
91
+ __defNormalProp$J(a, prop, b[prop]);
95
92
  }
96
93
  return a;
97
94
  };
98
- var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
95
+ var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
99
96
  const runtimePanelPlugins = /* @__PURE__ */ new Map();
100
97
  function registerRuntimePanelPlugin({ pluginId, plugin }) {
101
98
  if (runtimePanelPlugins.has(pluginId)) {
102
99
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
103
100
  }
104
- plugin.meta = __spreadProps$v(__spreadValues$M({}, plugin.meta), {
101
+ plugin.meta = __spreadProps$t(__spreadValues$J({}, plugin.meta), {
105
102
  id: pluginId,
106
103
  name: pluginId,
107
104
  module: "runtime plugin",
@@ -129,39 +126,39 @@ function loadPanelPluginSync(pluginId) {
129
126
  return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
130
127
  }
131
128
 
132
- var __defProp$L = Object.defineProperty;
133
- var __defProps$u = Object.defineProperties;
134
- var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
135
- var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
136
- var __hasOwnProp$L = Object.prototype.hasOwnProperty;
137
- var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
138
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
139
- var __spreadValues$L = (a, b) => {
129
+ var __defProp$I = Object.defineProperty;
130
+ var __defProps$s = Object.defineProperties;
131
+ var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
132
+ var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
133
+ var __hasOwnProp$I = Object.prototype.hasOwnProperty;
134
+ var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
135
+ var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
136
+ var __spreadValues$I = (a, b) => {
140
137
  for (var prop in b || (b = {}))
141
- if (__hasOwnProp$L.call(b, prop))
142
- __defNormalProp$L(a, prop, b[prop]);
143
- if (__getOwnPropSymbols$L)
144
- for (var prop of __getOwnPropSymbols$L(b)) {
145
- if (__propIsEnum$L.call(b, prop))
146
- __defNormalProp$L(a, prop, b[prop]);
138
+ if (__hasOwnProp$I.call(b, prop))
139
+ __defNormalProp$I(a, prop, b[prop]);
140
+ if (__getOwnPropSymbols$I)
141
+ for (var prop of __getOwnPropSymbols$I(b)) {
142
+ if (__propIsEnum$I.call(b, prop))
143
+ __defNormalProp$I(a, prop, b[prop]);
147
144
  }
148
145
  return a;
149
146
  };
150
- var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
151
- var __objRest$5 = (source, exclude) => {
147
+ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
148
+ var __objRest$4 = (source, exclude) => {
152
149
  var target = {};
153
150
  for (var prop in source)
154
- if (__hasOwnProp$L.call(source, prop) && exclude.indexOf(prop) < 0)
151
+ if (__hasOwnProp$I.call(source, prop) && exclude.indexOf(prop) < 0)
155
152
  target[prop] = source[prop];
156
- if (source != null && __getOwnPropSymbols$L)
157
- for (var prop of __getOwnPropSymbols$L(source)) {
158
- if (exclude.indexOf(prop) < 0 && __propIsEnum$L.call(source, prop))
153
+ if (source != null && __getOwnPropSymbols$I)
154
+ for (var prop of __getOwnPropSymbols$I(source)) {
155
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$I.call(source, prop))
159
156
  target[prop] = source[prop];
160
157
  }
161
158
  return target;
162
159
  };
163
160
  function SceneComponentWrapperWithoutMemo(_a) {
164
- var _b = _a, { model } = _b, otherProps = __objRest$5(_b, ["model"]);
161
+ var _b = _a, { model } = _b, otherProps = __objRest$4(_b, ["model"]);
165
162
  var _a2;
166
163
  const Component = (_a2 = model.constructor["Component"]) != null ? _a2 : EmptyRenderer;
167
164
  const [_, setValue] = React.useState(0);
@@ -173,7 +170,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
173
170
  if (!model.isActive) {
174
171
  return null;
175
172
  }
176
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$u(__spreadValues$L({}, otherProps), {
173
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$s(__spreadValues$I({}, otherProps), {
177
174
  model
178
175
  }));
179
176
  }
@@ -219,19 +216,19 @@ class SceneObjectRef {
219
216
  }
220
217
  _ref = new WeakMap();
221
218
 
222
- var __defProp$K = Object.defineProperty;
223
- var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
224
- var __hasOwnProp$K = Object.prototype.hasOwnProperty;
225
- var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
226
- var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
227
- var __spreadValues$K = (a, b) => {
219
+ var __defProp$H = Object.defineProperty;
220
+ var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
221
+ var __hasOwnProp$H = Object.prototype.hasOwnProperty;
222
+ var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
223
+ var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
224
+ var __spreadValues$H = (a, b) => {
228
225
  for (var prop in b || (b = {}))
229
- if (__hasOwnProp$K.call(b, prop))
230
- __defNormalProp$K(a, prop, b[prop]);
231
- if (__getOwnPropSymbols$K)
232
- for (var prop of __getOwnPropSymbols$K(b)) {
233
- if (__propIsEnum$K.call(b, prop))
234
- __defNormalProp$K(a, prop, b[prop]);
226
+ if (__hasOwnProp$H.call(b, prop))
227
+ __defNormalProp$H(a, prop, b[prop]);
228
+ if (__getOwnPropSymbols$H)
229
+ for (var prop of __getOwnPropSymbols$H(b)) {
230
+ if (__propIsEnum$H.call(b, prop))
231
+ __defNormalProp$H(a, prop, b[prop]);
235
232
  }
236
233
  return a;
237
234
  };
@@ -291,7 +288,7 @@ class SceneObjectBase {
291
288
  }
292
289
  setState(update) {
293
290
  const prevState = this._state;
294
- const newState = __spreadValues$K(__spreadValues$K({}, this._state), update);
291
+ const newState = __spreadValues$H(__spreadValues$H({}, this._state), update);
295
292
  this._state = Object.freeze(newState);
296
293
  this._setParent(update);
297
294
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -487,19 +484,19 @@ function forEachChild(state, callback) {
487
484
  }
488
485
  }
489
486
 
490
- var __defProp$J = Object.defineProperty;
491
- var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
492
- var __hasOwnProp$J = Object.prototype.hasOwnProperty;
493
- var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
494
- var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
495
- var __spreadValues$J = (a, b) => {
487
+ var __defProp$G = Object.defineProperty;
488
+ var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
489
+ var __hasOwnProp$G = Object.prototype.hasOwnProperty;
490
+ var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
491
+ var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
492
+ var __spreadValues$G = (a, b) => {
496
493
  for (var prop in b || (b = {}))
497
- if (__hasOwnProp$J.call(b, prop))
498
- __defNormalProp$J(a, prop, b[prop]);
499
- if (__getOwnPropSymbols$J)
500
- for (var prop of __getOwnPropSymbols$J(b)) {
501
- if (__propIsEnum$J.call(b, prop))
502
- __defNormalProp$J(a, prop, b[prop]);
494
+ if (__hasOwnProp$G.call(b, prop))
495
+ __defNormalProp$G(a, prop, b[prop]);
496
+ if (__getOwnPropSymbols$G)
497
+ for (var prop of __getOwnPropSymbols$G(b)) {
498
+ if (__propIsEnum$G.call(b, prop))
499
+ __defNormalProp$G(a, prop, b[prop]);
503
500
  }
504
501
  return a;
505
502
  };
@@ -508,7 +505,7 @@ function cloneSceneObject(sceneObject, withState) {
508
505
  return new sceneObject.constructor(clonedState);
509
506
  }
510
507
  function cloneSceneObjectState(sceneState, withState) {
511
- const clonedState = __spreadValues$J({}, sceneState);
508
+ const clonedState = __spreadValues$G({}, sceneState);
512
509
  for (const key in clonedState) {
513
510
  const propValue = clonedState[key];
514
511
  if (propValue instanceof SceneObjectBase) {
@@ -605,25 +602,25 @@ function lookupVariable(name, sceneObject) {
605
602
  return null;
606
603
  }
607
604
 
608
- var __defProp$I = Object.defineProperty;
609
- var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
610
- var __hasOwnProp$I = Object.prototype.hasOwnProperty;
611
- var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
612
- var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
613
- var __spreadValues$I = (a, b) => {
605
+ var __defProp$F = Object.defineProperty;
606
+ var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
607
+ var __hasOwnProp$F = Object.prototype.hasOwnProperty;
608
+ var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
609
+ var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
610
+ var __spreadValues$F = (a, b) => {
614
611
  for (var prop in b || (b = {}))
615
- if (__hasOwnProp$I.call(b, prop))
616
- __defNormalProp$I(a, prop, b[prop]);
617
- if (__getOwnPropSymbols$I)
618
- for (var prop of __getOwnPropSymbols$I(b)) {
619
- if (__propIsEnum$I.call(b, prop))
620
- __defNormalProp$I(a, prop, b[prop]);
612
+ if (__hasOwnProp$F.call(b, prop))
613
+ __defNormalProp$F(a, prop, b[prop]);
614
+ if (__getOwnPropSymbols$F)
615
+ for (var prop of __getOwnPropSymbols$F(b)) {
616
+ if (__propIsEnum$F.call(b, prop))
617
+ __defNormalProp$F(a, prop, b[prop]);
621
618
  }
622
619
  return a;
623
620
  };
624
621
  class SceneDataNode extends SceneObjectBase {
625
622
  constructor(state) {
626
- super(__spreadValues$I({
623
+ super(__spreadValues$F({
627
624
  data: emptyPanelData
628
625
  }, state));
629
626
  }
@@ -704,19 +701,19 @@ function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
704
701
  };
705
702
  }
706
703
 
707
- var __defProp$H = Object.defineProperty;
708
- var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
709
- var __hasOwnProp$H = Object.prototype.hasOwnProperty;
710
- var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
711
- var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
712
- var __spreadValues$H = (a, b) => {
704
+ var __defProp$E = Object.defineProperty;
705
+ var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
706
+ var __hasOwnProp$E = Object.prototype.hasOwnProperty;
707
+ var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
708
+ var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
709
+ var __spreadValues$E = (a, b) => {
713
710
  for (var prop in b || (b = {}))
714
- if (__hasOwnProp$H.call(b, prop))
715
- __defNormalProp$H(a, prop, b[prop]);
716
- if (__getOwnPropSymbols$H)
717
- for (var prop of __getOwnPropSymbols$H(b)) {
718
- if (__propIsEnum$H.call(b, prop))
719
- __defNormalProp$H(a, prop, b[prop]);
711
+ if (__hasOwnProp$E.call(b, prop))
712
+ __defNormalProp$E(a, prop, b[prop]);
713
+ if (__getOwnPropSymbols$E)
714
+ for (var prop of __getOwnPropSymbols$E(b)) {
715
+ if (__propIsEnum$E.call(b, prop))
716
+ __defNormalProp$E(a, prop, b[prop]);
720
717
  }
721
718
  return a;
722
719
  };
@@ -734,7 +731,7 @@ class SceneTimeRange extends SceneObjectBase {
734
731
  state.UNSAFE_nowDelay
735
732
  );
736
733
  const refreshOnActivate = (_c = state.refreshOnActivate) != null ? _c : { percent: 10 };
737
- super(__spreadValues$H({ from, to, timeZone, value, refreshOnActivate }, state));
734
+ super(__spreadValues$E({ from, to, timeZone, value, refreshOnActivate }, state));
738
735
  this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone"] });
739
736
  this.onTimeRangeChange = (timeRange) => {
740
737
  const update = {};
@@ -1401,25 +1398,25 @@ function collectAllVariables(sceneObject, record = {}) {
1401
1398
  return record;
1402
1399
  }
1403
1400
 
1404
- var __defProp$G = Object.defineProperty;
1405
- var __defProps$t = Object.defineProperties;
1406
- var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
1407
- var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
1408
- var __hasOwnProp$G = Object.prototype.hasOwnProperty;
1409
- var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
1410
- var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1411
- var __spreadValues$G = (a, b) => {
1401
+ var __defProp$D = Object.defineProperty;
1402
+ var __defProps$r = Object.defineProperties;
1403
+ var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
1404
+ var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
1405
+ var __hasOwnProp$D = Object.prototype.hasOwnProperty;
1406
+ var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
1407
+ var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1408
+ var __spreadValues$D = (a, b) => {
1412
1409
  for (var prop in b || (b = {}))
1413
- if (__hasOwnProp$G.call(b, prop))
1414
- __defNormalProp$G(a, prop, b[prop]);
1415
- if (__getOwnPropSymbols$G)
1416
- for (var prop of __getOwnPropSymbols$G(b)) {
1417
- if (__propIsEnum$G.call(b, prop))
1418
- __defNormalProp$G(a, prop, b[prop]);
1410
+ if (__hasOwnProp$D.call(b, prop))
1411
+ __defNormalProp$D(a, prop, b[prop]);
1412
+ if (__getOwnPropSymbols$D)
1413
+ for (var prop of __getOwnPropSymbols$D(b)) {
1414
+ if (__propIsEnum$D.call(b, prop))
1415
+ __defNormalProp$D(a, prop, b[prop]);
1419
1416
  }
1420
1417
  return a;
1421
1418
  };
1422
- var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
1419
+ var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
1423
1420
  function getTemplateProxyForField(field, frame, frames) {
1424
1421
  return new Proxy(
1425
1422
  {},
@@ -1435,7 +1432,7 @@ function getTemplateProxyForField(field, frame, frames) {
1435
1432
  if (!field.labels) {
1436
1433
  return "";
1437
1434
  }
1438
- return __spreadProps$t(__spreadValues$G({}, field.labels), {
1435
+ return __spreadProps$r(__spreadValues$D({}, field.labels), {
1439
1436
  __values: Object.values(field.labels).sort().join(", "),
1440
1437
  toString: () => {
1441
1438
  return data.formatLabels(field.labels, "", true);
@@ -1932,25 +1929,25 @@ function isExtraQueryProvider(obj) {
1932
1929
  return typeof obj === "object" && "getExtraQueries" in obj;
1933
1930
  }
1934
1931
 
1935
- var __defProp$F = Object.defineProperty;
1936
- var __defProps$s = Object.defineProperties;
1937
- var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
1938
- var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
1939
- var __hasOwnProp$F = Object.prototype.hasOwnProperty;
1940
- var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
1941
- var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1942
- var __spreadValues$F = (a, b) => {
1932
+ var __defProp$C = Object.defineProperty;
1933
+ var __defProps$q = Object.defineProperties;
1934
+ var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
1935
+ var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
1936
+ var __hasOwnProp$C = Object.prototype.hasOwnProperty;
1937
+ var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
1938
+ var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1939
+ var __spreadValues$C = (a, b) => {
1943
1940
  for (var prop in b || (b = {}))
1944
- if (__hasOwnProp$F.call(b, prop))
1945
- __defNormalProp$F(a, prop, b[prop]);
1946
- if (__getOwnPropSymbols$F)
1947
- for (var prop of __getOwnPropSymbols$F(b)) {
1948
- if (__propIsEnum$F.call(b, prop))
1949
- __defNormalProp$F(a, prop, b[prop]);
1941
+ if (__hasOwnProp$C.call(b, prop))
1942
+ __defNormalProp$C(a, prop, b[prop]);
1943
+ if (__getOwnPropSymbols$C)
1944
+ for (var prop of __getOwnPropSymbols$C(b)) {
1945
+ if (__propIsEnum$C.call(b, prop))
1946
+ __defNormalProp$C(a, prop, b[prop]);
1950
1947
  }
1951
1948
  return a;
1952
1949
  };
1953
- var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
1950
+ var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
1954
1951
  const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
1955
1952
  const extraQueryProcessingOperator = (processors) => (data) => {
1956
1953
  return data.pipe(
@@ -1963,7 +1960,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
1963
1960
  }),
1964
1961
  rxjs.map(([primary, ...processedSecondaries]) => {
1965
1962
  var _a;
1966
- return __spreadProps$s(__spreadValues$F({}, primary), {
1963
+ return __spreadProps$q(__spreadValues$C({}, primary), {
1967
1964
  series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
1968
1965
  annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
1969
1966
  var _a2;
@@ -1974,25 +1971,25 @@ const extraQueryProcessingOperator = (processors) => (data) => {
1974
1971
  );
1975
1972
  };
1976
1973
 
1977
- var __defProp$E = Object.defineProperty;
1978
- var __defProps$r = Object.defineProperties;
1979
- var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
1980
- var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
1981
- var __hasOwnProp$E = Object.prototype.hasOwnProperty;
1982
- var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
1983
- var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1984
- var __spreadValues$E = (a, b) => {
1974
+ var __defProp$B = Object.defineProperty;
1975
+ var __defProps$p = Object.defineProperties;
1976
+ var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
1977
+ var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
1978
+ var __hasOwnProp$B = Object.prototype.hasOwnProperty;
1979
+ var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
1980
+ var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1981
+ var __spreadValues$B = (a, b) => {
1985
1982
  for (var prop in b || (b = {}))
1986
- if (__hasOwnProp$E.call(b, prop))
1987
- __defNormalProp$E(a, prop, b[prop]);
1988
- if (__getOwnPropSymbols$E)
1989
- for (var prop of __getOwnPropSymbols$E(b)) {
1990
- if (__propIsEnum$E.call(b, prop))
1991
- __defNormalProp$E(a, prop, b[prop]);
1983
+ if (__hasOwnProp$B.call(b, prop))
1984
+ __defNormalProp$B(a, prop, b[prop]);
1985
+ if (__getOwnPropSymbols$B)
1986
+ for (var prop of __getOwnPropSymbols$B(b)) {
1987
+ if (__propIsEnum$B.call(b, prop))
1988
+ __defNormalProp$B(a, prop, b[prop]);
1992
1989
  }
1993
1990
  return a;
1994
1991
  };
1995
- var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
1992
+ var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
1996
1993
  function filterAnnotations(data, filters) {
1997
1994
  var _a;
1998
1995
  if (!Array.isArray(data) || data.length === 0) {
@@ -2043,11 +2040,11 @@ function filterAnnotations(data, filters) {
2043
2040
  continue;
2044
2041
  }
2045
2042
  }
2046
- fields.push(__spreadProps$r(__spreadValues$E({}, field), {
2043
+ fields.push(__spreadProps$p(__spreadValues$B({}, field), {
2047
2044
  values: buffer
2048
2045
  }));
2049
2046
  }
2050
- processed.push(__spreadProps$r(__spreadValues$E({}, frame), {
2047
+ processed.push(__spreadProps$p(__spreadValues$B({}, frame), {
2051
2048
  fields,
2052
2049
  length: frameLength
2053
2050
  }));
@@ -2250,7 +2247,7 @@ class MultiValueVariable extends SceneObjectBase {
2250
2247
  }
2251
2248
  interceptStateUpdateAfterValidation(stateUpdate) {
2252
2249
  const isAllValueFix = stateUpdate.value === ALL_VARIABLE_VALUE && this.state.text === ALL_VARIABLE_TEXT;
2253
- if (this.skipNextValidation && stateUpdate.value !== this.state.value && !isAllValueFix) {
2250
+ if (this.skipNextValidation && stateUpdate.value !== this.state.value && stateUpdate.text !== this.state.text && !isAllValueFix) {
2254
2251
  stateUpdate.value = this.state.value;
2255
2252
  stateUpdate.text = this.state.text;
2256
2253
  }
@@ -2478,33 +2475,33 @@ function getOptionSearcher(options, includeAll) {
2478
2475
  };
2479
2476
  }
2480
2477
 
2481
- var __defProp$D = Object.defineProperty;
2482
- var __defProps$q = Object.defineProperties;
2483
- var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2484
- var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
2485
- var __hasOwnProp$D = Object.prototype.hasOwnProperty;
2486
- var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
2487
- var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2488
- var __spreadValues$D = (a, b) => {
2478
+ var __defProp$A = Object.defineProperty;
2479
+ var __defProps$o = Object.defineProperties;
2480
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2481
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2482
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2483
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2484
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2485
+ var __spreadValues$A = (a, b) => {
2489
2486
  for (var prop in b || (b = {}))
2490
- if (__hasOwnProp$D.call(b, prop))
2491
- __defNormalProp$D(a, prop, b[prop]);
2492
- if (__getOwnPropSymbols$D)
2493
- for (var prop of __getOwnPropSymbols$D(b)) {
2494
- if (__propIsEnum$D.call(b, prop))
2495
- __defNormalProp$D(a, prop, b[prop]);
2496
- }
2497
- return a;
2498
- };
2499
- var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2500
- var __objRest$4 = (source, exclude) => {
2487
+ if (__hasOwnProp$A.call(b, prop))
2488
+ __defNormalProp$A(a, prop, b[prop]);
2489
+ if (__getOwnPropSymbols$A)
2490
+ for (var prop of __getOwnPropSymbols$A(b)) {
2491
+ if (__propIsEnum$A.call(b, prop))
2492
+ __defNormalProp$A(a, prop, b[prop]);
2493
+ }
2494
+ return a;
2495
+ };
2496
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
2497
+ var __objRest$3 = (source, exclude) => {
2501
2498
  var target = {};
2502
2499
  for (var prop in source)
2503
- if (__hasOwnProp$D.call(source, prop) && exclude.indexOf(prop) < 0)
2500
+ if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
2504
2501
  target[prop] = source[prop];
2505
- if (source != null && __getOwnPropSymbols$D)
2506
- for (var prop of __getOwnPropSymbols$D(source)) {
2507
- if (exclude.indexOf(prop) < 0 && __propIsEnum$D.call(source, prop))
2502
+ if (source != null && __getOwnPropSymbols$A)
2503
+ for (var prop of __getOwnPropSymbols$A(source)) {
2504
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
2508
2505
  target[prop] = source[prop];
2509
2506
  }
2510
2507
  return target;
@@ -2632,11 +2629,11 @@ const OptionWithCheckbox = ({
2632
2629
  renderOptionLabel
2633
2630
  }) => {
2634
2631
  var _b;
2635
- const _a = innerProps, rest = __objRest$4(_a, ["onMouseMove", "onMouseOver"]);
2632
+ const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
2636
2633
  const theme = ui.useTheme2();
2637
2634
  const selectStyles = ui.getSelectStyles(theme);
2638
2635
  const optionStyles = ui.useStyles2(getOptionStyles);
2639
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$q(__spreadValues$D({
2636
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
2640
2637
  ref: innerRef,
2641
2638
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
2642
2639
  }, rest), {
@@ -2800,28 +2797,28 @@ function wrapInSafeSerializableSceneObject(sceneObject) {
2800
2797
  return { value: sceneObject, text: "__sceneObject" };
2801
2798
  }
2802
2799
 
2803
- var __defProp$C = Object.defineProperty;
2804
- var __defProps$p = Object.defineProperties;
2805
- var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
2806
- var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2807
- var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2808
- var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
2809
- var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2810
- var __spreadValues$C = (a, b) => {
2800
+ var __defProp$z = Object.defineProperty;
2801
+ var __defProps$n = Object.defineProperties;
2802
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
2803
+ var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
2804
+ var __hasOwnProp$z = Object.prototype.hasOwnProperty;
2805
+ var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
2806
+ var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2807
+ var __spreadValues$z = (a, b) => {
2811
2808
  for (var prop in b || (b = {}))
2812
- if (__hasOwnProp$C.call(b, prop))
2813
- __defNormalProp$C(a, prop, b[prop]);
2814
- if (__getOwnPropSymbols$C)
2815
- for (var prop of __getOwnPropSymbols$C(b)) {
2816
- if (__propIsEnum$C.call(b, prop))
2817
- __defNormalProp$C(a, prop, b[prop]);
2809
+ if (__hasOwnProp$z.call(b, prop))
2810
+ __defNormalProp$z(a, prop, b[prop]);
2811
+ if (__getOwnPropSymbols$z)
2812
+ for (var prop of __getOwnPropSymbols$z(b)) {
2813
+ if (__propIsEnum$z.call(b, prop))
2814
+ __defNormalProp$z(a, prop, b[prop]);
2818
2815
  }
2819
2816
  return a;
2820
2817
  };
2821
- var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
2818
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
2822
2819
  class GroupByVariable extends MultiValueVariable {
2823
2820
  constructor(initialState) {
2824
- super(__spreadProps$p(__spreadValues$C({
2821
+ super(__spreadProps$n(__spreadValues$z({
2825
2822
  isMulti: true,
2826
2823
  name: "",
2827
2824
  value: [],
@@ -2852,7 +2849,7 @@ class GroupByVariable extends MultiValueVariable {
2852
2849
  const queries = getQueriesForVariables(this);
2853
2850
  const otherFilters = this.state.baseFilters || [];
2854
2851
  const timeRange = sceneGraph.getTimeRange(this).state.value;
2855
- const response = await ds.getTagKeys(__spreadValues$C({
2852
+ const response = await ds.getTagKeys(__spreadValues$z({
2856
2853
  filters: otherFilters,
2857
2854
  queries,
2858
2855
  timeRange
@@ -3047,7 +3044,7 @@ function LoadingIndicator(props) {
3047
3044
  }
3048
3045
 
3049
3046
  function ControlsLabel(props) {
3050
- const styles = ui.useStyles2(getStyles$c);
3047
+ const styles = ui.useStyles2(getStyles$a);
3051
3048
  const theme = ui.useTheme2();
3052
3049
  const isVertical = props.layout === "vertical";
3053
3050
  const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3110,7 +3107,7 @@ function ControlsLabel(props) {
3110
3107
  }
3111
3108
  return labelElement;
3112
3109
  }
3113
- const getStyles$c = (theme) => ({
3110
+ const getStyles$a = (theme) => ({
3114
3111
  horizontalLabel: css.css({
3115
3112
  background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
3116
3113
  display: `flex`,
@@ -3190,7 +3187,7 @@ function keyLabelToOption(key, label) {
3190
3187
  const filterNoOp = () => true;
3191
3188
  function AdHocFilterRenderer({ filter, model }) {
3192
3189
  var _a, _b;
3193
- const styles = ui.useStyles2(getStyles$b);
3190
+ const styles = ui.useStyles2(getStyles$9);
3194
3191
  const [keys, setKeys] = React.useState([]);
3195
3192
  const [values, setValues] = React.useState([]);
3196
3193
  const [isKeysLoading, setIsKeysLoading] = React.useState(false);
@@ -3332,7 +3329,7 @@ function AdHocFilterRenderer({ filter, model }) {
3332
3329
  onClick: () => model._removeFilter(filter)
3333
3330
  }));
3334
3331
  }
3335
- const getStyles$b = (theme) => ({
3332
+ const getStyles$9 = (theme) => ({
3336
3333
  field: css.css({
3337
3334
  marginBottom: 0
3338
3335
  }),
@@ -3470,616 +3467,6 @@ function isFilter(filter) {
3470
3467
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3471
3468
  }
3472
3469
 
3473
- var __defProp$B = Object.defineProperty;
3474
- var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
3475
- var __hasOwnProp$B = Object.prototype.hasOwnProperty;
3476
- var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
3477
- var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3478
- var __spreadValues$B = (a, b) => {
3479
- for (var prop in b || (b = {}))
3480
- if (__hasOwnProp$B.call(b, prop))
3481
- __defNormalProp$B(a, prop, b[prop]);
3482
- if (__getOwnPropSymbols$B)
3483
- for (var prop of __getOwnPropSymbols$B(b)) {
3484
- if (__propIsEnum$B.call(b, prop))
3485
- __defNormalProp$B(a, prop, b[prop]);
3486
- }
3487
- return a;
3488
- };
3489
- var __objRest$3 = (source, exclude) => {
3490
- var target = {};
3491
- for (var prop in source)
3492
- if (__hasOwnProp$B.call(source, prop) && exclude.indexOf(prop) < 0)
3493
- target[prop] = source[prop];
3494
- if (source != null && __getOwnPropSymbols$B)
3495
- for (var prop of __getOwnPropSymbols$B(source)) {
3496
- if (exclude.indexOf(prop) < 0 && __propIsEnum$B.call(source, prop))
3497
- target[prop] = source[prop];
3498
- }
3499
- return target;
3500
- };
3501
- const DropdownItem = React.forwardRef(
3502
- function DropdownItem2(_a, ref) {
3503
- var _b = _a, { children, active } = _b, rest = __objRest$3(_b, ["children", "active"]);
3504
- const theme = ui.useTheme2();
3505
- const selectStyles = ui.getSelectStyles(theme);
3506
- const id = React.useId();
3507
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$B({
3508
- ref,
3509
- role: "option",
3510
- id,
3511
- "aria-selected": active,
3512
- className: css.cx(selectStyles.option, active && selectStyles.optionFocused)
3513
- }, rest), /* @__PURE__ */ React__default["default"].createElement("div", {
3514
- className: selectStyles.optionBody,
3515
- "data-testid": `data-testid ad hoc filter option value ${children}`
3516
- }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
3517
- }
3518
- );
3519
-
3520
- var __defProp$A = Object.defineProperty;
3521
- var __defProps$o = Object.defineProperties;
3522
- var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
3523
- var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
3524
- var __hasOwnProp$A = Object.prototype.hasOwnProperty;
3525
- var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
3526
- var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3527
- var __spreadValues$A = (a, b) => {
3528
- for (var prop in b || (b = {}))
3529
- if (__hasOwnProp$A.call(b, prop))
3530
- __defNormalProp$A(a, prop, b[prop]);
3531
- if (__getOwnPropSymbols$A)
3532
- for (var prop of __getOwnPropSymbols$A(b)) {
3533
- if (__propIsEnum$A.call(b, prop))
3534
- __defNormalProp$A(a, prop, b[prop]);
3535
- }
3536
- return a;
3537
- };
3538
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
3539
- const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, isAlwaysWip, handleChangeViewMode }, parentRef) {
3540
- var _a;
3541
- const [open, setOpen] = React.useState(false);
3542
- const [options, setOptions] = React.useState([]);
3543
- const [optionsLoading, setOptionsLoading] = React.useState(false);
3544
- const [optionsError, setOptionsError] = React.useState(false);
3545
- const [inputValue, setInputValue] = React.useState("");
3546
- const [activeIndex, setActiveIndex] = React.useState(null);
3547
- const [filterInputType, setInputType] = React.useState(!isAlwaysWip ? "value" : "key");
3548
- const styles = ui.useStyles2(getStyles2);
3549
- const listRef = React.useRef([]);
3550
- const handleResetWip = React.useCallback(() => {
3551
- if (isAlwaysWip) {
3552
- model._addWip();
3553
- setInputType("key");
3554
- setInputValue("");
3555
- }
3556
- }, [model, isAlwaysWip]);
3557
- const onOpenChange = React.useCallback(
3558
- (nextOpen, _, reason) => {
3559
- setOpen(nextOpen);
3560
- if (["outside-press", "escape-key"].includes(reason || "")) {
3561
- handleResetWip();
3562
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3563
- }
3564
- },
3565
- [handleChangeViewMode, handleResetWip]
3566
- );
3567
- const operatorIdentifier = `${(_a = filter == null ? void 0 : filter.key) != null ? _a : ""}-operator`;
3568
- const { refs, floatingStyles, context } = react.useFloating({
3569
- whileElementsMounted: react.autoUpdate,
3570
- open,
3571
- onOpenChange,
3572
- placement: "bottom-start",
3573
- middleware: [
3574
- react.offset(10),
3575
- react.flip({ padding: 10 }),
3576
- react.size({
3577
- apply({ availableHeight, elements }) {
3578
- elements.floating.style.maxHeight = `${availableHeight > 300 ? 300 : availableHeight}px`;
3579
- },
3580
- padding: 10
3581
- })
3582
- ]
3583
- });
3584
- const role = react.useRole(context, { role: "listbox" });
3585
- const dismiss = react.useDismiss(context, {
3586
- outsidePress: (event) => {
3587
- return !event.currentTarget.classList.contains(
3588
- operatorIdentifier
3589
- );
3590
- }
3591
- });
3592
- const listNav = react.useListNavigation(context, {
3593
- listRef,
3594
- activeIndex,
3595
- onNavigate: setActiveIndex,
3596
- virtual: true,
3597
- loop: true
3598
- });
3599
- const { getReferenceProps, getFloatingProps, getItemProps } = react.useInteractions([role, dismiss, listNav]);
3600
- React.useImperativeHandle(parentRef, () => () => {
3601
- var _a2;
3602
- return (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3603
- }, [refs.domReference]);
3604
- function onChange(event) {
3605
- const value = event.target.value;
3606
- setInputValue(value);
3607
- setActiveIndex(0);
3608
- }
3609
- const filteredDropDownItems = options.filter(
3610
- (item) => {
3611
- var _a2, _b;
3612
- return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
3613
- }
3614
- );
3615
- const flushSyncInputType = React.useCallback((inputType) => {
3616
- reactDom.flushSync(() => {
3617
- setInputType(inputType);
3618
- });
3619
- }, []);
3620
- React.useEffect(() => {
3621
- if (!isAlwaysWip && refs.domReference.current) {
3622
- setInputType("value");
3623
- setInputValue("");
3624
- refs.domReference.current.focus();
3625
- }
3626
- }, []);
3627
- const handleFetchOptions = React.useCallback(
3628
- async (inputType) => {
3629
- setOptionsError(false);
3630
- setOptionsLoading(true);
3631
- setOptions([]);
3632
- let options2 = [];
3633
- try {
3634
- if (inputType === "key") {
3635
- options2 = await model._getKeys(null);
3636
- } else if (inputType === "operator") {
3637
- options2 = model._getOperators();
3638
- } else if (inputType === "value") {
3639
- options2 = await model._getValuesFor(filter);
3640
- }
3641
- setOptions(options2);
3642
- } catch (e) {
3643
- setOptionsError(true);
3644
- }
3645
- setOptionsLoading(false);
3646
- },
3647
- [filter, model]
3648
- );
3649
- const handleBackspaceInput = React.useCallback(
3650
- (event) => {
3651
- if (event.key === "Backspace" && !inputValue && filterInputType === "key") {
3652
- model._removeLastFilter();
3653
- handleFetchOptions(filterInputType);
3654
- }
3655
- },
3656
- [inputValue, filterInputType]
3657
- );
3658
- const handleTabInput = React.useCallback((event) => {
3659
- if (event.key === "Tab" && !event.shiftKey) {
3660
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3661
- handleResetWip();
3662
- }
3663
- }, []);
3664
- const handleShiftTabInput = React.useCallback((event) => {
3665
- if (event.key === "Tab" && event.shiftKey) {
3666
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3667
- handleResetWip();
3668
- }
3669
- }, []);
3670
- const handleEnterInput = React.useCallback(
3671
- (event) => {
3672
- var _a2;
3673
- if (event.key === "Enter" && activeIndex != null) {
3674
- if (filterInputType !== "value" && !filteredDropDownItems[activeIndex]) {
3675
- return;
3676
- }
3677
- let dropdownItem = filteredDropDownItems[activeIndex];
3678
- if (filterInputType === "value" && !filteredDropDownItems[activeIndex]) {
3679
- if (!inputValue.trim()) {
3680
- return;
3681
- }
3682
- dropdownItem = { value: inputValue };
3683
- }
3684
- model._updateFilter(filter, filterInputType, dropdownItem);
3685
- setInputValue("");
3686
- setActiveIndex(0);
3687
- if (filterInputType === "key") {
3688
- flushSyncInputType("operator");
3689
- } else if (filterInputType === "operator") {
3690
- flushSyncInputType("value");
3691
- } else if (filterInputType === "value") {
3692
- flushSyncInputType("key");
3693
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3694
- }
3695
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3696
- }
3697
- },
3698
- [activeIndex, filter, filterInputType, filteredDropDownItems, model]
3699
- );
3700
- React.useEffect(() => {
3701
- if (open) {
3702
- handleFetchOptions(filterInputType);
3703
- }
3704
- }, [open, filterInputType]);
3705
- const rowVirtualizer = reactVirtual.useVirtualizer({
3706
- count: filteredDropDownItems.length,
3707
- getScrollElement: () => refs.floating.current,
3708
- estimateSize: () => 38,
3709
- overscan: 5
3710
- });
3711
- return /* @__PURE__ */ React__default["default"].createElement("div", {
3712
- className: styles.comboboxWrapper
3713
- }, filter ? /* @__PURE__ */ React__default["default"].createElement("div", {
3714
- className: styles.pillWrapper
3715
- }, (filter == null ? void 0 : filter.key) ? /* @__PURE__ */ React__default["default"].createElement("div", {
3716
- className: css.cx(styles.basePill, styles.keyPill)
3717
- }, filter.key) : null, (filter == null ? void 0 : filter.key) && (filter == null ? void 0 : filter.operator) && filterInputType !== "operator" ? /* @__PURE__ */ React__default["default"].createElement("div", {
3718
- className: css.cx(styles.basePill, styles.operatorPill, operatorIdentifier),
3719
- role: "button",
3720
- "aria-label": "Edit filter operator",
3721
- tabIndex: 0,
3722
- onClick: (event) => {
3723
- var _a2;
3724
- event.stopPropagation();
3725
- flushSyncInputType("operator");
3726
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3727
- },
3728
- onKeyDown: (event) => {
3729
- var _a2;
3730
- handleShiftTabInput(event);
3731
- if (event.key === "Enter") {
3732
- flushSyncInputType("operator");
3733
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3734
- }
3735
- }
3736
- }, filter.operator) : null, (filter == null ? void 0 : filter.key) && (filter == null ? void 0 : filter.operator) && (filter == null ? void 0 : filter.value) && !["operator", "value"].includes(filterInputType) ? /* @__PURE__ */ React__default["default"].createElement("div", {
3737
- className: css.cx(styles.basePill, styles.valuePill)
3738
- }, filter.value) : null) : null, /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$o(__spreadValues$A({}, getReferenceProps({
3739
- ref: refs.setReference,
3740
- onChange,
3741
- value: inputValue,
3742
- placeholder: !isAlwaysWip ? filterInputType === "operator" ? `${filter[filterInputType]} ${filter.value || ""}` : filter[filterInputType] : "Filter by label values",
3743
- "aria-autocomplete": "list",
3744
- onKeyDown(event) {
3745
- if (!open) {
3746
- setOpen(true);
3747
- return;
3748
- }
3749
- if (filterInputType === "operator") {
3750
- handleShiftTabInput(event);
3751
- }
3752
- handleBackspaceInput(event);
3753
- handleTabInput(event);
3754
- handleEnterInput(event);
3755
- }
3756
- })), {
3757
- className: styles.inputStyle,
3758
- onClick: (event) => {
3759
- event.stopPropagation();
3760
- setOpen(true);
3761
- },
3762
- onFocus: () => {
3763
- setActiveIndex(0);
3764
- setOpen(true);
3765
- }
3766
- })), /* @__PURE__ */ React__default["default"].createElement(react.FloatingPortal, null, open && /* @__PURE__ */ React__default["default"].createElement(react.FloatingFocusManager, {
3767
- context,
3768
- initialFocus: -1,
3769
- visuallyHiddenDismiss: true
3770
- }, /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({}, getFloatingProps({
3771
- ref: refs.setFloating,
3772
- style: __spreadProps$o(__spreadValues$A({}, floatingStyles), {
3773
- overflowY: "auto",
3774
- zIndex: 1
3775
- })
3776
- })), {
3777
- className: styles.dropdownWrapper
3778
- }), optionsLoading ? /* @__PURE__ */ React__default["default"].createElement(LoadingOptionsPlaceholder, null) : optionsError ? /* @__PURE__ */ React__default["default"].createElement(OptionsErrorPlaceholder, {
3779
- handleFetchOptions: () => handleFetchOptions(filterInputType)
3780
- }) : !filteredDropDownItems.length && filterInputType !== "value" ? /* @__PURE__ */ React__default["default"].createElement(NoOptionsPlaceholder, null) : /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, rowVirtualizer.getVirtualItems().map((virtualItem) => {
3781
- var _a2;
3782
- const item = filteredDropDownItems[virtualItem.index];
3783
- const index = virtualItem.index;
3784
- return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, __spreadProps$o(__spreadValues$A({}, getItemProps({
3785
- key: `${item.value}-${index}`,
3786
- ref(node) {
3787
- listRef.current[index] = node;
3788
- },
3789
- onClick(event) {
3790
- var _a3;
3791
- if (filterInputType !== "value") {
3792
- event.stopPropagation();
3793
- }
3794
- model._updateFilter(filter, filterInputType, item);
3795
- setInputValue("");
3796
- if (filterInputType === "key") {
3797
- flushSyncInputType("operator");
3798
- } else if (filterInputType === "operator") {
3799
- flushSyncInputType("value");
3800
- } else if (filterInputType === "value") {
3801
- flushSyncInputType("key");
3802
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3803
- }
3804
- (_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
3805
- }
3806
- })), {
3807
- active: activeIndex === index
3808
- }), (_a2 = item.label) != null ? _a2 : item.value);
3809
- }), filterInputType === "value" && inputValue ? /* @__PURE__ */ React__default["default"].createElement(DropdownItem, __spreadProps$o(__spreadValues$A({}, getItemProps({
3810
- key: "__custom_value_list_item",
3811
- ref(node) {
3812
- listRef.current[filteredDropDownItems.length ? filteredDropDownItems.length + 1 : 0] = node;
3813
- },
3814
- onClick() {
3815
- var _a2;
3816
- model._updateFilter(filter, filterInputType, { value: inputValue });
3817
- setInputValue("");
3818
- flushSyncInputType("key");
3819
- handleChangeViewMode == null ? void 0 : handleChangeViewMode();
3820
- (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
3821
- }
3822
- })), {
3823
- active: activeIndex === (filteredDropDownItems.length ? filteredDropDownItems.length + 1 : 0)
3824
- }), "Use custom value: ", inputValue) : null)))));
3825
- });
3826
- const LoadingOptionsPlaceholder = () => {
3827
- return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, {
3828
- active: false
3829
- }, "Loading options...");
3830
- };
3831
- const NoOptionsPlaceholder = () => {
3832
- return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, {
3833
- active: false
3834
- }, "No options found");
3835
- };
3836
- const OptionsErrorPlaceholder = ({ handleFetchOptions }) => {
3837
- return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, {
3838
- active: false,
3839
- onClick: handleFetchOptions
3840
- }, "Error. Click to try again!");
3841
- };
3842
- const getStyles2 = (theme) => ({
3843
- comboboxWrapper: css.css({
3844
- display: "flex",
3845
- flexWrap: "nowrap"
3846
- }),
3847
- pillWrapper: css.css({
3848
- display: "flex",
3849
- alignItems: "center",
3850
- whiteSpace: "nowrap"
3851
- }),
3852
- basePill: css.css(__spreadProps$o(__spreadValues$A({
3853
- display: "flex",
3854
- alignItems: "center",
3855
- background: theme.colors.action.disabledBackground,
3856
- border: `1px solid ${theme.colors.border.weak}`,
3857
- padding: theme.spacing(0.125, 1, 0.125, 1),
3858
- color: theme.colors.text.primary,
3859
- overflow: "hidden",
3860
- whiteSpace: "nowrap",
3861
- minHeight: "22px"
3862
- }, theme.typography.bodySmall), {
3863
- cursor: "pointer"
3864
- })),
3865
- keyPill: css.css({
3866
- fontWeight: theme.typography.fontWeightBold,
3867
- cursor: "default"
3868
- }),
3869
- operatorPill: css.css({
3870
- "&:hover": {
3871
- background: theme.colors.action.hover
3872
- }
3873
- }),
3874
- valuePill: css.css({
3875
- background: theme.colors.action.selected
3876
- }),
3877
- dropdownWrapper: css.css({
3878
- backgroundColor: theme.colors.background.primary,
3879
- color: theme.colors.text.primary,
3880
- boxShadow: theme.shadows.z2
3881
- }),
3882
- inputStyle: css.css({
3883
- paddingBlock: 0,
3884
- "&:focus": {
3885
- outline: "none"
3886
- }
3887
- })
3888
- });
3889
-
3890
- var __defProp$z = Object.defineProperty;
3891
- var __defProps$n = Object.defineProperties;
3892
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
3893
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
3894
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
3895
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
3896
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3897
- var __spreadValues$z = (a, b) => {
3898
- for (var prop in b || (b = {}))
3899
- if (__hasOwnProp$z.call(b, prop))
3900
- __defNormalProp$z(a, prop, b[prop]);
3901
- if (__getOwnPropSymbols$z)
3902
- for (var prop of __getOwnPropSymbols$z(b)) {
3903
- if (__propIsEnum$z.call(b, prop))
3904
- __defNormalProp$z(a, prop, b[prop]);
3905
- }
3906
- return a;
3907
- };
3908
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
3909
- function AdHocFiltersComboboxEditSwitch({
3910
- filter,
3911
- model,
3912
- readOnly
3913
- }) {
3914
- const styles = ui.useStyles2(getStyles$a);
3915
- const [viewMode, setViewMode] = React.useState(true);
3916
- const pillWrapperRef = React.useRef(null);
3917
- const handleChangeViewMode = React.useCallback(
3918
- (event) => {
3919
- var _a;
3920
- event == null ? void 0 : event.stopPropagation();
3921
- if (readOnly) {
3922
- return;
3923
- }
3924
- let viewMode2 = false;
3925
- reactDom.flushSync(() => {
3926
- setViewMode((mode) => {
3927
- viewMode2 = mode;
3928
- return !mode;
3929
- });
3930
- });
3931
- if (!viewMode2) {
3932
- (_a = pillWrapperRef.current) == null ? void 0 : _a.focus();
3933
- }
3934
- },
3935
- [readOnly]
3936
- );
3937
- if (viewMode) {
3938
- return /* @__PURE__ */ React__default["default"].createElement("div", {
3939
- className: `${styles.combinedFilterPill} ${readOnly ? styles.readOnlyCombinedFilter : ""}`,
3940
- onClick: handleChangeViewMode,
3941
- onKeyDown: (e) => {
3942
- if (e.key === "Enter") {
3943
- handleChangeViewMode();
3944
- }
3945
- },
3946
- role: "button",
3947
- "aria-label": `Edit filter with key ${filter.key}`,
3948
- tabIndex: 0,
3949
- ref: pillWrapperRef
3950
- }, /* @__PURE__ */ React__default["default"].createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), !readOnly ? /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
3951
- onClick: (e) => {
3952
- e.stopPropagation();
3953
- model._removeFilter(filter);
3954
- },
3955
- onKeyDownCapture: (e) => {
3956
- if (e.key === "Enter") {
3957
- e.preventDefault();
3958
- e.stopPropagation();
3959
- model._removeFilter(filter);
3960
- }
3961
- },
3962
- name: "times",
3963
- size: "md",
3964
- className: styles.removeButton,
3965
- tooltip: `Remove filter with key ${filter.key}`
3966
- }) : null);
3967
- }
3968
- return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
3969
- filter,
3970
- model,
3971
- handleChangeViewMode
3972
- });
3973
- }
3974
- const getStyles$a = (theme) => ({
3975
- combinedFilterPill: css.css(__spreadProps$n(__spreadValues$z({
3976
- display: "flex",
3977
- alignItems: "center",
3978
- background: theme.colors.action.selected,
3979
- borderRadius: theme.shape.radius.default,
3980
- border: `1px solid ${theme.colors.border.weak}`,
3981
- padding: theme.spacing(0.125, 0, 0.125, 1),
3982
- color: theme.colors.text.primary,
3983
- overflow: "hidden",
3984
- whiteSpace: "nowrap",
3985
- minHeight: "22px"
3986
- }, theme.typography.bodySmall), {
3987
- fontWeight: theme.typography.fontWeightBold,
3988
- cursor: "pointer",
3989
- "&:hover": {
3990
- background: theme.colors.action.hover
3991
- }
3992
- })),
3993
- readOnlyCombinedFilter: css.css({
3994
- paddingRight: theme.spacing(1),
3995
- cursor: "text",
3996
- "&:hover": {
3997
- background: theme.colors.action.selected
3998
- }
3999
- }),
4000
- removeButton: css.css({
4001
- marginInline: theme.spacing(0.5),
4002
- cursor: "pointer",
4003
- "&:hover": {
4004
- color: theme.colors.text.primary
4005
- }
4006
- })
4007
- });
4008
-
4009
- const AdHocFiltersAlwaysWipCombobox = React.forwardRef(function AdHocFiltersAlwaysWipCombobox2({
4010
- model
4011
- }, parentRef) {
4012
- const { _wip } = model.useState();
4013
- React.useLayoutEffect(() => {
4014
- if (!_wip) {
4015
- model._addWip();
4016
- }
4017
- }, [_wip]);
4018
- return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
4019
- model,
4020
- filter: _wip,
4021
- isAlwaysWip: true,
4022
- ref: parentRef
4023
- });
4024
- });
4025
-
4026
- const AdHocFiltersComboboxRenderer = React.memo(function AdHocFiltersComboboxRenderer2({
4027
- model
4028
- }) {
4029
- const { filters, readOnly } = model.useState();
4030
- const styles = ui.useStyles2(getStyles$9);
4031
- const focusOnInputRef = React.useRef();
4032
- return /* @__PURE__ */ React__default["default"].createElement("div", {
4033
- className: `${styles.comboboxWrapper} ${!readOnly ? styles.comboboxFocusOutline : ""}`,
4034
- onClick: () => {
4035
- var _a;
4036
- (_a = focusOnInputRef.current) == null ? void 0 : _a.call(focusOnInputRef);
4037
- }
4038
- }, /* @__PURE__ */ React__default["default"].createElement(ui.Icon, {
4039
- name: "filter",
4040
- className: styles.filterIcon,
4041
- size: "lg"
4042
- }), filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxEditSwitch, {
4043
- key: index,
4044
- filter,
4045
- model,
4046
- readOnly
4047
- })), !readOnly ? /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersAlwaysWipCombobox, {
4048
- model,
4049
- ref: focusOnInputRef
4050
- }) : null);
4051
- });
4052
- const getStyles$9 = (theme) => ({
4053
- comboboxWrapper: css.css({
4054
- display: "flex",
4055
- flexWrap: "wrap",
4056
- alignItems: "center",
4057
- columnGap: theme.spacing(1),
4058
- rowGap: theme.spacing(0.5),
4059
- minHeight: theme.spacing(4),
4060
- backgroundColor: theme.components.input.background,
4061
- border: `1px solid ${theme.colors.border.strong}`,
4062
- borderRadius: theme.shape.radius.default,
4063
- paddingInline: theme.spacing(1),
4064
- paddingBlock: theme.spacing(0.5),
4065
- flexGrow: 1
4066
- }),
4067
- comboboxFocusOutline: css.css({
4068
- "&:focus-within": {
4069
- outline: "2px dotted transparent",
4070
- outlineOffset: "2px",
4071
- boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
4072
- transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
4073
- transitionDuration: "0.2s",
4074
- transitionProperty: "outline, outline-offset, box-shadow"
4075
- }
4076
- }),
4077
- filterIcon: css.css({
4078
- color: theme.colors.text.secondary,
4079
- alignSelf: "center"
4080
- })
4081
- });
4082
-
4083
3470
  var __defProp$y = Object.defineProperty;
4084
3471
  var __defProps$m = Object.defineProperties;
4085
3472
  var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
@@ -4165,12 +3552,6 @@ class AdHocFiltersVariable extends SceneObjectBase {
4165
3552
  }
4166
3553
  this.setState({ filters: this.state.filters.filter((f) => f !== filter) });
4167
3554
  }
4168
- _removeLastFilter() {
4169
- const filterToRemove = this.state.filters.at(-1);
4170
- if (filterToRemove) {
4171
- this._removeFilter(filterToRemove);
4172
- }
4173
- }
4174
3555
  async _getKeys(currentKey) {
4175
3556
  var _a, _b, _c;
4176
3557
  const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
@@ -4252,11 +3633,6 @@ function renderExpression(builder, filters) {
4252
3633
  function AdHocFiltersVariableRenderer({ model }) {
4253
3634
  const { filters, readOnly, addFilterButtonText } = model.useState();
4254
3635
  const styles = ui.useStyles2(getStyles$8);
4255
- if (model.state.layout === "combobox") {
4256
- return /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxRenderer, {
4257
- model
4258
- });
4259
- }
4260
3636
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4261
3637
  className: styles.wrapper
4262
3638
  }, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
@@ -4277,6 +3653,10 @@ const getStyles$8 = (theme) => ({
4277
3653
  alignItems: "flex-end",
4278
3654
  columnGap: theme.spacing(2),
4279
3655
  rowGap: theme.spacing(1)
3656
+ }),
3657
+ filterIcon: css.css({
3658
+ color: theme.colors.text.secondary,
3659
+ paddingRight: theme.spacing(0.5)
4280
3660
  })
4281
3661
  });
4282
3662
  function toSelectableValue(input) {