@grafana/scenes 5.23.4 → 5.24.0--canary.960.11775742614.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +0 -41
- package/dist/esm/core/types.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +5 -5
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +7 -5
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelect.js +4 -4
- package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelectors.js +3 -3
- package/dist/esm/variables/components/VariableValueSelectors.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +0 -1
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/variables/variants/MultiValueVariable.js +1 -3
- package/dist/esm/variables/variants/MultiValueVariable.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -1467,9 +1467,7 @@ class MultiValueVariable extends SceneObjectBase {
|
|
1467
1467
|
return stateUpdate;
|
1468
1468
|
}
|
1469
1469
|
if (this.hasAllValue()) {
|
1470
|
-
if (this.state.includeAll) {
|
1471
|
-
stateUpdate.text = ALL_VARIABLE_TEXT;
|
1472
|
-
} else {
|
1470
|
+
if (!this.state.includeAll) {
|
1473
1471
|
stateUpdate.value = options[0].value;
|
1474
1472
|
stateUpdate.text = options[0].label;
|
1475
1473
|
if (this.state.isMulti) {
|
@@ -2596,7 +2594,7 @@ function toSelectableValue$2(value, label) {
|
|
2596
2594
|
};
|
2597
2595
|
}
|
2598
2596
|
function VariableValueSelect({ model }) {
|
2599
|
-
const { value, text, key, options, includeAll, isReadOnly } = model.useState();
|
2597
|
+
const { value, text, key, options, includeAll, isReadOnly, allowCustomValue } = model.useState();
|
2600
2598
|
const [inputValue, setInputValue] = React.useState("");
|
2601
2599
|
const [hasCustomValue, setHasCustomValue] = React.useState(false);
|
2602
2600
|
const selectValue = toSelectableValue$2(value, String(text));
|
@@ -2628,7 +2626,7 @@ function VariableValueSelect({ model }) {
|
|
2628
2626
|
disabled: isReadOnly,
|
2629
2627
|
value: selectValue,
|
2630
2628
|
inputValue,
|
2631
|
-
allowCustomValue: true,
|
2629
|
+
allowCustomValue: allowCustomValue != null ? allowCustomValue : true,
|
2632
2630
|
virtualized: true,
|
2633
2631
|
filterOption: filterNoOp$2,
|
2634
2632
|
tabSelectsValue: false,
|
@@ -2646,7 +2644,7 @@ function VariableValueSelect({ model }) {
|
|
2646
2644
|
});
|
2647
2645
|
}
|
2648
2646
|
function VariableValueSelectMulti({ model }) {
|
2649
|
-
const { value, options, key, maxVisibleValues, noValueOnClear, includeAll, isReadOnly } = model.useState();
|
2647
|
+
const { value, options, key, maxVisibleValues, noValueOnClear, includeAll, isReadOnly, allowCustomValue } = model.useState();
|
2650
2648
|
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
2651
2649
|
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
2652
2650
|
const [inputValue, setInputValue] = React.useState("");
|
@@ -2681,7 +2679,7 @@ function VariableValueSelectMulti({ model }) {
|
|
2681
2679
|
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
2682
2680
|
tabSelectsValue: false,
|
2683
2681
|
virtualized: true,
|
2684
|
-
allowCustomValue: true,
|
2682
|
+
allowCustomValue: allowCustomValue != null ? allowCustomValue : true,
|
2685
2683
|
toggleAllOptions: {
|
2686
2684
|
enabled: true,
|
2687
2685
|
optionsFilter: filterAll,
|
@@ -3067,7 +3065,6 @@ function GroupByVariableRenderer({ model }) {
|
|
3067
3065
|
id: key,
|
3068
3066
|
placeholder: "Select value",
|
3069
3067
|
width: "auto",
|
3070
|
-
allowCustomValue: true,
|
3071
3068
|
inputValue,
|
3072
3069
|
value: uncommittedValue,
|
3073
3070
|
noMultiValueWrap: true,
|
@@ -3297,7 +3294,7 @@ function keyLabelToOption(key, label) {
|
|
3297
3294
|
}
|
3298
3295
|
const filterNoOp = () => true;
|
3299
3296
|
function AdHocFilterRenderer({ filter, model }) {
|
3300
|
-
var _a, _b, _c;
|
3297
|
+
var _a, _b, _c, _d, _e;
|
3301
3298
|
const styles = ui.useStyles2(getStyles$e);
|
3302
3299
|
const [keys, setKeys] = React.useState([]);
|
3303
3300
|
const [values, setValues] = React.useState([]);
|
@@ -3371,7 +3368,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3371
3368
|
};
|
3372
3369
|
const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, __spreadValues$D({
|
3373
3370
|
virtualized: true,
|
3374
|
-
allowCustomValue: true,
|
3371
|
+
allowCustomValue: (_b = model.state.allowCustomValue) != null ? _b : true,
|
3375
3372
|
isValidNewOption: (inputValue) => inputValue.trim().length > 0,
|
3376
3373
|
allowCreateWhileLoading: true,
|
3377
3374
|
formatCreateLabel: (inputValue) => `Use custom value: ${inputValue}`,
|
@@ -3417,7 +3414,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3417
3414
|
disabled: model.state.readOnly,
|
3418
3415
|
className: css.cx(styles.key, isKeysOpen ? styles.widthWhenOpen : void 0),
|
3419
3416
|
width: "auto",
|
3420
|
-
allowCustomValue: true,
|
3417
|
+
allowCustomValue: (_c = model.state.allowCustomValue) != null ? _c : true,
|
3421
3418
|
value: keyValue,
|
3422
3419
|
placeholder: "Select label",
|
3423
3420
|
options: handleOptionGroups(keys),
|
@@ -3470,7 +3467,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3470
3467
|
if (filter.key) {
|
3471
3468
|
const label = /* @__PURE__ */ React__default["default"].createElement(ControlsLabel, {
|
3472
3469
|
layout: "vertical",
|
3473
|
-
label: (
|
3470
|
+
label: (_d = filter.key) != null ? _d : "",
|
3474
3471
|
onRemove: () => model._removeFilter(filter)
|
3475
3472
|
});
|
3476
3473
|
return /* @__PURE__ */ React__default["default"].createElement(ui.Field, {
|
@@ -3497,7 +3494,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3497
3494
|
title: "Remove filter",
|
3498
3495
|
className: styles.removeButton,
|
3499
3496
|
icon: "times",
|
3500
|
-
"data-testid": `AdHocFilter-remove-${(
|
3497
|
+
"data-testid": `AdHocFilter-remove-${(_e = filter.key) != null ? _e : ""}`,
|
3501
3498
|
onClick: () => model._removeFilter(filter)
|
3502
3499
|
}));
|
3503
3500
|
}
|
@@ -4160,7 +4157,7 @@ var __spreadValues$A = (a, b) => {
|
|
4160
4157
|
};
|
4161
4158
|
var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
|
4162
4159
|
const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, isAlwaysWip, handleChangeViewMode, focusOnWipInputRef, populateInputOnEdit }, parentRef) {
|
4163
|
-
var _a, _b, _c;
|
4160
|
+
var _a, _b, _c, _d;
|
4164
4161
|
const [open, setOpen] = React.useState(false);
|
4165
4162
|
const [options, setOptions] = React.useState([]);
|
4166
4163
|
const [optionsLoading, setOptionsLoading] = React.useState(false);
|
@@ -4171,6 +4168,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4171
4168
|
const styles = ui.useStyles2(getStyles$b);
|
4172
4169
|
const [filterMultiValues, setFilterMultiValues] = React.useState([]);
|
4173
4170
|
const [_, setForceRefresh] = React.useState({});
|
4171
|
+
const allowCustomValue = (_a = model.state.allowCustomValue) != null ? _a : true;
|
4174
4172
|
const multiValuePillWrapperRef = React.useRef(null);
|
4175
4173
|
const hasMultiValueOperator = isMultiValueOperator((filter == null ? void 0 : filter.operator) || "");
|
4176
4174
|
const isMultiValueEdit = hasMultiValueOperator && filterInputType === "value";
|
@@ -4283,7 +4281,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4283
4281
|
[refs.domReference]
|
4284
4282
|
);
|
4285
4283
|
const filteredDropDownItems = flattenOptionGroups(handleOptionGroups(optionsSearcher(inputValue, filterInputType)));
|
4286
|
-
if (filterInputType !== "operator" && inputValue) {
|
4284
|
+
if (allowCustomValue && filterInputType !== "operator" && inputValue) {
|
4287
4285
|
filteredDropDownItems.push({
|
4288
4286
|
value: inputValue.trim(),
|
4289
4287
|
label: inputValue.trim(),
|
@@ -4502,7 +4500,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4502
4500
|
rowVirtualizer.scrollToIndex(activeIndex);
|
4503
4501
|
}
|
4504
4502
|
}, [activeIndex, rowVirtualizer]);
|
4505
|
-
const keyLabel = (
|
4503
|
+
const keyLabel = (_b = filter == null ? void 0 : filter.keyLabel) != null ? _b : filter == null ? void 0 : filter.key;
|
4506
4504
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
4507
4505
|
className: styles.comboboxWrapper
|
4508
4506
|
}, filter ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
@@ -4560,6 +4558,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4560
4558
|
setOpen(true);
|
4561
4559
|
},
|
4562
4560
|
onFocus: () => {
|
4561
|
+
setActiveIndex(0);
|
4563
4562
|
setOpen(true);
|
4564
4563
|
}
|
4565
4564
|
})), optionsLoading ? /* @__PURE__ */ React__default["default"].createElement(ui.Spinner, {
|
@@ -4573,7 +4572,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4573
4572
|
}, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
4574
4573
|
style: __spreadProps$o(__spreadValues$A({}, floatingStyles), {
|
4575
4574
|
width: `${optionsError ? ERROR_STATE_DROPDOWN_WIDTH : maxOptionWidth}px`,
|
4576
|
-
transform: isMultiValueEdit ? `translate(${((
|
4575
|
+
transform: isMultiValueEdit ? `translate(${((_c = multiValuePillWrapperRef.current) == null ? void 0 : _c.getBoundingClientRect().left) || 0}px, ${(((_d = refs.domReference.current) == null ? void 0 : _d.getBoundingClientRect().bottom) || 0) + 10}px )` : floatingStyles.transform
|
4577
4576
|
}),
|
4578
4577
|
ref: refs.setFloating,
|
4579
4578
|
className: styles.dropdownWrapper,
|
@@ -4586,7 +4585,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4586
4585
|
tabIndex: -1
|
4587
4586
|
}), optionsLoading ? /* @__PURE__ */ React__default["default"].createElement(LoadingOptionsPlaceholder, null) : optionsError ? /* @__PURE__ */ React__default["default"].createElement(OptionsErrorPlaceholder, {
|
4588
4587
|
handleFetchOptions: () => handleFetchOptions(filterInputType)
|
4589
|
-
}) : !filteredDropDownItems.length && (filterInputType === "operator" || !inputValue) ? /* @__PURE__ */ React__default["default"].createElement(NoOptionsPlaceholder, null) : rowVirtualizer.getVirtualItems().map((virtualItem) => {
|
4588
|
+
}) : !filteredDropDownItems.length && (!allowCustomValue || filterInputType === "operator" || !inputValue) ? /* @__PURE__ */ React__default["default"].createElement(NoOptionsPlaceholder, null) : rowVirtualizer.getVirtualItems().map((virtualItem) => {
|
4590
4589
|
var _a2;
|
4591
4590
|
const item = filteredDropDownItems[virtualItem.index];
|
4592
4591
|
const index = virtualItem.index;
|
@@ -8832,13 +8831,13 @@ function VariableValueSelectWrapper({ variable, layout, showAlways, hideLabel })
|
|
8832
8831
|
}));
|
8833
8832
|
}
|
8834
8833
|
function VariableLabel({ variable, layout, hideLabel }) {
|
8835
|
-
var _a;
|
8834
|
+
var _a, _b;
|
8836
8835
|
const { state } = variable;
|
8837
8836
|
if (variable.state.hide === data.VariableHide.hideLabel || hideLabel) {
|
8838
8837
|
return null;
|
8839
8838
|
}
|
8840
8839
|
const elementId = `var-${state.key}`;
|
8841
|
-
const labelOrName = state.label
|
8840
|
+
const labelOrName = (_a = state.label) != null ? _a : state.name;
|
8842
8841
|
return /* @__PURE__ */ React__default["default"].createElement(ControlsLabel, {
|
8843
8842
|
htmlFor: elementId,
|
8844
8843
|
isLoading: state.loading,
|
@@ -8849,7 +8848,7 @@ function VariableLabel({ variable, layout, hideLabel }) {
|
|
8849
8848
|
label: labelOrName,
|
8850
8849
|
error: state.error,
|
8851
8850
|
layout,
|
8852
|
-
description: (
|
8851
|
+
description: (_b = state.description) != null ? _b : void 0
|
8853
8852
|
});
|
8854
8853
|
}
|
8855
8854
|
const containerStyle = css.css({ display: "flex" });
|