@grafana/scenes 6.0.0--canary.979.12745482012.0 → 6.0.0--canary.979.12946533009.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -5316,11 +5316,13 @@ const OPERATORS = [
5316
5316
  },
5317
5317
  {
5318
5318
  value: "=~",
5319
- description: "Matches regex"
5319
+ description: "Matches regex",
5320
+ isRegex: true
5320
5321
  },
5321
5322
  {
5322
5323
  value: "!~",
5323
- description: "Does not match regex"
5324
+ description: "Does not match regex",
5325
+ isRegex: true
5324
5326
  },
5325
5327
  {
5326
5328
  value: "<",
@@ -5498,8 +5500,16 @@ class AdHocFiltersVariable extends SceneObjectBase {
5498
5500
  });
5499
5501
  }
5500
5502
  _getOperators() {
5501
- const filteredOperators = this.state.supportsMultiValueOperators ? OPERATORS : OPERATORS.filter((operator) => !operator.isMulti);
5502
- return filteredOperators.map(({ value, description }) => ({
5503
+ const { supportsMultiValueOperators, allowCustomValue } = this.state;
5504
+ return OPERATORS.filter(({ isMulti, isRegex }) => {
5505
+ if (!supportsMultiValueOperators && isMulti) {
5506
+ return false;
5507
+ }
5508
+ if (!allowCustomValue && isRegex) {
5509
+ return false;
5510
+ }
5511
+ return true;
5512
+ }).map(({ value, description }) => ({
5503
5513
  label: value,
5504
5514
  value,
5505
5515
  description
@@ -5543,7 +5553,7 @@ const getStyles$9 = (theme) => ({
5543
5553
  function toSelectableValue(input) {
5544
5554
  const { text, value } = input;
5545
5555
  const result = {
5546
- label: text,
5556
+ label: String(text),
5547
5557
  value: String(value != null ? value : text)
5548
5558
  };
5549
5559
  if ("group" in input) {
@@ -6151,6 +6161,9 @@ function escapeUrlCommaDelimiters(value) {
6151
6161
  }
6152
6162
  return /,/g[Symbol.replace](value, "__gfc__");
6153
6163
  }
6164
+ function escapeURLDelimiters(value) {
6165
+ return escapeUrlCommaDelimiters(escapeUrlPipeDelimiters(value));
6166
+ }
6154
6167
  function unescapeUrlDelimiters(value) {
6155
6168
  if (value === null || value === void 0) {
6156
6169
  return "";
@@ -7371,6 +7384,7 @@ function VizPanelRenderer({ model }) {
7371
7384
  );
7372
7385
  const plugin = model.getPlugin();
7373
7386
  const { dragClass, dragClassCancel } = getDragClasses(model);
7387
+ const dragHooks = getDragHooks(model);
7374
7388
  const dataObject = sceneGraph.getData(model);
7375
7389
  const rawData = dataObject.useState();
7376
7390
  const dataWithSeriesLimit = useDataWithSeriesLimit(rawData.data, seriesLimit, seriesLimitShowAll);
@@ -7502,7 +7516,11 @@ function VizPanelRenderer({ model }) {
7502
7516
  onMouseMove: debouncedMouseMove,
7503
7517
  collapsible,
7504
7518
  collapsed,
7505
- onToggleCollapse: model.onToggleCollapse
7519
+ onToggleCollapse: model.onToggleCollapse,
7520
+ onDragStart: (e) => {
7521
+ var _a2;
7522
+ (_a2 = dragHooks.onDragStart) == null ? void 0 : _a2.call(dragHooks, e, model);
7523
+ }
7506
7524
  }, (innerWidth, innerHeight) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.ErrorBoundaryAlert, {
7507
7525
  dependencies: [plugin, data$1]
7508
7526
  }, /* @__PURE__ */ React__default["default"].createElement(data.PluginContextProvider, {
@@ -7547,6 +7565,11 @@ function getDragClasses(panel) {
7547
7565
  }
7548
7566
  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) };
7549
7567
  }
7568
+ function getDragHooks(panel) {
7569
+ var _a, _b;
7570
+ const parentLayout = sceneGraph.getLayout(panel);
7571
+ return (_b = (_a = parentLayout == null ? void 0 : parentLayout.getDragHooks) == null ? void 0 : _a.call(parentLayout)) != null ? _b : {};
7572
+ }
7550
7573
  function itemDraggingDisabled(item, layout) {
7551
7574
  let ancestor = item.parent;
7552
7575
  while (ancestor && ancestor !== layout) {
@@ -14058,6 +14081,9 @@ const sceneUtils = {
14058
14081
  syncStateFromSearchParams,
14059
14082
  getUrlState,
14060
14083
  renderPrometheusLabelFilters,
14084
+ escapeLabelValueInRegexSelector,
14085
+ escapeLabelValueInExactSelector,
14086
+ escapeURLDelimiters,
14061
14087
  isAdHocVariable,
14062
14088
  isConstantVariable,
14063
14089
  isCustomVariable,