@grafana/scenes 5.38.0--canary.1030.12908050920.0 → 5.38.1--canary.1036.12955586071.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -4228,8 +4228,9 @@ const populateInputValueOnInputTypeSwitch = ({
4228
4228
  setInputValue,
4229
4229
  filter
4230
4230
  }) => {
4231
+ var _a, _b, _c;
4231
4232
  if (populateInputOnEdit && !isMultiValueOperator(item.value || "") && nextInputTypeMap[filterInputType] === "value") {
4232
- setInputValue((filter == null ? void 0 : filter.value) || "");
4233
+ setInputValue((_c = (_b = (_a = filter == null ? void 0 : filter.valueLabels) == null ? void 0 : _a[0]) != null ? _b : filter == null ? void 0 : filter.value) != null ? _c : "");
4233
4234
  } else {
4234
4235
  setInputValue("");
4235
4236
  }
@@ -4750,7 +4751,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4750
4751
  }
4751
4752
  }, [open, filterInputType]);
4752
4753
  React.useEffect(() => {
4753
- var _a2, _b2;
4754
+ var _a2, _b2, _c2, _d2;
4754
4755
  if (!isAlwaysWip) {
4755
4756
  if (hasMultiValueOperator && ((_a2 = filter == null ? void 0 : filter.values) == null ? void 0 : _a2.length)) {
4756
4757
  const multiValueOptions = filter.values.reduce(
@@ -4769,13 +4770,13 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4769
4770
  setFilterMultiValues(multiValueOptions);
4770
4771
  }
4771
4772
  if (!hasMultiValueOperator && populateInputOnEdit) {
4772
- setInputValue((filter == null ? void 0 : filter.value) || "");
4773
+ setInputValue((_c2 = (_b2 = filter == null ? void 0 : filter.valueLabels) == null ? void 0 : _b2[0]) != null ? _c2 : (filter == null ? void 0 : filter.value) || "");
4773
4774
  setTimeout(() => {
4774
4775
  var _a3;
4775
4776
  (_a3 = refs.domReference.current) == null ? void 0 : _a3.select();
4776
4777
  });
4777
4778
  }
4778
- (_b2 = refs.domReference.current) == null ? void 0 : _b2.focus();
4779
+ (_d2 = refs.domReference.current) == null ? void 0 : _d2.focus();
4779
4780
  }
4780
4781
  }, []);
4781
4782
  React.useEffect(() => {
@@ -5300,11 +5301,13 @@ const OPERATORS = [
5300
5301
  },
5301
5302
  {
5302
5303
  value: "=~",
5303
- description: "Matches regex"
5304
+ description: "Matches regex",
5305
+ isRegex: true
5304
5306
  },
5305
5307
  {
5306
5308
  value: "!~",
5307
- description: "Does not match regex"
5309
+ description: "Does not match regex",
5310
+ isRegex: true
5308
5311
  },
5309
5312
  {
5310
5313
  value: "<",
@@ -5482,8 +5485,16 @@ class AdHocFiltersVariable extends SceneObjectBase {
5482
5485
  });
5483
5486
  }
5484
5487
  _getOperators() {
5485
- const filteredOperators = this.state.supportsMultiValueOperators ? OPERATORS : OPERATORS.filter((operator) => !operator.isMulti);
5486
- return filteredOperators.map(({ value, description }) => ({
5488
+ const { supportsMultiValueOperators, allowCustomValue } = this.state;
5489
+ return OPERATORS.filter(({ isMulti, isRegex }) => {
5490
+ if (!supportsMultiValueOperators && isMulti) {
5491
+ return false;
5492
+ }
5493
+ if (!allowCustomValue && isRegex) {
5494
+ return false;
5495
+ }
5496
+ return true;
5497
+ }).map(({ value, description }) => ({
5487
5498
  label: value,
5488
5499
  value,
5489
5500
  description
@@ -7358,6 +7369,7 @@ function VizPanelRenderer({ model }) {
7358
7369
  );
7359
7370
  const plugin = model.getPlugin();
7360
7371
  const { dragClass, dragClassCancel } = getDragClasses(model);
7372
+ const dragHooks = getDragHooks(model);
7361
7373
  const dataObject = sceneGraph.getData(model);
7362
7374
  const rawData = dataObject.useState();
7363
7375
  const dataWithSeriesLimit = useDataWithSeriesLimit(rawData.data, seriesLimit, seriesLimitShowAll);
@@ -7489,7 +7501,11 @@ function VizPanelRenderer({ model }) {
7489
7501
  onMouseMove: debouncedMouseMove,
7490
7502
  collapsible,
7491
7503
  collapsed,
7492
- onToggleCollapse: model.onToggleCollapse
7504
+ onToggleCollapse: model.onToggleCollapse,
7505
+ onDragStart: (e) => {
7506
+ var _a2;
7507
+ (_a2 = dragHooks.onDragStart) == null ? void 0 : _a2.call(dragHooks, e, model);
7508
+ }
7493
7509
  }, (innerWidth, innerHeight) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.ErrorBoundaryAlert, {
7494
7510
  dependencies: [plugin, data$1]
7495
7511
  }, /* @__PURE__ */ React__default["default"].createElement(data.PluginContextProvider, {
@@ -7534,6 +7550,11 @@ function getDragClasses(panel) {
7534
7550
  }
7535
7551
  return { dragClass: (_a = parentLayout.getDragClass) == null ? void 0 : _a.call(parentLayout), dragClassCancel: (_b = parentLayout == null ? void 0 : parentLayout.getDragClassCancel) == null ? void 0 : _b.call(parentLayout) };
7536
7552
  }
7553
+ function getDragHooks(panel) {
7554
+ var _a, _b;
7555
+ const parentLayout = sceneGraph.getLayout(panel);
7556
+ return (_b = (_a = parentLayout == null ? void 0 : parentLayout.getDragHooks) == null ? void 0 : _a.call(parentLayout)) != null ? _b : {};
7557
+ }
7537
7558
  function itemDraggingDisabled(item, layout) {
7538
7559
  let ancestor = item.parent;
7539
7560
  while (ancestor && ancestor !== layout) {
@@ -9571,7 +9592,12 @@ class SceneVariableSet extends SceneObjectBase {
9571
9592
  if (!sceneObject.isActive) {
9572
9593
  return;
9573
9594
  }
9574
- if (sceneObject.state.$variables && sceneObject.state.$variables !== this) ;
9595
+ if (sceneObject.state.$variables && sceneObject.state.$variables !== this) {
9596
+ const localVar = sceneObject.state.$variables.getByName(variable.state.name);
9597
+ if (localVar) {
9598
+ return;
9599
+ }
9600
+ }
9575
9601
  if (sceneObject.variableDependency) {
9576
9602
  sceneObject.variableDependency.variableUpdateCompleted(variable, hasChanged);
9577
9603
  }