@grafana/scenes 5.29.0--canary.808.12180708409.0 → 5.29.0--canary.992.12182781434.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. package/CHANGELOG.md +6 -6
  2. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  3. package/dist/esm/components/layout/CSSGrid/SceneCSSGridLayout.js.map +1 -1
  4. package/dist/esm/core/PanelBuilders/VizPanelBuilder.js.map +1 -1
  5. package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
  6. package/dist/esm/querying/SceneQueryRunner.js +1 -3
  7. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  8. package/dist/esm/querying/extraQueryProcessingOperator.js.map +1 -1
  9. package/dist/esm/querying/layers/annotations/AnnotationsDataLayer.js.map +1 -1
  10. package/dist/esm/querying/layers/annotations/filterAnnotations.js.map +1 -1
  11. package/dist/esm/querying/layers/annotations/standardAnnotationQuery.js.map +1 -1
  12. package/dist/esm/variables/adhoc/AdHocFilterBuilder.js.map +1 -1
  13. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +12 -8
  14. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  15. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +16 -1
  16. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
  17. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/DropdownItem.js +6 -1
  18. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/DropdownItem.js.map +1 -1
  19. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +1 -4
  20. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
  21. package/dist/esm/variables/components/VariableValueSelect.js +10 -1
  22. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  23. package/dist/esm/variables/macros/AllVariablesMacro.js.map +1 -1
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.js +46 -18
  26. package/dist/index.js.map +1 -1
  27. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2617,7 +2617,16 @@ function VariableValueSelect({ model }) {
2617
2617
  });
2618
2618
  }
