@grafana/scenes 4.13.0--canary.705.8847545922.0 → 4.14.0--canary.709.8878831440.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -39,19 +39,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
39
39
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
40
40
  var AutoSizer__default = /*#__PURE__*/_interopDefaultLegacy(AutoSizer);
41
41
 
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) => {
42
+ var __defProp$L = Object.defineProperty;
43
+ var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
44
+ var __hasOwnProp$L = Object.prototype.hasOwnProperty;
45
+ var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
46
+ var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47
+ var __spreadValues$L = (a, b) => {
48
48
  for (var prop in b || (b = {}))
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]);
49
+ if (__hasOwnProp$L.call(b, prop))
50
+ __defNormalProp$L(a, prop, b[prop]);
51
+ if (__getOwnPropSymbols$L)
52
+ for (var prop of __getOwnPropSymbols$L(b)) {
53
+ if (__propIsEnum$L.call(b, prop))
54
+ __defNormalProp$L(a, prop, b[prop]);
55
55
  }
56
56
  return a;
57
57
  };
@@ -60,7 +60,7 @@ function useAppQueryParams() {
60
60
  return runtime.locationSearchToObject(location.search || "");
61
61
  }
62
62
  function getUrlWithAppState(path, preserveParams) {
63
- const paramsCopy = __spreadValues$K({}, runtime.locationService.getSearchObject());
63
+ const paramsCopy = __spreadValues$L({}, runtime.locationService.getSearchObject());
64
64
  if (preserveParams) {
65
65
  for (const key of Object.keys(paramsCopy)) {
66
66
  if (!preserveParams.includes(key)) {
@@ -74,31 +74,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
74
74
  return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
75
75
  }
76
76
 
77
- var __defProp$J = Object.defineProperty;
78
- var __defProps$s = Object.defineProperties;
79
- var __getOwnPropDescs$s = 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) => {
77
+ var __defProp$K = Object.defineProperty;
78
+ var __defProps$t = Object.defineProperties;
79
+ var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
80
+ var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
81
+ var __hasOwnProp$K = Object.prototype.hasOwnProperty;
82
+ var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
83
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
84
+ var __spreadValues$K = (a, b) => {
85
85
  for (var prop in b || (b = {}))
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]);
86
+ if (__hasOwnProp$K.call(b, prop))
87
+ __defNormalProp$K(a, prop, b[prop]);
88
+ if (__getOwnPropSymbols$K)
89
+ for (var prop of __getOwnPropSymbols$K(b)) {
90
+ if (__propIsEnum$K.call(b, prop))
91
+ __defNormalProp$K(a, prop, b[prop]);
92
92
  }
93
93
  return a;
94
94
  };
95
- var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
95
+ var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
96
96
  const runtimePanelPlugins = /* @__PURE__ */ new Map();
97
97
  function registerRuntimePanelPlugin({ pluginId, plugin }) {
98
98
  if (runtimePanelPlugins.has(pluginId)) {
99
99
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
100
100
  }
101
- plugin.meta = __spreadProps$s(__spreadValues$J({}, plugin.meta), {
101
+ plugin.meta = __spreadProps$t(__spreadValues$K({}, plugin.meta), {
102
102
  id: pluginId,
103
103
  name: pluginId,
104
104
  module: "runtime plugin",
@@ -126,39 +126,39 @@ function loadPanelPluginSync(pluginId) {
126
126
  return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
127
127
  }
128
128
 
129
- var __defProp$I = Object.defineProperty;
130
- var __defProps$r = Object.defineProperties;
131
- var __getOwnPropDescs$r = 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) => {
129
+ var __defProp$J = Object.defineProperty;
130
+ var __defProps$s = Object.defineProperties;
131
+ var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
132
+ var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
133
+ var __hasOwnProp$J = Object.prototype.hasOwnProperty;
134
+ var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
135
+ var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
136
+ var __spreadValues$J = (a, b) => {
137
137
  for (var prop in b || (b = {}))
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]);
138
+ if (__hasOwnProp$J.call(b, prop))
139
+ __defNormalProp$J(a, prop, b[prop]);
140
+ if (__getOwnPropSymbols$J)
141
+ for (var prop of __getOwnPropSymbols$J(b)) {
142
+ if (__propIsEnum$J.call(b, prop))
143
+ __defNormalProp$J(a, prop, b[prop]);
144
144
  }
145
145
  return a;
146
146
  };
147
- var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
148
- var __objRest$3 = (source, exclude) => {
147
+ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
148
+ var __objRest$4 = (source, exclude) => {
149
149
  var target = {};
150
150
  for (var prop in source)
151
- if (__hasOwnProp$I.call(source, prop) && exclude.indexOf(prop) < 0)
151
+ if (__hasOwnProp$J.call(source, prop) && exclude.indexOf(prop) < 0)
152
152
  target[prop] = 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))
153
+ if (source != null && __getOwnPropSymbols$J)
154
+ for (var prop of __getOwnPropSymbols$J(source)) {
155
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$J.call(source, prop))
156
156
  target[prop] = source[prop];
157
157
  }
158
158
  return target;
159
159
  };
160
160
  function SceneComponentWrapperWithoutMemo(_a) {
161
- var _b = _a, { model } = _b, otherProps = __objRest$3(_b, ["model"]);
161
+ var _b = _a, { model } = _b, otherProps = __objRest$4(_b, ["model"]);
162
162
  var _a2;
163
163
  const Component = (_a2 = model.constructor["Component"]) != null ? _a2 : EmptyRenderer;
164
164
  const [_, setValue] = React.useState(0);
@@ -170,7 +170,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
170
170
  if (!model.isActive) {
171
171
  return null;
172
172
  }
173
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$r(__spreadValues$I({}, otherProps), {
173
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$s(__spreadValues$J({}, otherProps), {
174
174
  model
175
175
  }));
176
176
  }
@@ -216,19 +216,19 @@ class SceneObjectRef {
216
216
  }
217
217
  _ref = new WeakMap();
218
218
 
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) => {
219
+ var __defProp$I = Object.defineProperty;
220
+ var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
221
+ var __hasOwnProp$I = Object.prototype.hasOwnProperty;
222
+ var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
223
+ var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
224
+ var __spreadValues$I = (a, b) => {
225
225
  for (var prop in b || (b = {}))
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]);
226
+ if (__hasOwnProp$I.call(b, prop))
227
+ __defNormalProp$I(a, prop, b[prop]);
228
+ if (__getOwnPropSymbols$I)
229
+ for (var prop of __getOwnPropSymbols$I(b)) {
230
+ if (__propIsEnum$I.call(b, prop))
231
+ __defNormalProp$I(a, prop, b[prop]);
232
232
  }
233
233
  return a;
234
234
  };
@@ -288,7 +288,7 @@ class SceneObjectBase {
288
288
  }
289
289
  setState(update) {
290
290
  const prevState = this._state;
291
- const newState = __spreadValues$H(__spreadValues$H({}, this._state), update);
291
+ const newState = __spreadValues$I(__spreadValues$I({}, this._state), update);
292
292
  this._state = Object.freeze(newState);
293
293
  this._setParent(update);
294
294
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -458,19 +458,19 @@ function forEachChild(state, callback) {
458
458
  }
459
459
  }
460
460
 
461
- var __defProp$G = Object.defineProperty;
462
- var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
463
- var __hasOwnProp$G = Object.prototype.hasOwnProperty;
464
- var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
465
- var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
466
- var __spreadValues$G = (a, b) => {
461
+ var __defProp$H = Object.defineProperty;
462
+ var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
463
+ var __hasOwnProp$H = Object.prototype.hasOwnProperty;
464
+ var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
465
+ var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
466
+ var __spreadValues$H = (a, b) => {
467
467
  for (var prop in b || (b = {}))
468
- if (__hasOwnProp$G.call(b, prop))
469
- __defNormalProp$G(a, prop, b[prop]);
470
- if (__getOwnPropSymbols$G)
471
- for (var prop of __getOwnPropSymbols$G(b)) {
472
- if (__propIsEnum$G.call(b, prop))
473
- __defNormalProp$G(a, prop, b[prop]);
468
+ if (__hasOwnProp$H.call(b, prop))
469
+ __defNormalProp$H(a, prop, b[prop]);
470
+ if (__getOwnPropSymbols$H)
471
+ for (var prop of __getOwnPropSymbols$H(b)) {
472
+ if (__propIsEnum$H.call(b, prop))
473
+ __defNormalProp$H(a, prop, b[prop]);
474
474
  }
475
475
  return a;
476
476
  };
@@ -479,7 +479,7 @@ function cloneSceneObject(sceneObject, withState) {
479
479
  return new sceneObject.constructor(clonedState);
480
480
  }
481
481
  function cloneSceneObjectState(sceneState, withState) {
482
- const clonedState = __spreadValues$G({}, sceneState);
482
+ const clonedState = __spreadValues$H({}, sceneState);
483
483
  for (const key in clonedState) {
484
484
  const propValue = clonedState[key];
485
485
  if (propValue instanceof SceneObjectBase) {
@@ -657,25 +657,25 @@ function isUrlValueEqual(currentUrlValue, newUrlValue) {
657
657
  return lodash.isEqual(currentUrlValue, newUrlValue);
658
658
  }
659
659
 
660
- var __defProp$F = Object.defineProperty;
661
- var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
662
- var __hasOwnProp$F = Object.prototype.hasOwnProperty;
663
- var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
664
- var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
665
- var __spreadValues$F = (a, b) => {
660
+ var __defProp$G = Object.defineProperty;
661
+ var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
662
+ var __hasOwnProp$G = Object.prototype.hasOwnProperty;
663
+ var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
664
+ var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
665
+ var __spreadValues$G = (a, b) => {
666
666
  for (var prop in b || (b = {}))
667
- if (__hasOwnProp$F.call(b, prop))
668
- __defNormalProp$F(a, prop, b[prop]);
669
- if (__getOwnPropSymbols$F)
670
- for (var prop of __getOwnPropSymbols$F(b)) {
671
- if (__propIsEnum$F.call(b, prop))
672
- __defNormalProp$F(a, prop, b[prop]);
667
+ if (__hasOwnProp$G.call(b, prop))
668
+ __defNormalProp$G(a, prop, b[prop]);
669
+ if (__getOwnPropSymbols$G)
670
+ for (var prop of __getOwnPropSymbols$G(b)) {
671
+ if (__propIsEnum$G.call(b, prop))
672
+ __defNormalProp$G(a, prop, b[prop]);
673
673
  }
674
674
  return a;
675
675
  };
676
676
  class SceneDataNode extends SceneObjectBase {
677
677
  constructor(state) {
678
- super(__spreadValues$F({
678
+ super(__spreadValues$G({
679
679
  data: emptyPanelData
680
680
  }, state));
681
681
  }
@@ -756,19 +756,19 @@ function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
756
756
  };
757
757
  }
758
758
 
759
- var __defProp$E = Object.defineProperty;
760
- var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
761
- var __hasOwnProp$E = Object.prototype.hasOwnProperty;
762
- var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
763
- var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
764
- var __spreadValues$E = (a, b) => {
759
+ var __defProp$F = Object.defineProperty;
760
+ var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
761
+ var __hasOwnProp$F = Object.prototype.hasOwnProperty;
762
+ var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
763
+ var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
764
+ var __spreadValues$F = (a, b) => {
765
765
  for (var prop in b || (b = {}))
766
- if (__hasOwnProp$E.call(b, prop))
767
- __defNormalProp$E(a, prop, b[prop]);
768
- if (__getOwnPropSymbols$E)
769
- for (var prop of __getOwnPropSymbols$E(b)) {
770
- if (__propIsEnum$E.call(b, prop))
771
- __defNormalProp$E(a, prop, b[prop]);
766
+ if (__hasOwnProp$F.call(b, prop))
767
+ __defNormalProp$F(a, prop, b[prop]);
768
+ if (__getOwnPropSymbols$F)
769
+ for (var prop of __getOwnPropSymbols$F(b)) {
770
+ if (__propIsEnum$F.call(b, prop))
771
+ __defNormalProp$F(a, prop, b[prop]);
772
772
  }
773
773
  return a;
774
774
  };
@@ -785,7 +785,7 @@ class SceneTimeRange extends SceneObjectBase {
785
785
  state.fiscalYearStartMonth,
786
786
  state.UNSAFE_nowDelay
787
787
  );
788
- super(__spreadValues$E({ from, to, timeZone, value }, state));
788
+ super(__spreadValues$F({ from, to, timeZone, value }, state));
789
789
  this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone"] });
790
790
  this.onTimeRangeChange = (timeRange) => {
791
791
  const update = {};
@@ -1304,7 +1304,7 @@ function lookupVariable(name, sceneObject) {
1304
1304
  return null;
1305
1305
  }
1306
1306
 
1307
- function sceneInterpolator(sceneObject, target, scopedVars, format) {
1307
+ function sceneInterpolator(sceneObject, target, scopedVars, format, interpolations) {
1308
1308
  if (!target) {
1309
1309
  return target != null ? target : "";
1310
1310
  }
@@ -1314,9 +1314,16 @@ function sceneInterpolator(sceneObject, target, scopedVars, format) {
1314
1314
  const fmt = fmt2 || fmt3 || format;
1315
1315
  const variable = lookupFormatVariable(variableName, match, scopedVars, sceneObject);
1316
1316
  if (!variable) {
1317
+ if (interpolations) {
1318
+ interpolations.push({ match, variableName, fieldPath, format: fmt, value: match, found: false });
1319
+ }
1317
1320
  return match;
1318
1321
  }
1319
- return formatValue(variable, variable.getValue(fieldPath), fmt);
1322
+ const value = formatValue(variable, variable.getValue(fieldPath), fmt);
1323
+ if (interpolations) {
1324
+ interpolations.push({ match, variableName, fieldPath, format: fmt, value, found: value !== match });
1325
+ }
1326
+ return value;
1320
1327
  });
1321
1328
  }
1322
1329
  function lookupFormatVariable(name, match, scopedVars, sceneObject) {
@@ -1455,11 +1462,11 @@ function getLayout(scene) {
1455
1462
  }
1456
1463
  return null;
1457
1464
  }
1458
- function interpolate(sceneObject, value, scopedVars, format) {
1465
+ function interpolate(sceneObject, value, scopedVars, format, interpolations) {
1459
1466
  if (value === "" || value == null) {
1460
1467
  return "";
1461
1468
  }
1462
- return sceneInterpolator(sceneObject, value, scopedVars, format);
1469
+ return sceneInterpolator(sceneObject, value, scopedVars, format, interpolations);
1463
1470
  }
1464
1471
  function hasVariableDependencyInLoadingState(sceneObject) {
1465
1472
  if (!sceneObject.variableDependency) {
@@ -1688,25 +1695,25 @@ function collectAllVariables(sceneObject, record = {}) {
1688
1695
  return record;
1689
1696
  }
1690
1697
 
1691
- var __defProp$D = Object.defineProperty;
1692
- var __defProps$q = Object.defineProperties;
1693
- var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
1694
- var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
1695
- var __hasOwnProp$D = Object.prototype.hasOwnProperty;
1696
- var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
1697
- var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1698
- var __spreadValues$D = (a, b) => {
1698
+ var __defProp$E = Object.defineProperty;
1699
+ var __defProps$r = Object.defineProperties;
1700
+ var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
1701
+ var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
1702
+ var __hasOwnProp$E = Object.prototype.hasOwnProperty;
1703
+ var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
1704
+ var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1705
+ var __spreadValues$E = (a, b) => {
1699
1706
  for (var prop in b || (b = {}))
1700
- if (__hasOwnProp$D.call(b, prop))
1701
- __defNormalProp$D(a, prop, b[prop]);
1702
- if (__getOwnPropSymbols$D)
1703
- for (var prop of __getOwnPropSymbols$D(b)) {
1704
- if (__propIsEnum$D.call(b, prop))
1705
- __defNormalProp$D(a, prop, b[prop]);
1707
+ if (__hasOwnProp$E.call(b, prop))
1708
+ __defNormalProp$E(a, prop, b[prop]);
1709
+ if (__getOwnPropSymbols$E)
1710
+ for (var prop of __getOwnPropSymbols$E(b)) {
1711
+ if (__propIsEnum$E.call(b, prop))
1712
+ __defNormalProp$E(a, prop, b[prop]);
1706
1713
  }
1707
1714
  return a;
1708
1715
  };
1709
- var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
1716
+ var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
1710
1717
  function getTemplateProxyForField(field, frame, frames) {
1711
1718
  return new Proxy(
1712
1719
  {},
@@ -1722,7 +1729,7 @@ function getTemplateProxyForField(field, frame, frames) {
1722
1729
  if (!field.labels) {
1723
1730
  return "";
1724
1731
  }
1725
- return __spreadProps$q(__spreadValues$D({}, field.labels), {
1732
+ return __spreadProps$r(__spreadValues$E({}, field.labels), {
1726
1733
  __values: Object.values(field.labels).sort().join(", "),
1727
1734
  toString: () => {
1728
1735
  return data.formatLabels(field.labels, "", true);
@@ -2184,19 +2191,19 @@ class VariableValueRecorder {
2184
2191
  }
2185
2192
  }
2186
2193
 
2187
- var __defProp$C = Object.defineProperty;
2188
- var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2189
- var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2190
- var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
2191
- var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2192
- var __spreadValues$C = (a, b) => {
2194
+ var __defProp$D = Object.defineProperty;
2195
+ var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
2196
+ var __hasOwnProp$D = Object.prototype.hasOwnProperty;
2197
+ var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
2198
+ var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2199
+ var __spreadValues$D = (a, b) => {
2193
2200
  for (var prop in b || (b = {}))
2194
- if (__hasOwnProp$C.call(b, prop))
2195
- __defNormalProp$C(a, prop, b[prop]);
2196
- if (__getOwnPropSymbols$C)
2197
- for (var prop of __getOwnPropSymbols$C(b)) {
2198
- if (__propIsEnum$C.call(b, prop))
2199
- __defNormalProp$C(a, prop, b[prop]);
2201
+ if (__hasOwnProp$D.call(b, prop))
2202
+ __defNormalProp$D(a, prop, b[prop]);
2203
+ if (__getOwnPropSymbols$D)
2204
+ for (var prop of __getOwnPropSymbols$D(b)) {
2205
+ if (__propIsEnum$D.call(b, prop))
2206
+ __defNormalProp$D(a, prop, b[prop]);
2200
2207
  }
2201
2208
  return a;
2202
2209
  };
@@ -2217,7 +2224,7 @@ const DEFAULT_COMPARE_OPTIONS = [
2217
2224
  ];
2218
2225
  class SceneTimeRangeCompare extends SceneObjectBase {
2219
2226
  constructor(state) {
2220
- super(__spreadValues$C({ compareOptions: DEFAULT_COMPARE_OPTIONS }, state));
2227
+ super(__spreadValues$D({ compareOptions: DEFAULT_COMPARE_OPTIONS }, state));
2221
2228
  this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["compareWith"] });
2222
2229
  this._onActivate = () => {
2223
2230
  const sceneTimeRange = sceneGraph.getTimeRange(this);
@@ -2361,32 +2368,32 @@ function getStyles$9(theme) {
2361
2368
 
2362
2369
  const getCompareSeriesRefId = (refId) => `${refId}-compare`;
2363
2370
 
2364
- var __defProp$B = Object.defineProperty;
2365
- var __defProps$p = Object.defineProperties;
2366
- var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
2367
- var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
2368
- var __hasOwnProp$B = Object.prototype.hasOwnProperty;
2369
- var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
2370
- var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2371
- var __spreadValues$B = (a, b) => {
2371
+ var __defProp$C = Object.defineProperty;
2372
+ var __defProps$q = Object.defineProperties;
2373
+ var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2374
+ var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2375
+ var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2376
+ var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
2377
+ var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2378
+ var __spreadValues$C = (a, b) => {
2372
2379
  for (var prop in b || (b = {}))
2373
- if (__hasOwnProp$B.call(b, prop))
2374
- __defNormalProp$B(a, prop, b[prop]);
2375
- if (__getOwnPropSymbols$B)
2376
- for (var prop of __getOwnPropSymbols$B(b)) {
2377
- if (__propIsEnum$B.call(b, prop))
2378
- __defNormalProp$B(a, prop, b[prop]);
2380
+ if (__hasOwnProp$C.call(b, prop))
2381
+ __defNormalProp$C(a, prop, b[prop]);
2382
+ if (__getOwnPropSymbols$C)
2383
+ for (var prop of __getOwnPropSymbols$C(b)) {
2384
+ if (__propIsEnum$C.call(b, prop))
2385
+ __defNormalProp$C(a, prop, b[prop]);
2379
2386
  }
2380
2387
  return a;
2381
2388
  };
2382
- var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
2389
+ var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2383
2390
  function timeShiftQueryResponseOperator(data$1) {
2384
2391
  return data$1.pipe(
2385
2392
  rxjs.map(([p, s]) => {
2386
2393
  const diff = s.timeRange.from.diff(p.timeRange.from);
2387
2394
  s.series.forEach((series) => {
2388
2395
  series.refId = getCompareSeriesRefId(series.refId || "");
2389
- series.meta = __spreadProps$p(__spreadValues$B({}, series.meta), {
2396
+ series.meta = __spreadProps$q(__spreadValues$C({}, series.meta), {
2390
2397
  timeCompare: {
2391
2398
  diffMs: diff,
2392
2399
  isTimeShiftQuery: true
@@ -2398,7 +2405,7 @@ function timeShiftQueryResponseOperator(data$1) {
2398
2405
  return diff < 0 ? v - diff : v + diff;
2399
2406
  });
2400
2407
  }
2401
- field.config = __spreadProps$p(__spreadValues$B({}, field.config), {
2408
+ field.config = __spreadProps$q(__spreadValues$C({}, field.config), {
2402
2409
  color: {
2403
2410
  mode: "fixed",
2404
2411
  fixedColor: runtime.config.theme.palette.gray60
@@ -2407,32 +2414,32 @@ function timeShiftQueryResponseOperator(data$1) {
2407
2414
  return field;
2408
2415
  });
2409
2416
  });
2410
- return __spreadProps$p(__spreadValues$B({}, p), {
2417
+ return __spreadProps$q(__spreadValues$C({}, p), {
2411
2418
  series: [...p.series, ...s.series]
2412
2419
  });
2413
2420
  })
2414
2421
  );
2415
2422
  }
2416
2423
 
2417
- var __defProp$A = Object.defineProperty;
2418
- var __defProps$o = Object.defineProperties;
2419
- var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2420
- var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2421
- var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2422
- var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2423
- var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2424
- var __spreadValues$A = (a, b) => {
2424
+ var __defProp$B = Object.defineProperty;
2425
+ var __defProps$p = Object.defineProperties;
2426
+ var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
2427
+ var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
2428
+ var __hasOwnProp$B = Object.prototype.hasOwnProperty;
2429
+ var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
2430
+ var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2431
+ var __spreadValues$B = (a, b) => {
2425
2432
  for (var prop in b || (b = {}))
2426
- if (__hasOwnProp$A.call(b, prop))
2427
- __defNormalProp$A(a, prop, b[prop]);
2428
- if (__getOwnPropSymbols$A)
2429
- for (var prop of __getOwnPropSymbols$A(b)) {
2430
- if (__propIsEnum$A.call(b, prop))
2431
- __defNormalProp$A(a, prop, b[prop]);
2433
+ if (__hasOwnProp$B.call(b, prop))
2434
+ __defNormalProp$B(a, prop, b[prop]);
2435
+ if (__getOwnPropSymbols$B)
2436
+ for (var prop of __getOwnPropSymbols$B(b)) {
2437
+ if (__propIsEnum$B.call(b, prop))
2438
+ __defNormalProp$B(a, prop, b[prop]);
2432
2439
  }
2433
2440
  return a;
2434
2441
  };
2435
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
2442
+ var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
2436
2443
  function filterAnnotations(data, filters) {
2437
2444
  var _a;
2438
2445
  if (!Array.isArray(data) || data.length === 0) {
@@ -2483,11 +2490,11 @@ function filterAnnotations(data, filters) {
2483
2490
  continue;
2484
2491
  }
2485
2492
  }
2486
- fields.push(__spreadProps$o(__spreadValues$A({}, field), {
2493
+ fields.push(__spreadProps$p(__spreadValues$B({}, field), {
2487
2494
  values: buffer
2488
2495
  }));
2489
2496
  }
2490
- processed.push(__spreadProps$o(__spreadValues$A({}, frame), {
2497
+ processed.push(__spreadProps$p(__spreadValues$B({}, frame), {
2491
2498
  fields,
2492
2499
  length: frameLength
2493
2500
  }));
@@ -2830,67 +2837,166 @@ class CustomAllValue {
2830
2837
  if (formatNameOrFn === schema.VariableFormatID.Text) {
2831
2838
  return ALL_VARIABLE_TEXT;
2832
2839
  }
2833
- if (formatNameOrFn === schema.VariableFormatID.PercentEncode) {
2834
- return formatRegistry.get(schema.VariableFormatID.PercentEncode).formatter(this._value, [], this._variable);
2840
+ if (formatNameOrFn === schema.VariableFormatID.PercentEncode) {
2841
+ return formatRegistry.get(schema.VariableFormatID.PercentEncode).formatter(this._value, [], this._variable);
2842
+ }
2843
+ if (formatNameOrFn === schema.VariableFormatID.QueryParam) {
2844
+ return formatRegistry.get(schema.VariableFormatID.QueryParam).formatter(ALL_VARIABLE_TEXT, [], this._variable);
2845
+ }
2846
+ return this._value;
2847
+ }
2848
+ }
2849
+
2850
+ var __defProp$A = Object.defineProperty;
2851
+ var __defProps$o = Object.defineProperties;
2852
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2853
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2854
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2855
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2856
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2857
+ var __spreadValues$A = (a, b) => {
2858
+ for (var prop in b || (b = {}))
2859
+ if (__hasOwnProp$A.call(b, prop))
2860
+ __defNormalProp$A(a, prop, b[prop]);
2861
+ if (__getOwnPropSymbols$A)
2862
+ for (var prop of __getOwnPropSymbols$A(b)) {
2863
+ if (__propIsEnum$A.call(b, prop))
2864
+ __defNormalProp$A(a, prop, b[prop]);
2865
+ }
2866
+ return a;
2867
+ };
2868
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
2869
+ var __objRest$3 = (source, exclude) => {
2870
+ var target = {};
2871
+ for (var prop in source)
2872
+ if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
2873
+ target[prop] = source[prop];
2874
+ if (source != null && __getOwnPropSymbols$A)
2875
+ for (var prop of __getOwnPropSymbols$A(source)) {
2876
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
2877
+ target[prop] = source[prop];
2835
2878
  }
2836
- if (formatNameOrFn === schema.VariableFormatID.QueryParam) {
2837
- return formatRegistry.get(schema.VariableFormatID.QueryParam).formatter(ALL_VARIABLE_TEXT, [], this._variable);
2879
+ return target;
2880
+ };
2881
+ function VariableValueSelect({ model }) {
2882
+ const { value, key } = model.useState();
2883
+ const onInputChange = model.onSearchChange ? (value2, meta) => {
2884
+ if (meta.action === "input-change") {
2885
+ model.onSearchChange(value2);
2838
2886
  }
2839
- return this._value;
2840
- }
2887
+ } : void 0;
2888
+ return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
2889
+ id: key,
2890
+ placeholder: "Select value",
2891
+ width: "auto",
2892
+ value,
2893
+ allowCustomValue: true,
2894
+ virtualized: true,
2895
+ tabSelectsValue: false,
2896
+ onInputChange,
2897
+ options: model.getOptionsForSelect(),
2898
+ "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
2899
+ onChange: (newValue) => {
2900
+ model.changeValueTo(newValue.value, newValue.label);
2901
+ }
2902
+ });
2841
2903
  }
2842
-
2843
- class GroupByVariableUrlSyncHandler {
2844
- constructor(_sceneObject) {
2845
- this._sceneObject = _sceneObject;
2846
- }
2847
- getKey() {
2848
- return `var-${this._sceneObject.state.name}`;
2849
- }
2850
- getKeys() {
2851
- if (this._sceneObject.state.skipUrlSync) {
2852
- return [];
2904
+ function VariableValueSelectMulti({ model }) {
2905
+ const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
2906
+ const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
2907
+ const options = model.getOptionsForSelect();
2908
+ const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
2909
+ const [inputValue, setInputValue] = React.useState("");
2910
+ React.useEffect(() => {
2911
+ setUncommittedValue(arrayValue);
2912
+ }, [arrayValue]);
2913
+ const onInputChange = (value2, { action }) => {
2914
+ if (action === "input-change") {
2915
+ setInputValue(value2);
2916
+ if (model.onSearchChange) {
2917
+ model.onSearchChange(value2);
2918
+ }
2919
+ return value2;
2853
2920
  }
2854
- return [this.getKey()];
2855
- }
2856
- getUrlState() {
2857
- if (this._sceneObject.state.skipUrlSync) {
2858
- return {};
2921
+ if (action === "input-blur") {
2922
+ setInputValue("");
2923
+ return "";
2859
2924
  }
2860
- let { value: values, text: texts } = this._sceneObject.state;
2861
- values = Array.isArray(values) ? values : [values];
2862
- texts = Array.isArray(texts) ? texts : [texts];
2863
- const urlValue = lodash.zip(values, texts).map(toUrlValues);
2864
- return { [this.getKey()]: urlValue };
2865
- }
2866
- updateFromUrl(values) {
2867
- let urlValue = values[this.getKey()];
2868
- if (urlValue != null) {
2869
- if (!this._sceneObject.isActive) {
2870
- this._sceneObject.skipNextValidation = true;
2925
+ return inputValue;
2926
+ };
2927
+ const placeholder = options.length > 0 ? "Select value" : "";
2928
+ return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
2929
+ id: key,
2930
+ placeholder,
2931
+ width: "auto",
2932
+ inputValue,
2933
+ value: uncommittedValue,
2934
+ noMultiValueWrap: true,
2935
+ maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
2936
+ tabSelectsValue: false,
2937
+ virtualized: true,
2938
+ allowCustomValue: true,
2939
+ options: model.getOptionsForSelect(),
2940
+ closeMenuOnSelect: false,
2941
+ components: { Option: OptionWithCheckbox },
2942
+ isClearable: true,
2943
+ hideSelectedOptions: false,
2944
+ onInputChange,
2945
+ onBlur: () => {
2946
+ model.changeValueTo(uncommittedValue);
2947
+ },
2948
+ "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
2949
+ onChange: (newValue, action) => {
2950
+ if (action.action === "clear" && noValueOnClear) {
2951
+ model.changeValueTo([]);
2871
2952
  }
2872
- urlValue = Array.isArray(urlValue) ? urlValue : [urlValue];
2873
- const valuesLabelsPairs = urlValue.map((value) => value ? value.split(",") : [value]);
2874
- let [values2, labels] = lodash.unzip(valuesLabelsPairs);
2875
- values2 = (values2 != null ? values2 : []).map(unescapeUrlDelimiters);
2876
- labels = (labels != null ? labels : []).map(unescapeUrlDelimiters);
2877
- this._sceneObject.setState({
2878
- urlOptions: values2.map((value, idx) => ({
2879
- value,
2880
- text: labels[idx]
2881
- }))
2882
- });
2883
- this._sceneObject.changeValueTo(values2, labels);
2953
+ setUncommittedValue(newValue.map((x) => x.value));
2884
2954
  }
2885
- }
2955
+ });
2886
2956
  }
2887
- function toUrlValues([value, label]) {
2888
- if (value === void 0 || value === null) {
2889
- return "";
2957
+ const OptionWithCheckbox = ({
2958
+ children,
2959
+ data,
2960
+ innerProps,
2961
+ innerRef,
2962
+ isFocused,
2963
+ isSelected,
2964
+ renderOptionLabel
2965
+ }) => {
2966
+ const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
2967
+ const theme = ui.useTheme2();
2968
+ const selectStyles = ui.getSelectStyles(theme);
2969
+ const optionStyles = ui.useStyles2(getOptionStyles);
2970
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
2971
+ ref: innerRef,
2972
+ className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
2973
+ }, rest), {
2974
+ "aria-label": "Select option",
2975
+ title: data.title
2976
+ }), /* @__PURE__ */ React__default["default"].createElement("div", {
2977
+ className: optionStyles.checkbox
2978
+ }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
2979
+ value: isSelected
2980
+ })), /* @__PURE__ */ React__default["default"].createElement("div", {
2981
+ className: selectStyles.optionBody
2982
+ }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
2983
+ };
2984
+ OptionWithCheckbox.displayName = "SelectMenuOptions";
2985
+ const getOptionStyles = (theme) => ({
2986
+ checkbox: css.css({
2987
+ marginRight: theme.spacing(2)
2988
+ })
2989
+ });
2990
+ function renderSelectForVariable(model) {
2991
+ if (model.state.isMulti) {
2992
+ return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
2993
+ model
2994
+ });
2995
+ } else {
2996
+ return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
2997
+ model
2998
+ });
2890
2999
  }
2891
- value = String(value);
2892
- label = label === void 0 || label === null ? value : String(label);
2893
- return toUrlCommaDelimitedString(value, label);
2894
3000
  }
2895
3001
 
2896
3002
  var __defProp$z = Object.defineProperty;
@@ -2929,7 +3035,6 @@ class GroupByVariable extends MultiValueVariable {
2929
3035
  noValueOnClear: true
2930
3036
  }));
2931
3037
  this.isLazy = true;
2932
- this._urlSync = new GroupByVariableUrlSyncHandler(this);
2933
3038
  this._getKeys = async (ds) => {
2934
3039
  var _a, _b, _c;
2935
3040
  const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, null));
@@ -2979,11 +3084,9 @@ class GroupByVariable extends MultiValueVariable {
2979
3084
  this.setState(stateUpdate);
2980
3085
  }
2981
3086
  getValueOptions(args) {
2982
- var _a;
2983
- const urlOptions = (_a = this.state.urlOptions) != null ? _a : [];
2984
3087
  if (this.state.defaultOptions) {
2985
3088
  return rxjs.of(
2986
- lodash.unionBy(this.state.defaultOptions, urlOptions, "value").map((o) => ({
3089
+ this.state.defaultOptions.map((o) => ({
2987
3090
  label: o.text,
2988
3091
  value: String(o.value)
2989
3092
  }))
@@ -2999,7 +3102,7 @@ class GroupByVariable extends MultiValueVariable {
2999
3102
  return rxjs.from(this._getKeys(ds)).pipe(
3000
3103
  rxjs.take(1),
3001
3104
  rxjs.mergeMap((data) => {
3002
- const a = lodash.unionBy(data, urlOptions, "value").map((i) => {
3105
+ const a = data.map((i) => {
3003
3106
  return {
3004
3107
  label: i.text,
3005
3108
  value: i.value ? String(i.value) : i.text
@@ -3017,29 +3120,29 @@ class GroupByVariable extends MultiValueVariable {
3017
3120
  }
3018
3121
  GroupByVariable.Component = GroupByVariableRenderer;
3019
3122
  function GroupByVariableRenderer({ model }) {
3020
- const { value, text, key, maxVisibleValues, noValueOnClear } = model.useState();
3021
- const values = React.useMemo(() => {
3022
- const arrayValue = lodash.isArray(value) ? value : [value];
3023
- const arrayText = lodash.isArray(text) ? text : [text];
3024
- return arrayValue.map((value2, idx) => {
3025
- var _a;
3026
- return {
3027
- value: value2,
3028
- label: String((_a = arrayText[idx]) != null ? _a : value2)
3029
- };
3030
- });
3031
- }, [value, text]);
3123
+ const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
3124
+ const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
3032
3125
  const [isFetchingOptions, setIsFetchingOptions] = React.useState(false);
3033
3126
  const [isOptionsOpen, setIsOptionsOpen] = React.useState(false);
3034
- const [uncommittedValue, setUncommittedValue] = React.useState(values);
3127
+ const [inputValue, setInputValue] = React.useState("");
3128
+ const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
3035
3129
  React.useEffect(() => {
3036
- setUncommittedValue(values);
3037
- }, [values]);
3038
- const onInputChange = model.onSearchChange ? (value2, meta) => {
3039
- if (meta.action === "input-change") {
3040
- model.onSearchChange(value2);
3130
+ setUncommittedValue(arrayValue);
3131
+ }, [arrayValue]);
3132
+ const onInputChange = (value2, { action }) => {
3133
+ if (action === "input-change") {
3134
+ setInputValue(value2);
3135
+ if (model.onSearchChange) {
3136
+ model.onSearchChange(value2);
3137
+ }
3138
+ return value2;
3041
3139
  }
3042
- } : void 0;
3140
+ if (action === "input-blur") {
3141
+ setInputValue("");
3142
+ return "";
3143
+ }
3144
+ return inputValue;
3145
+ };
3043
3146
  const placeholder = "Select value";
3044
3147
  return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
3045
3148
  "data-testid": `GroupBySelect-${key}`,
@@ -3056,16 +3159,18 @@ function GroupByVariableRenderer({ model }) {
3056
3159
  closeMenuOnSelect: false,
3057
3160
  isOpen: isOptionsOpen,
3058
3161
  isClearable: true,
3162
+ hideSelectedOptions: false,
3059
3163
  isLoading: isFetchingOptions,
3164
+ components: { Option: OptionWithCheckbox },
3060
3165
  onInputChange,
3061
3166
  onBlur: () => {
3062
- model.changeValueTo(uncommittedValue.map((x) => x.value));
3167
+ model.changeValueTo(uncommittedValue);
3063
3168
  },
3064
3169
  onChange: (newValue, action) => {
3065
3170
  if (action.action === "clear" && noValueOnClear) {
3066
3171
  model.changeValueTo([]);
3067
3172
  }
3068
- setUncommittedValue(newValue);
3173
+ setUncommittedValue(newValue.map((x) => x.value));
3069
3174
  },
3070
3175
  onOpenMenu: async () => {
3071
3176
  setIsFetchingOptions(true);
@@ -3388,7 +3493,7 @@ class AdHocFiltersVariableUrlSyncHandler {
3388
3493
  if (filters.length === 0) {
3389
3494
  return { [this.getKey()]: [""] };
3390
3495
  }
3391
- const value = filters.map((filter) => toArray(filter).map(escapeUrlPipeDelimiters).join("|"));
3496
+ const value = filters.map((filter) => toArray(filter).map(escapePipeDelimiters).join("|"));
3392
3497
  return { [this.getKey()]: value };
3393
3498
  }
3394
3499
  updateFromUrl(values) {
@@ -3408,13 +3513,39 @@ function deserializeUrlToFilters(value) {
3408
3513
  const filter = toFilter(value);
3409
3514
  return filter === null ? [] : [filter];
3410
3515
  }
3516
+ function escapePipeDelimiters(value) {
3517
+ if (value === null || value === void 0) {
3518
+ return "";
3519
+ }
3520
+ return value = /\|/g[Symbol.replace](value, "__gfp__");
3521
+ }
3522
+ function escapeCommaDelimiters(value) {
3523
+ if (value === null || value === void 0) {
3524
+ return "";
3525
+ }
3526
+ return /,/g[Symbol.replace](value, "__gfc__");
3527
+ }
3528
+ function unescapeDelimiters(value) {
3529
+ if (value === null || value === void 0) {
3530
+ return "";
3531
+ }
3532
+ value = /__gfp__/g[Symbol.replace](value, "|");
3533
+ value = /__gfc__/g[Symbol.replace](value, ",");
3534
+ return value;
3535
+ }
3411
3536
  function toArray(filter) {
3412
3537
  return [
3413
- toUrlCommaDelimitedString(filter.key, filter.keyLabel),
3538
+ toCommaDelimitedString(filter.key, filter.keyLabel),
3414
3539
  filter.operator,
3415
- toUrlCommaDelimitedString(filter.value, filter.valueLabel)
3540
+ toCommaDelimitedString(filter.value, filter.valueLabel)
3416
3541
  ];
3417
3542
  }
3543
+ function toCommaDelimitedString(key, label) {
3544
+ if (!label || key === label) {
3545
+ return escapeCommaDelimiters(key);
3546
+ }
3547
+ return [key, label].map(escapeCommaDelimiters).join(",");
3548
+ }
3418
3549
  function toFilter(urlValue) {
3419
3550
  if (typeof urlValue !== "string" || urlValue.length === 0) {
3420
3551
  return null;
@@ -3423,7 +3554,7 @@ function toFilter(urlValue) {
3423
3554
  const [key2, label] = v.split(",");
3424
3555
  acc.push(key2, label != null ? label : key2);
3425
3556
  return acc;
3426
- }, []).map(unescapeUrlDelimiters);
3557
+ }, []).map(unescapeDelimiters);
3427
3558
  return {
3428
3559
  key,
3429
3560
  keyLabel,
@@ -4133,32 +4264,6 @@ function filterOutInactiveRunnerDuplicates(runners) {
4133
4264
  return activeItems;
4134
4265
  });
4135
4266
  }
4136
- function escapeUrlPipeDelimiters(value) {
4137
- if (value === null || value === void 0) {
4138
- return "";
4139
- }
4140
- return value = /\|/g[Symbol.replace](value, "__gfp__");
4141
- }
4142
- function escapeUrlCommaDelimiters(value) {
4143
- if (value === null || value === void 0) {
4144
- return "";
4145
- }
4146
- return /,/g[Symbol.replace](value, "__gfc__");
4147
- }
4148
- function unescapeUrlDelimiters(value) {
4149
- if (value === null || value === void 0) {
4150
- return "";
4151
- }
4152
- value = /__gfp__/g[Symbol.replace](value, "|");
4153
- value = /__gfc__/g[Symbol.replace](value, ",");
4154
- return value;
4155
- }
4156
- function toUrlCommaDelimitedString(key, label) {
4157
- if (!label || key === label) {
4158
- return escapeUrlCommaDelimiters(key);
4159
- }
4160
- return [key, label].map(escapeUrlCommaDelimiters).join(",");
4161
- }
4162
4267
 
4163
4268
  function isAdHocVariable(variable) {
4164
4269
  return variable.state.type === "adhoc";
@@ -6420,81 +6525,6 @@ class ConstantVariable extends SceneObjectBase {
6420
6525
  }
6421
6526
  }
6422
6527
 
6423
- function VariableValueSelect({ model }) {
6424
- const { value, key } = model.useState();
6425
- const onInputChange = model.onSearchChange ? (value2, meta) => {
6426
- if (meta.action === "input-change") {
6427
- model.onSearchChange(value2);
6428
- }
6429
- } : void 0;
6430
- return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
6431
- id: key,
6432
- placeholder: "Select value",
6433
- width: "auto",
6434
- value,
6435
- allowCustomValue: true,
6436
- virtualized: true,
6437
- tabSelectsValue: false,
6438
- onInputChange,
6439
- options: model.getOptionsForSelect(),
6440
- "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
6441
- onChange: (newValue) => {
6442
- model.changeValueTo(newValue.value, newValue.label);
6443
- }
6444
- });
6445
- }
6446
- function VariableValueSelectMulti({ model }) {
6447
- const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
6448
- const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
6449
- const options = model.getOptionsForSelect();
6450
- const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
6451
- React.useEffect(() => {
6452
- setUncommittedValue(arrayValue);
6453
- }, [arrayValue]);
6454
- const onInputChange = model.onSearchChange ? (value2, meta) => {
6455
- if (meta.action === "input-change") {
6456
- model.onSearchChange(value2);
6457
- }
6458
- } : void 0;
6459
- const placeholder = options.length > 0 ? "Select value" : "";
6460
- return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
6461
- id: key,
6462
- placeholder,
6463
- width: "auto",
6464
- value: uncommittedValue,
6465
- noMultiValueWrap: true,
6466
- maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
6467
- tabSelectsValue: false,
6468
- virtualized: true,
6469
- allowCustomValue: true,
6470
- options: model.getOptionsForSelect(),
6471
- closeMenuOnSelect: false,
6472
- isClearable: true,
6473
- onInputChange,
6474
- onBlur: () => {
6475
- model.changeValueTo(uncommittedValue);
6476
- },
6477
- "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
6478
- onChange: (newValue, action) => {
6479
- if (action.action === "clear" && noValueOnClear) {
6480
- model.changeValueTo([]);
6481
- }
6482
- setUncommittedValue(newValue.map((x) => x.value));
6483
- }
6484
- });
6485
- }
6486
- function renderSelectForVariable(model) {
6487
- if (model.state.isMulti) {
6488
- return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
6489
- model
6490
- });
6491
- } else {
6492
- return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
6493
- model
6494
- });
6495
- }
6496
- }
6497
-
6498
6528
  var __defProp$i = Object.defineProperty;
6499
6529
  var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6500
6530
  var __hasOwnProp$i = Object.prototype.hasOwnProperty;