@grafana/scenes 5.20.5--canary.942.11520639649.0 → 5.21.1--canary.947.11593224430.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/esm/core/SceneTimeRange.js +1 -4
- package/dist/esm/core/SceneTimeRange.js.map +1 -1
- package/dist/esm/core/sceneGraph/utils.js +3 -2
- package/dist/esm/core/sceneGraph/utils.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.js +4 -11
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +11 -31
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js +5 -5
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +0 -28
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/macros/timeMacros.js +3 -0
- package/dist/esm/variables/macros/timeMacros.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +69 -123
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -77,8 +77,8 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
|
|
77
77
|
}
|
78
78
|
|
79
79
|
var __defProp$N = Object.defineProperty;
|
80
|
-
var __defProps$
|
81
|
-
var __getOwnPropDescs$
|
80
|
+
var __defProps$u = Object.defineProperties;
|
81
|
+
var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
|
82
82
|
var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
|
83
83
|
var __hasOwnProp$N = Object.prototype.hasOwnProperty;
|
84
84
|
var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
|
@@ -94,13 +94,13 @@ var __spreadValues$N = (a, b) => {
|
|
94
94
|
}
|
95
95
|
return a;
|
96
96
|
};
|
97
|
-
var __spreadProps$
|
97
|
+
var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
|
98
98
|
const runtimePanelPlugins = /* @__PURE__ */ new Map();
|
99
99
|
function registerRuntimePanelPlugin({ pluginId, plugin }) {
|
100
100
|
if (runtimePanelPlugins.has(pluginId)) {
|
101
101
|
throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
|
102
102
|
}
|
103
|
-
plugin.meta = __spreadProps$
|
103
|
+
plugin.meta = __spreadProps$u(__spreadValues$N({}, plugin.meta), {
|
104
104
|
id: pluginId,
|
105
105
|
name: pluginId,
|
106
106
|
module: "runtime plugin",
|
@@ -129,8 +129,8 @@ function loadPanelPluginSync(pluginId) {
|
|
129
129
|
}
|
130
130
|
|
131
131
|
var __defProp$M = Object.defineProperty;
|
132
|
-
var __defProps$
|
133
|
-
var __getOwnPropDescs$
|
132
|
+
var __defProps$t = Object.defineProperties;
|
133
|
+
var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
|
134
134
|
var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
|
135
135
|
var __hasOwnProp$M = Object.prototype.hasOwnProperty;
|
136
136
|
var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
|
@@ -146,7 +146,7 @@ var __spreadValues$M = (a, b) => {
|
|
146
146
|
}
|
147
147
|
return a;
|
148
148
|
};
|
149
|
-
var __spreadProps$
|
149
|
+
var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
|
150
150
|
var __objRest$5 = (source, exclude) => {
|
151
151
|
var target = {};
|
152
152
|
for (var prop in source)
|
@@ -172,7 +172,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
|
|
172
172
|
if (!model.isActive) {
|
173
173
|
return null;
|
174
174
|
}
|
175
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$
|
175
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$t(__spreadValues$M({}, otherProps), {
|
176
176
|
model
|
177
177
|
}));
|
178
178
|
}
|
@@ -511,13 +511,15 @@ function cloneSceneObject(sceneObject, withState) {
|
|
511
511
|
}
|
512
512
|
function cloneSceneObjectState(sceneState, withState) {
|
513
513
|
const clonedState = __spreadValues$K({}, sceneState);
|
514
|
+
Object.assign(clonedState, withState);
|
514
515
|
for (const key in clonedState) {
|
515
516
|
const propValue = clonedState[key];
|
516
517
|
if (propValue instanceof SceneObjectBase) {
|
517
518
|
clonedState[key] = propValue.clone();
|
518
519
|
}
|
519
520
|
if (propValue instanceof SceneObjectRef) {
|
520
|
-
|
521
|
+
console.warn("Cloning object with SceneObjectRef");
|
522
|
+
continue;
|
521
523
|
}
|
522
524
|
if (Array.isArray(propValue)) {
|
523
525
|
const newArray = [];
|
@@ -531,7 +533,6 @@ function cloneSceneObjectState(sceneState, withState) {
|
|
531
533
|
clonedState[key] = newArray;
|
532
534
|
}
|
533
535
|
}
|
534
|
-
Object.assign(clonedState, withState);
|
535
536
|
return clonedState;
|
536
537
|
}
|
537
538
|
function getClosest(sceneObject, extract) {
|
@@ -892,10 +893,7 @@ class SceneTimeRange extends SceneObjectBase {
|
|
892
893
|
}
|
893
894
|
getUrlState() {
|
894
895
|
const params = runtime.locationService.getSearchObject();
|
895
|
-
const urlValues = { from: this.state.from, to: this.state.to };
|
896
|
-
if (this.state.timeZone) {
|
897
|
-
urlValues.timezone = this.state.timeZone;
|
898
|
-
}
|
896
|
+
const urlValues = { from: this.state.from, to: this.state.to, timezone: this.getTimeZone() };
|
899
897
|
if (params.time && params["time.window"]) {
|
900
898
|
urlValues.time = null;
|
901
899
|
urlValues["time.window"] = null;
|
@@ -1341,6 +1339,9 @@ class UrlTimeRangeMacro {
|
|
1341
1339
|
var _a;
|
1342
1340
|
const timeRange = getTimeRange(this._sceneObject);
|
1343
1341
|
const urlState = (_a = timeRange.urlSync) == null ? void 0 : _a.getUrlState();
|
1342
|
+
if ((urlState == null ? void 0 : urlState.timezone) === "browser") {
|
1343
|
+
urlState.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
1344
|
+
}
|
1344
1345
|
return new SkipFormattingValue(data.urlUtil.toUrlParams(urlState));
|
1345
1346
|
}
|
1346
1347
|
getValueText() {
|
@@ -1746,8 +1747,8 @@ function collectAllVariables(sceneObject, record = {}) {
|
|
1746
1747
|
}
|
1747
1748
|
|
1748
1749
|
var __defProp$H = Object.defineProperty;
|
1749
|
-
var __defProps$
|
1750
|
-
var __getOwnPropDescs$
|
1750
|
+
var __defProps$s = Object.defineProperties;
|
1751
|
+
var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
|
1751
1752
|
var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
|
1752
1753
|
var __hasOwnProp$H = Object.prototype.hasOwnProperty;
|
1753
1754
|
var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
|
@@ -1763,7 +1764,7 @@ var __spreadValues$H = (a, b) => {
|
|
1763
1764
|
}
|
1764
1765
|
return a;
|
1765
1766
|
};
|
1766
|
-
var __spreadProps$
|
1767
|
+
var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
|
1767
1768
|
function getTemplateProxyForField(field, frame, frames) {
|
1768
1769
|
return new Proxy(
|
1769
1770
|
{},
|
@@ -1779,7 +1780,7 @@ function getTemplateProxyForField(field, frame, frames) {
|
|
1779
1780
|
if (!field.labels) {
|
1780
1781
|
return "";
|
1781
1782
|
}
|
1782
|
-
return __spreadProps$
|
1783
|
+
return __spreadProps$s(__spreadValues$H({}, field.labels), {
|
1783
1784
|
__values: Object.values(field.labels).sort().join(", "),
|
1784
1785
|
toString: () => {
|
1785
1786
|
return data.formatLabels(field.labels, "", true);
|
@@ -2277,8 +2278,8 @@ function isExtraQueryProvider(obj) {
|
|
2277
2278
|
}
|
2278
2279
|
|
2279
2280
|
var __defProp$G = Object.defineProperty;
|
2280
|
-
var __defProps$
|
2281
|
-
var __getOwnPropDescs$
|
2281
|
+
var __defProps$r = Object.defineProperties;
|
2282
|
+
var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
|
2282
2283
|
var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
|
2283
2284
|
var __hasOwnProp$G = Object.prototype.hasOwnProperty;
|
2284
2285
|
var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
|
@@ -2294,7 +2295,7 @@ var __spreadValues$G = (a, b) => {
|
|
2294
2295
|
}
|
2295
2296
|
return a;
|
2296
2297
|
};
|
2297
|
-
var __spreadProps$
|
2298
|
+
var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
|
2298
2299
|
const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
|
2299
2300
|
const extraQueryProcessingOperator = (processors) => (data) => {
|
2300
2301
|
return data.pipe(
|
@@ -2307,7 +2308,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
|
|
2307
2308
|
}),
|
2308
2309
|
rxjs.map(([primary, ...processedSecondaries]) => {
|
2309
2310
|
var _a;
|
2310
|
-
return __spreadProps$
|
2311
|
+
return __spreadProps$r(__spreadValues$G({}, primary), {
|
2311
2312
|
series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
|
2312
2313
|
annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
|
2313
2314
|
var _a2;
|
@@ -2319,8 +2320,8 @@ const extraQueryProcessingOperator = (processors) => (data) => {
|
|
2319
2320
|
};
|
2320
2321
|
|
2321
2322
|
var __defProp$F = Object.defineProperty;
|
2322
|
-
var __defProps$
|
2323
|
-
var __getOwnPropDescs$
|
2323
|
+
var __defProps$q = Object.defineProperties;
|
2324
|
+
var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
|
2324
2325
|
var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
|
2325
2326
|
var __hasOwnProp$F = Object.prototype.hasOwnProperty;
|
2326
2327
|
var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
|
@@ -2336,7 +2337,7 @@ var __spreadValues$F = (a, b) => {
|
|
2336
2337
|
}
|
2337
2338
|
return a;
|
2338
2339
|
};
|
2339
|
-
var __spreadProps$
|
2340
|
+
var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
|
2340
2341
|
function filterAnnotations(data, filters) {
|
2341
2342
|
var _a;
|
2342
2343
|
if (!Array.isArray(data) || data.length === 0) {
|
@@ -2387,11 +2388,11 @@ function filterAnnotations(data, filters) {
|
|
2387
2388
|
continue;
|
2388
2389
|
}
|
2389
2390
|
}
|
2390
|
-
fields.push(__spreadProps$
|
2391
|
+
fields.push(__spreadProps$q(__spreadValues$F({}, field), {
|
2391
2392
|
values: buffer
|
2392
2393
|
}));
|
2393
2394
|
}
|
2394
|
-
processed.push(__spreadProps$
|
2395
|
+
processed.push(__spreadProps$q(__spreadValues$F({}, frame), {
|
2395
2396
|
fields,
|
2396
2397
|
length: frameLength
|
2397
2398
|
}));
|
@@ -2542,8 +2543,8 @@ function getOptionSearcher(options, includeAll) {
|
|
2542
2543
|
}
|
2543
2544
|
|
2544
2545
|
var __defProp$E = Object.defineProperty;
|
2545
|
-
var __defProps$
|
2546
|
-
var __getOwnPropDescs$
|
2546
|
+
var __defProps$p = Object.defineProperties;
|
2547
|
+
var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
|
2547
2548
|
var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
|
2548
2549
|
var __hasOwnProp$E = Object.prototype.hasOwnProperty;
|
2549
2550
|
var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
|
@@ -2559,7 +2560,7 @@ var __spreadValues$E = (a, b) => {
|
|
2559
2560
|
}
|
2560
2561
|
return a;
|
2561
2562
|
};
|
2562
|
-
var __spreadProps$
|
2563
|
+
var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
|
2563
2564
|
var __objRest$4 = (source, exclude) => {
|
2564
2565
|
var target = {};
|
2565
2566
|
for (var prop in source)
|
@@ -2715,7 +2716,7 @@ const OptionWithCheckbox = ({
|
|
2715
2716
|
const theme = ui.useTheme2();
|
2716
2717
|
const selectStyles = ui.getSelectStyles(theme);
|
2717
2718
|
const optionStyles = ui.useStyles2(getOptionStyles);
|
2718
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$
|
2719
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$p(__spreadValues$E({
|
2719
2720
|
ref: innerRef,
|
2720
2721
|
className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
|
2721
2722
|
}, rest), {
|
@@ -2881,8 +2882,8 @@ function wrapInSafeSerializableSceneObject(sceneObject) {
|
|
2881
2882
|
}
|
2882
2883
|
|
2883
2884
|
var __defProp$D = Object.defineProperty;
|
2884
|
-
var __defProps$
|
2885
|
-
var __getOwnPropDescs$
|
2885
|
+
var __defProps$o = Object.defineProperties;
|
2886
|
+
var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
|
2886
2887
|
var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
|
2887
2888
|
var __hasOwnProp$D = Object.prototype.hasOwnProperty;
|
2888
2889
|
var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
|
@@ -2898,10 +2899,10 @@ var __spreadValues$D = (a, b) => {
|
|
2898
2899
|
}
|
2899
2900
|
return a;
|
2900
2901
|
};
|
2901
|
-
var __spreadProps$
|
2902
|
+
var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
|
2902
2903
|
class GroupByVariable extends MultiValueVariable {
|
2903
2904
|
constructor(initialState) {
|
2904
|
-
super(__spreadProps$
|
2905
|
+
super(__spreadProps$o(__spreadValues$D({
|
2905
2906
|
isMulti: true,
|
2906
2907
|
name: "",
|
2907
2908
|
value: [],
|
@@ -4012,8 +4013,8 @@ const useFloatingInteractions = ({
|
|
4012
4013
|
};
|
4013
4014
|
|
4014
4015
|
var __defProp$A = Object.defineProperty;
|
4015
|
-
var __defProps$
|
4016
|
-
var __getOwnPropDescs$
|
4016
|
+
var __defProps$n = Object.defineProperties;
|
4017
|
+
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
4017
4018
|
var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
|
4018
4019
|
var __hasOwnProp$A = Object.prototype.hasOwnProperty;
|
4019
4020
|
var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
|
@@ -4029,8 +4030,8 @@ var __spreadValues$A = (a, b) => {
|
|
4029
4030
|
}
|
4030
4031
|
return a;
|
4031
4032
|
};
|
4032
|
-
var __spreadProps$
|
4033
|
-
const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, isAlwaysWip, handleChangeViewMode
|
4033
|
+
var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
|
4034
|
+
const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, isAlwaysWip, handleChangeViewMode }, parentRef) {
|
4034
4035
|
var _a, _b, _c;
|
4035
4036
|
const [open, setOpen] = React.useState(false);
|
4036
4037
|
const [options, setOptions] = React.useState([]);
|
@@ -4182,39 +4183,19 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4182
4183
|
const handleBackspaceInput = React.useCallback(
|
4183
4184
|
(event, multiValueEdit) => {
|
4184
4185
|
if (event.key === "Backspace" && !inputValue) {
|
4185
|
-
if (
|
4186
|
-
|
4187
|
-
|
4188
|
-
|
4189
|
-
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
|
-
|
4194
|
-
}
|
4195
|
-
}
|
4196
|
-
setInputType("operator");
|
4197
|
-
return;
|
4198
|
-
}
|
4199
|
-
if (model.state.filters[0] === filter) {
|
4200
|
-
focusOnWipInputRef == null ? void 0 : focusOnWipInputRef();
|
4201
|
-
}
|
4202
|
-
model._handleComboboxBackspace(filter);
|
4203
|
-
if (isAlwaysWip) {
|
4204
|
-
handleResetWip();
|
4186
|
+
if (multiValueEdit) {
|
4187
|
+
setFilterMultiValues((items) => {
|
4188
|
+
const updated = [...items];
|
4189
|
+
updated.splice(-1, 1);
|
4190
|
+
return updated;
|
4191
|
+
});
|
4192
|
+
} else if (filterInputType === "key") {
|
4193
|
+
model._removeLastFilter();
|
4194
|
+
handleFetchOptions(filterInputType);
|
4205
4195
|
}
|
4206
4196
|
}
|
4207
4197
|
},
|
4208
|
-
[
|
4209
|
-
inputValue,
|
4210
|
-
filterInputType,
|
4211
|
-
model,
|
4212
|
-
filter,
|
4213
|
-
isAlwaysWip,
|
4214
|
-
filterMultiValues.length,
|
4215
|
-
handleResetWip,
|
4216
|
-
focusOnWipInputRef
|
4217
|
-
]
|
4198
|
+
[inputValue, filterInputType, model, handleFetchOptions]
|
4218
4199
|
);
|
4219
4200
|
const handleTabInput = React.useCallback(
|
4220
4201
|
(event, multiValueEdit) => {
|
@@ -4358,7 +4339,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4358
4339
|
item,
|
4359
4340
|
index: i,
|
4360
4341
|
handleRemoveMultiValue
|
4361
|
-
})) : null) : null, /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$
|
4342
|
+
})) : null) : null, /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$n(__spreadValues$A({}, getReferenceProps({
|
4362
4343
|
ref: refs.setReference,
|
4363
4344
|
onChange,
|
4364
4345
|
value: inputValue,
|
@@ -4395,14 +4376,14 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4395
4376
|
visuallyHiddenDismiss: true,
|
4396
4377
|
modal: false
|
4397
4378
|
}, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
4398
|
-
style: __spreadProps$
|
4379
|
+
style: __spreadProps$n(__spreadValues$A({}, floatingStyles), {
|
4399
4380
|
width: `${optionsError ? ERROR_STATE_DROPDOWN_WIDTH : maxOptionWidth}px`,
|
4400
4381
|
transform: isMultiValueEdit ? `translate(${((_b = multiValuePillWrapperRef.current) == null ? void 0 : _b.getBoundingClientRect().left) || 0}px, ${(((_c = refs.domReference.current) == null ? void 0 : _c.getBoundingClientRect().bottom) || 0) + 10}px )` : floatingStyles.transform
|
4401
4382
|
}),
|
4402
4383
|
ref: refs.setFloating,
|
4403
4384
|
className: styles.dropdownWrapper,
|
4404
4385
|
tabIndex: -1
|
4405
|
-
}, /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$
|
4386
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$n(__spreadValues$A({
|
4406
4387
|
style: {
|
4407
4388
|
height: `${rowVirtualizer.getTotalSize() || VIRTUAL_LIST_ITEM_HEIGHT}px`
|
4408
4389
|
}
|
@@ -4430,7 +4411,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4430
4411
|
}
|
4431
4412
|
const nextItem = filteredDropDownItems[virtualItem.index + 1];
|
4432
4413
|
const shouldAddBottomBorder = nextItem && !nextItem.group && !nextItem.options && item.group;
|
4433
|
-
return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, __spreadProps$
|
4414
|
+
return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, __spreadProps$n(__spreadValues$A({}, getItemProps({
|
4434
4415
|
key: `${item.value}-${index}`,
|
4435
4416
|
ref(node) {
|
4436
4417
|
listRef.current[index] = node;
|
@@ -4526,7 +4507,7 @@ const getStyles$b = (theme) => ({
|
|
4526
4507
|
alignItems: "center",
|
4527
4508
|
flexWrap: "wrap"
|
4528
4509
|
}),
|
4529
|
-
basePill: css.css(__spreadProps$
|
4510
|
+
basePill: css.css(__spreadProps$n(__spreadValues$A({
|
4530
4511
|
display: "flex",
|
4531
4512
|
alignItems: "center",
|
4532
4513
|
background: theme.colors.action.disabledBackground,
|
@@ -4593,7 +4574,7 @@ const getStyles$b = (theme) => ({
|
|
4593
4574
|
color: theme.colors.text.primary
|
4594
4575
|
}
|
4595
4576
|
}),
|
4596
|
-
descriptionText: css.css(__spreadProps$
|
4577
|
+
descriptionText: css.css(__spreadProps$n(__spreadValues$A({}, theme.typography.bodySmall), {
|
4597
4578
|
color: theme.colors.text.secondary,
|
4598
4579
|
paddingTop: theme.spacing(0.5)
|
4599
4580
|
})),
|
@@ -4606,8 +4587,8 @@ const getStyles$b = (theme) => ({
|
|
4606
4587
|
});
|
4607
4588
|
|
4608
4589
|
var __defProp$z = Object.defineProperty;
|
4609
|
-
var __defProps$
|
4610
|
-
var __getOwnPropDescs$
|
4590
|
+
var __defProps$m = Object.defineProperties;
|
4591
|
+
var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
|
4611
4592
|
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
4612
4593
|
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
4613
4594
|
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
@@ -4623,8 +4604,8 @@ var __spreadValues$z = (a, b) => {
|
|
4623
4604
|
}
|
4624
4605
|
return a;
|
4625
4606
|
};
|
4626
|
-
var __spreadProps$
|
4627
|
-
function AdHocFilterPill({ filter, model, readOnly,
|
4607
|
+
var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
|
4608
|
+
function AdHocFilterPill({ filter, model, readOnly, focusOnInputRef }) {
|
4628
4609
|
var _a, _b, _c;
|
4629
4610
|
const styles = ui.useStyles2(getStyles$a);
|
4630
4611
|
const [viewMode, setViewMode] = React.useState(true);
|
@@ -4650,12 +4631,6 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
|
|
4650
4631
|
setShouldFocus(false);
|
4651
4632
|
}
|
4652
4633
|
}, [shouldFocus]);
|
4653
|
-
React.useEffect(() => {
|
4654
|
-
if (filter.forceEdit && viewMode) {
|
4655
|
-
setViewMode(false);
|
4656
|
-
model._updateFilter(filter, { forceEdit: void 0 });
|
4657
|
-
}
|
4658
|
-
}, [filter, model, viewMode]);
|
4659
4634
|
if (viewMode) {
|
4660
4635
|
const pillText = /* @__PURE__ */ React__default["default"].createElement("span", {
|
4661
4636
|
className: styles.pillText
|
@@ -4681,14 +4656,14 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
|
|
4681
4656
|
onClick: (e) => {
|
4682
4657
|
e.stopPropagation();
|
4683
4658
|
model._removeFilter(filter);
|
4684
|
-
setTimeout(() =>
|
4659
|
+
setTimeout(() => focusOnInputRef == null ? void 0 : focusOnInputRef());
|
4685
4660
|
},
|
4686
4661
|
onKeyDownCapture: (e) => {
|
4687
4662
|
if (e.key === "Enter") {
|
4688
4663
|
e.preventDefault();
|
4689
4664
|
e.stopPropagation();
|
4690
4665
|
model._removeFilter(filter);
|
4691
|
-
setTimeout(() =>
|
4666
|
+
setTimeout(() => focusOnInputRef == null ? void 0 : focusOnInputRef());
|
4692
4667
|
}
|
4693
4668
|
},
|
4694
4669
|
name: "times",
|
@@ -4700,12 +4675,11 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
|
|
4700
4675
|
return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
|
4701
4676
|
filter,
|
4702
4677
|
model,
|
4703
|
-
handleChangeViewMode
|
4704
|
-
focusOnWipInputRef
|
4678
|
+
handleChangeViewMode
|
4705
4679
|
});
|
4706
4680
|
}
|
4707
4681
|
const getStyles$a = (theme) => ({
|
4708
|
-
combinedFilterPill: css.css(__spreadProps$
|
4682
|
+
combinedFilterPill: css.css(__spreadProps$m(__spreadValues$z({
|
4709
4683
|
display: "flex",
|
4710
4684
|
alignItems: "center",
|
4711
4685
|
background: theme.colors.action.selected,
|
@@ -4766,26 +4740,26 @@ const AdHocFiltersAlwaysWipCombobox = React.forwardRef(function AdHocFiltersAlwa
|
|
4766
4740
|
const AdHocFiltersComboboxRenderer = React.memo(function AdHocFiltersComboboxRenderer2({ model }) {
|
4767
4741
|
const { filters, readOnly } = model.useState();
|
4768
4742
|
const styles = ui.useStyles2(getStyles$9);
|
4769
|
-
const
|
4743
|
+
const focusOnInputRef = React.useRef();
|
4770
4744
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
4771
4745
|
className: css.cx(styles.comboboxWrapper, { [styles.comboboxFocusOutline]: !readOnly }),
|
4772
4746
|
onClick: () => {
|
4773
4747
|
var _a;
|
4774
|
-
(_a =
|
4748
|
+
(_a = focusOnInputRef.current) == null ? void 0 : _a.call(focusOnInputRef);
|
4775
4749
|
}
|
4776
4750
|
}, /* @__PURE__ */ React__default["default"].createElement(ui.Icon, {
|
4777
4751
|
name: "filter",
|
4778
4752
|
className: styles.filterIcon,
|
4779
4753
|
size: "lg"
|
4780
4754
|
}), filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(AdHocFilterPill, {
|
4781
|
-
key:
|
4755
|
+
key: index,
|
4782
4756
|
filter,
|
4783
4757
|
model,
|
4784
4758
|
readOnly,
|
4785
|
-
|
4759
|
+
focusOnInputRef: focusOnInputRef.current
|
4786
4760
|
})), !readOnly ? /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersAlwaysWipCombobox, {
|
4787
4761
|
model,
|
4788
|
-
ref:
|
4762
|
+
ref: focusOnInputRef
|
4789
4763
|
}) : null);
|
4790
4764
|
});
|
4791
4765
|
const getStyles$9 = (theme) => ({
|
@@ -4821,8 +4795,6 @@ const getStyles$9 = (theme) => ({
|
|
4821
4795
|
});
|
4822
4796
|
|
4823
4797
|
var __defProp$y = Object.defineProperty;
|
4824
|
-
var __defProps$m = Object.defineProperties;
|
4825
|
-
var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
|
4826
4798
|
var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
|
4827
4799
|
var __hasOwnProp$y = Object.prototype.hasOwnProperty;
|
4828
4800
|
var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
|
@@ -4838,7 +4810,6 @@ var __spreadValues$y = (a, b) => {
|
|
4838
4810
|
}
|
4839
4811
|
return a;
|
4840
4812
|
};
|
4841
|
-
var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
|
4842
4813
|
const OPERATORS = [
|
4843
4814
|
{
|
4844
4815
|
value: "=",
|
@@ -4935,31 +4906,6 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
4935
4906
|
this._removeFilter(filterToRemove);
|
4936
4907
|
}
|
4937
4908
|
}
|
4938
|
-
_handleComboboxBackspace(filter) {
|
4939
|
-
if (this.state.filters.length) {
|
4940
|
-
let filterToForceIndex = this.state.filters.length - 1;
|
4941
|
-
if (filter !== this.state._wip) {
|
4942
|
-
const filterIndex = this.state.filters.findIndex((f) => f === filter);
|
4943
|
-
filterToForceIndex = filterIndex - 1;
|
4944
|
-
}
|
4945
|
-
this.setState({
|
4946
|
-
filters: this.state.filters.reduce((acc, f, index) => {
|
4947
|
-
if (index === filterToForceIndex) {
|
4948
|
-
return [
|
4949
|
-
...acc,
|
4950
|
-
__spreadProps$m(__spreadValues$y({}, f), {
|
4951
|
-
forceEdit: true
|
4952
|
-
})
|
4953
|
-
];
|
4954
|
-
}
|
4955
|
-
if (f === filter) {
|
4956
|
-
return acc;
|
4957
|
-
}
|
4958
|
-
return [...acc, f];
|
4959
|
-
}, [])
|
4960
|
-
});
|
4961
|
-
}
|
4962
|
-
}
|
4963
4909
|
async _getKeys(currentKey) {
|
4964
4910
|
var _a, _b, _c;
|
4965
4911
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
|