2619
2619
  function VariableValueSelectMulti({ model }) {
2620
- const { value, options, key, maxVisibleValues, noValueOnClear, includeAll, isReadOnly, allowCustomValue = true } = model.useState();
2620
+ const {
2621
+ value,
2622
+ options,
2623
+ key,
2624
+ maxVisibleValues,
2625
+ noValueOnClear,
2626
+ includeAll,
2627
+ isReadOnly,
2628
+ allowCustomValue = true
2629
+ } = model.useState();
2621
2630
  const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
2622
2631
  const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
2623
2632
  const [inputValue, setInputValue] = React.useState("");
@@ -3256,10 +3265,12 @@ function AdHocFilterRenderer({ filter, model }) {
3256
3265
  const [isOperatorOpen, setIsOperatorOpen] = React.useState(false);
3257
3266
  const [valueInputValue, setValueInputValue] = React.useState("");
3258
3267
  const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3259
- const [uncommittedValue, setUncommittedValue] = React.useState(filter.values ? filter.values.map((value, index) => {
3260
- var _a2;
3261
- return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3262
- }) : []);
3268
+ const [uncommittedValue, setUncommittedValue] = React.useState(
3269
+ filter.values ? filter.values.map((value, index) => {
3270
+ var _a2;
3271
+ return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3272
+ }) : []
3273
+ );
3263
3274
  const isMultiValue = isMultiValueOperator(filter.operator);
3264
3275
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3265
3276
  const valueValue = keyLabelToOption(filter.value, (_a = filter.valueLabels) == null ? void 0 : _a[0]);
@@ -3282,10 +3293,12 @@ function AdHocFilterRenderer({ filter, model }) {
3282
3293
  setUncommittedValue([]);
3283
3294
  } else if (!isMultiValueOperator(existingOperator) && isMultiValueOperator(newOperator) && filter.value) {
3284
3295
  update.values = [filter.value];
3285
- setUncommittedValue([{
3286
- value: filter.value,
3287
- label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3288
- }]);
3296
+ setUncommittedValue([
3297
+ {
3298
+ value: filter.value,
3299
+ label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3300
+ }
3301
+ ]);
3289
3302
  }
3290
3303
  model._updateFilter(filter, update);
3291
3304
  };
@@ -3564,10 +3577,7 @@ function deserializeUrlToFilters(value) {
3564
3577
  }
3565
3578
  function toArray(filter) {
3566
3579
  var _a;
3567
- const result = [
3568
- toUrlCommaDelimitedString(filter.key, filter.keyLabel),
3569
- filter.operator
3570
- ];
3580
+ const result = [toUrlCommaDelimitedString(filter.key, filter.keyLabel), filter.operator];
3571
3581
  if (isMultiValueOperator(filter.operator)) {
3572
3582
  filter.values.forEach((value, index) => {
3573
3583
  var _a2;
@@ -3720,7 +3730,12 @@ const OptionsErrorPlaceholder = ({ handleFetchOptions }) => {
3720
3730
  onClick: handleFetchOptions
3721
3731
  }, "An error has occurred fetching labels. Click to retry");
3722
3732
  };
3723
- const MultiValueApplyButton = ({ onApply, floatingElement, maxOptionWidth, menuHeight }) => {
3733
+ const MultiValueApplyButton = ({
3734
+ onApply,
3735
+ floatingElement,
3736
+ maxOptionWidth,
3737
+ menuHeight
3738
+ }) => {
3724
3739
  const styles = ui.useStyles2(getStyles$e);
3725
3740
  const floatingElementRect = floatingElement == null ? void 0 : floatingElement.getBoundingClientRect();
3726
3741
  return /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -4077,6 +4092,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4077
4092
  const [inputValue, setInputValue] = React.useState("");
4078
4093
  const [activeIndex, setActiveIndex] = React.useState(null);
4079
4094
  const [filterInputType, setInputType] = React.useState(!isAlwaysWip ? "value" : "key");
4095
+ const [preventFiltering, setPreventFiltering] = React.useState(!isAlwaysWip && filterInputType === "value");
4080
4096
  const styles = ui.useStyles2(getStyles$c);
4081
4097
  const [filterMultiValues, setFilterMultiValues] = React.useState([]);
4082
4098
  const [_, setForceRefresh] = React.useState({});
@@ -4182,6 +4198,9 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4182
4198
  const value = event.target.value;
4183
4199
  setInputValue(value);
4184
4200
  setActiveIndex(0);
4201
+ if (preventFiltering) {
4202
+ setPreventFiltering(false);
4203
+ }
4185
4204
  }
4186
4205
  const handleRemoveMultiValue = React.useCallback(
4187
4206
  (item) => {
@@ -4193,7 +4212,9 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4193
4212
  },
4194
4213
  [refs.domReference]
4195
4214
  );
4196
- const filteredDropDownItems = flattenOptionGroups(handleOptionGroups(optionsSearcher(inputValue, filterInputType)));
4215
+ const filteredDropDownItems = flattenOptionGroups(
4216
+ handleOptionGroups(optionsSearcher(preventFiltering ? "" : inputValue, filterInputType))
4217
+ );
4197
4218
  if (allowCustomValue && filterInputType !== "operator" && inputValue) {
4198
4219
  filteredDropDownItems.push({
4199
4220
  value: inputValue.trim(),
@@ -4370,8 +4391,13 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4370
4391
  var _a2;
4371
4392
  const valueLabel = value.label || value.value;
4372
4393
  setFilterMultiValues((prev) => prev.filter((item) => item.value !== value.value));
4394
+ setPreventFiltering(true);
4373
4395
  setInputValue(valueLabel);
4374
4396
  (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
4397
+ setTimeout(() => {
4398
+ var _a3;
4399
+ (_a3 = refs.domReference.current) == null ? void 0 : _a3.select();
4400
+ });
4375
4401
  },
4376
4402
  [refs.domReference]
4377
4403
  );
@@ -4401,6 +4427,10 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4401
4427
  }
4402
4428
  if (!hasMultiValueOperator && populateInputOnEdit) {
4403
4429
  setInputValue((filter == null ? void 0 : filter.value) || "");
4430
+ setTimeout(() => {
4431
+ var _a3;
4432
+ (_a3 = refs.domReference.current) == null ? void 0 : _a3.select();
4433
+ });
4404
4434
  }
4405
4435
  (_b2 = refs.domReference.current) == null ? void 0 : _b2.focus();
4406
4436
  }
@@ -5264,9 +5294,7 @@ class SceneQueryRunner extends SceneObjectBase {
5264
5294
  })
5265
5295
  );
5266
5296
  }
5267
- this.subscribeToTimeRangeChanges(
5268
- timeRange
5269
- );
5297
+ this.subscribeToTimeRangeChanges(timeRange);
5270
5298
  if (this.shouldRunQueriesOnActivate()) {
5271
5299
  this.runQueries();
5272
5300
  }