@grafana/scenes 5.9.2--canary.830.10452071184.0 → 5.10.0--canary.854.10453539660.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/querying/SceneQueryRunner.js +2 -2
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
- package/dist/esm/querying/layers/annotations/AnnotationsDataLayer.js +2 -2
- package/dist/esm/querying/layers/annotations/AnnotationsDataLayer.js.map +1 -1
- package/dist/esm/querying/layers/annotations/standardAnnotationQuery.js +2 -2
- package/dist/esm/querying/layers/annotations/standardAnnotationQuery.js.map +1 -1
- package/dist/esm/utils/wrapInSafeSerializableSceneObject.js +30 -0
- package/dist/esm/utils/wrapInSafeSerializableSceneObject.js.map +1 -0
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +6 -14
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +2 -2
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/variables/variants/query/QueryVariable.js +3 -3
- package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +234 -803
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +0 -387
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +0 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxEditSwitch.js +0 -113
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxEditSwitch.js.map +0 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js +0 -63
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js.map +0 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/DropdownItem.js +0 -53
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/DropdownItem.js.map +0 -1
package/dist/index.js
CHANGED
@@ -14,9 +14,6 @@ var ui = require('@grafana/ui');
|
|
14
14
|
var e2eSelectors = require('@grafana/e2e-selectors');
|
15
15
|
var css = require('@emotion/css');
|
16
16
|
var uFuzzy = require('@leeoniya/ufuzzy');
|
17
|
-
var react = require('@floating-ui/react');
|
18
|
-
var reactDom = require('react-dom');
|
19
|
-
var reactVirtual = require('@tanstack/react-virtual');
|
20
17
|
var reactUse = require('react-use');
|
21
18
|
var operators = require('rxjs/operators');
|
22
19
|
var ReactGridLayout = require('react-grid-layout');
|
@@ -42,19 +39,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
42
39
|
var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
|
43
40
|
var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
|
44
41
|
|
45
|
-
var __defProp$
|
46
|
-
var __getOwnPropSymbols$
|
47
|
-
var __hasOwnProp$
|
48
|
-
var __propIsEnum$
|
49
|
-
var __defNormalProp$
|
50
|
-
var __spreadValues$
|
42
|
+
var __defProp$K = Object.defineProperty;
|
43
|
+
var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
|
44
|
+
var __hasOwnProp$K = Object.prototype.hasOwnProperty;
|
45
|
+
var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
|
46
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
47
|
+
var __spreadValues$K = (a, b) => {
|
51
48
|
for (var prop in b || (b = {}))
|
52
|
-
if (__hasOwnProp$
|
53
|
-
__defNormalProp$
|
54
|
-
if (__getOwnPropSymbols$
|
55
|
-
for (var prop of __getOwnPropSymbols$
|
56
|
-
if (__propIsEnum$
|
57
|
-
__defNormalProp$
|
49
|
+
if (__hasOwnProp$K.call(b, prop))
|
50
|
+
__defNormalProp$K(a, prop, b[prop]);
|
51
|
+
if (__getOwnPropSymbols$K)
|
52
|
+
for (var prop of __getOwnPropSymbols$K(b)) {
|
53
|
+
if (__propIsEnum$K.call(b, prop))
|
54
|
+
__defNormalProp$K(a, prop, b[prop]);
|
58
55
|
}
|
59
56
|
return a;
|
60
57
|
};
|
@@ -63,7 +60,7 @@ function useAppQueryParams() {
|
|
63
60
|
return runtime.locationSearchToObject(location.search || "");
|
64
61
|
}
|
65
62
|
function getUrlWithAppState(path, preserveParams) {
|
66
|
-
const paramsCopy = __spreadValues$
|
63
|
+
const paramsCopy = __spreadValues$K({}, runtime.locationService.getSearchObject());
|
67
64
|
if (preserveParams) {
|
68
65
|
for (const key of Object.keys(paramsCopy)) {
|
69
66
|
if (!preserveParams.includes(key)) {
|
@@ -77,31 +74,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
|
|
77
74
|
return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
|
78
75
|
}
|
79
76
|
|
80
|
-
var __defProp$
|
81
|
-
var __defProps$
|
82
|
-
var __getOwnPropDescs$
|
83
|
-
var __getOwnPropSymbols$
|
84
|
-
var __hasOwnProp$
|
85
|
-
var __propIsEnum$
|
86
|
-
var __defNormalProp$
|
87
|
-
var __spreadValues$
|
77
|
+
var __defProp$J = Object.defineProperty;
|
78
|
+
var __defProps$t = Object.defineProperties;
|
79
|
+
var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
|
80
|
+
var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
|
81
|
+
var __hasOwnProp$J = Object.prototype.hasOwnProperty;
|
82
|
+
var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
|
83
|
+
var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
84
|
+
var __spreadValues$J = (a, b) => {
|
88
85
|
for (var prop in b || (b = {}))
|
89
|
-
if (__hasOwnProp$
|
90
|
-
__defNormalProp$
|
91
|
-
if (__getOwnPropSymbols$
|
92
|
-
for (var prop of __getOwnPropSymbols$
|
93
|
-
if (__propIsEnum$
|
94
|
-
__defNormalProp$
|
86
|
+
if (__hasOwnProp$J.call(b, prop))
|
87
|
+
__defNormalProp$J(a, prop, b[prop]);
|
88
|
+
if (__getOwnPropSymbols$J)
|
89
|
+
for (var prop of __getOwnPropSymbols$J(b)) {
|
90
|
+
if (__propIsEnum$J.call(b, prop))
|
91
|
+
__defNormalProp$J(a, prop, b[prop]);
|
95
92
|
}
|
96
93
|
return a;
|
97
94
|
};
|
98
|
-
var __spreadProps$
|
95
|
+
var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
|
99
96
|
const runtimePanelPlugins = /* @__PURE__ */ new Map();
|
100
97
|
function registerRuntimePanelPlugin({ pluginId, plugin }) {
|
101
98
|
if (runtimePanelPlugins.has(pluginId)) {
|
102
99
|
throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
|
103
100
|
}
|
104
|
-
plugin.meta = __spreadProps$
|
101
|
+
plugin.meta = __spreadProps$t(__spreadValues$J({}, plugin.meta), {
|
105
102
|
id: pluginId,
|
106
103
|
name: pluginId,
|
107
104
|
module: "runtime plugin",
|
@@ -129,39 +126,39 @@ function loadPanelPluginSync(pluginId) {
|
|
129
126
|
return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
|
130
127
|
}
|
131
128
|
|
132
|
-
var __defProp$
|
133
|
-
var __defProps$
|
134
|
-
var __getOwnPropDescs$
|
135
|
-
var __getOwnPropSymbols$
|
136
|
-
var __hasOwnProp$
|
137
|
-
var __propIsEnum$
|
138
|
-
var __defNormalProp$
|
139
|
-
var __spreadValues$
|
129
|
+
var __defProp$I = Object.defineProperty;
|
130
|
+
var __defProps$s = Object.defineProperties;
|
131
|
+
var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
|
132
|
+
var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
|
133
|
+
var __hasOwnProp$I = Object.prototype.hasOwnProperty;
|
134
|
+
var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
|
135
|
+
var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
136
|
+
var __spreadValues$I = (a, b) => {
|
140
137
|
for (var prop in b || (b = {}))
|
141
|
-
if (__hasOwnProp$
|
142
|
-
__defNormalProp$
|
143
|
-
if (__getOwnPropSymbols$
|
144
|
-
for (var prop of __getOwnPropSymbols$
|
145
|
-
if (__propIsEnum$
|
146
|
-
__defNormalProp$
|
138
|
+
if (__hasOwnProp$I.call(b, prop))
|
139
|
+
__defNormalProp$I(a, prop, b[prop]);
|
140
|
+
if (__getOwnPropSymbols$I)
|
141
|
+
for (var prop of __getOwnPropSymbols$I(b)) {
|
142
|
+
if (__propIsEnum$I.call(b, prop))
|
143
|
+
__defNormalProp$I(a, prop, b[prop]);
|
147
144
|
}
|
148
145
|
return a;
|
149
146
|
};
|
150
|
-
var __spreadProps$
|
151
|
-
var __objRest$
|
147
|
+
var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
|
148
|
+
var __objRest$4 = (source, exclude) => {
|
152
149
|
var target = {};
|
153
150
|
for (var prop in source)
|
154
|
-
if (__hasOwnProp$
|
151
|
+
if (__hasOwnProp$I.call(source, prop) && exclude.indexOf(prop) < 0)
|
155
152
|
target[prop] = source[prop];
|
156
|
-
if (source != null && __getOwnPropSymbols$
|
157
|
-
for (var prop of __getOwnPropSymbols$
|
158
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
153
|
+
if (source != null && __getOwnPropSymbols$I)
|
154
|
+
for (var prop of __getOwnPropSymbols$I(source)) {
|
155
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$I.call(source, prop))
|
159
156
|
target[prop] = source[prop];
|
160
157
|
}
|
161
158
|
return target;
|
162
159
|
};
|
163
160
|
function SceneComponentWrapperWithoutMemo(_a) {
|
164
|
-
var _b = _a, { model } = _b, otherProps = __objRest$
|
161
|
+
var _b = _a, { model } = _b, otherProps = __objRest$4(_b, ["model"]);
|
165
162
|
var _a2;
|
166
163
|
const Component = (_a2 = model.constructor["Component"]) != null ? _a2 : EmptyRenderer;
|
167
164
|
const [_, setValue] = React.useState(0);
|
@@ -173,7 +170,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
|
|
173
170
|
if (!model.isActive) {
|
174
171
|
return null;
|
175
172
|
}
|
176
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$
|
173
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$s(__spreadValues$I({}, otherProps), {
|
177
174
|
model
|
178
175
|
}));
|
179
176
|
}
|
@@ -219,19 +216,19 @@ class SceneObjectRef {
|
|
219
216
|
}
|
220
217
|
_ref = new WeakMap();
|
221
218
|
|
222
|
-
var __defProp$
|
223
|
-
var __getOwnPropSymbols$
|
224
|
-
var __hasOwnProp$
|
225
|
-
var __propIsEnum$
|
226
|
-
var __defNormalProp$
|
227
|
-
var __spreadValues$
|
219
|
+
var __defProp$H = Object.defineProperty;
|
220
|
+
var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
|
221
|
+
var __hasOwnProp$H = Object.prototype.hasOwnProperty;
|
222
|
+
var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
|
223
|
+
var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
224
|
+
var __spreadValues$H = (a, b) => {
|
228
225
|
for (var prop in b || (b = {}))
|
229
|
-
if (__hasOwnProp$
|
230
|
-
__defNormalProp$
|
231
|
-
if (__getOwnPropSymbols$
|
232
|
-
for (var prop of __getOwnPropSymbols$
|
233
|
-
if (__propIsEnum$
|
234
|
-
__defNormalProp$
|
226
|
+
if (__hasOwnProp$H.call(b, prop))
|
227
|
+
__defNormalProp$H(a, prop, b[prop]);
|
228
|
+
if (__getOwnPropSymbols$H)
|
229
|
+
for (var prop of __getOwnPropSymbols$H(b)) {
|
230
|
+
if (__propIsEnum$H.call(b, prop))
|
231
|
+
__defNormalProp$H(a, prop, b[prop]);
|
235
232
|
}
|
236
233
|
return a;
|
237
234
|
};
|
@@ -291,7 +288,7 @@ class SceneObjectBase {
|
|
291
288
|
}
|
292
289
|
setState(update) {
|
293
290
|
const prevState = this._state;
|
294
|
-
const newState = __spreadValues$
|
291
|
+
const newState = __spreadValues$H(__spreadValues$H({}, this._state), update);
|
295
292
|
this._state = Object.freeze(newState);
|
296
293
|
this._setParent(update);
|
297
294
|
this._handleActivationOfChangedStateProps(prevState, newState);
|
@@ -487,19 +484,19 @@ function forEachChild(state, callback) {
|
|
487
484
|
}
|
488
485
|
}
|
489
486
|
|
490
|
-
var __defProp$
|
491
|
-
var __getOwnPropSymbols$
|
492
|
-
var __hasOwnProp$
|
493
|
-
var __propIsEnum$
|
494
|
-
var __defNormalProp$
|
495
|
-
var __spreadValues$
|
487
|
+
var __defProp$G = Object.defineProperty;
|
488
|
+
var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
|
489
|
+
var __hasOwnProp$G = Object.prototype.hasOwnProperty;
|
490
|
+
var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
|
491
|
+
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
492
|
+
var __spreadValues$G = (a, b) => {
|
496
493
|
for (var prop in b || (b = {}))
|
497
|
-
if (__hasOwnProp$
|
498
|
-
__defNormalProp$
|
499
|
-
if (__getOwnPropSymbols$
|
500
|
-
for (var prop of __getOwnPropSymbols$
|
501
|
-
if (__propIsEnum$
|
502
|
-
__defNormalProp$
|
494
|
+
if (__hasOwnProp$G.call(b, prop))
|
495
|
+
__defNormalProp$G(a, prop, b[prop]);
|
496
|
+
if (__getOwnPropSymbols$G)
|
497
|
+
for (var prop of __getOwnPropSymbols$G(b)) {
|
498
|
+
if (__propIsEnum$G.call(b, prop))
|
499
|
+
__defNormalProp$G(a, prop, b[prop]);
|
503
500
|
}
|
504
501
|
return a;
|
505
502
|
};
|
@@ -508,7 +505,7 @@ function cloneSceneObject(sceneObject, withState) {
|
|
508
505
|
return new sceneObject.constructor(clonedState);
|
509
506
|
}
|
510
507
|
function cloneSceneObjectState(sceneState, withState) {
|
511
|
-
const clonedState = __spreadValues$
|
508
|
+
const clonedState = __spreadValues$G({}, sceneState);
|
512
509
|
for (const key in clonedState) {
|
513
510
|
const propValue = clonedState[key];
|
514
511
|
if (propValue instanceof SceneObjectBase) {
|
@@ -605,25 +602,25 @@ function lookupVariable(name, sceneObject) {
|
|
605
602
|
return null;
|
606
603
|
}
|
607
604
|
|
608
|
-
var __defProp$
|
609
|
-
var __getOwnPropSymbols$
|
610
|
-
var __hasOwnProp$
|
611
|
-
var __propIsEnum$
|
612
|
-
var __defNormalProp$
|
613
|
-
var __spreadValues$
|
605
|
+
var __defProp$F = Object.defineProperty;
|
606
|
+
var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
|
607
|
+
var __hasOwnProp$F = Object.prototype.hasOwnProperty;
|
608
|
+
var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
|
609
|
+
var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
610
|
+
var __spreadValues$F = (a, b) => {
|
614
611
|
for (var prop in b || (b = {}))
|
615
|
-
if (__hasOwnProp$
|
616
|
-
__defNormalProp$
|
617
|
-
if (__getOwnPropSymbols$
|
618
|
-
for (var prop of __getOwnPropSymbols$
|
619
|
-
if (__propIsEnum$
|
620
|
-
__defNormalProp$
|
612
|
+
if (__hasOwnProp$F.call(b, prop))
|
613
|
+
__defNormalProp$F(a, prop, b[prop]);
|
614
|
+
if (__getOwnPropSymbols$F)
|
615
|
+
for (var prop of __getOwnPropSymbols$F(b)) {
|
616
|
+
if (__propIsEnum$F.call(b, prop))
|
617
|
+
__defNormalProp$F(a, prop, b[prop]);
|
621
618
|
}
|
622
619
|
return a;
|
623
620
|
};
|
624
621
|
class SceneDataNode extends SceneObjectBase {
|
625
622
|
constructor(state) {
|
626
|
-
super(__spreadValues$
|
623
|
+
super(__spreadValues$F({
|
627
624
|
data: emptyPanelData
|
628
625
|
}, state));
|
629
626
|
}
|
@@ -704,19 +701,19 @@ function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
|
|
704
701
|
};
|
705
702
|
}
|
706
703
|
|
707
|
-
var __defProp$
|
708
|
-
var __getOwnPropSymbols$
|
709
|
-
var __hasOwnProp$
|
710
|
-
var __propIsEnum$
|
711
|
-
var __defNormalProp$
|
712
|
-
var __spreadValues$
|
704
|
+
var __defProp$E = Object.defineProperty;
|
705
|
+
var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
|
706
|
+
var __hasOwnProp$E = Object.prototype.hasOwnProperty;
|
707
|
+
var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
|
708
|
+
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
709
|
+
var __spreadValues$E = (a, b) => {
|
713
710
|
for (var prop in b || (b = {}))
|
714
|
-
if (__hasOwnProp$
|
715
|
-
__defNormalProp$
|
716
|
-
if (__getOwnPropSymbols$
|
717
|
-
for (var prop of __getOwnPropSymbols$
|
718
|
-
if (__propIsEnum$
|
719
|
-
__defNormalProp$
|
711
|
+
if (__hasOwnProp$E.call(b, prop))
|
712
|
+
__defNormalProp$E(a, prop, b[prop]);
|
713
|
+
if (__getOwnPropSymbols$E)
|
714
|
+
for (var prop of __getOwnPropSymbols$E(b)) {
|
715
|
+
if (__propIsEnum$E.call(b, prop))
|
716
|
+
__defNormalProp$E(a, prop, b[prop]);
|
720
717
|
}
|
721
718
|
return a;
|
722
719
|
};
|
@@ -734,7 +731,7 @@ class SceneTimeRange extends SceneObjectBase {
|
|
734
731
|
state.UNSAFE_nowDelay
|
735
732
|
);
|
736
733
|
const refreshOnActivate = (_c = state.refreshOnActivate) != null ? _c : { percent: 10 };
|
737
|
-
super(__spreadValues$
|
734
|
+
super(__spreadValues$E({ from, to, timeZone, value, refreshOnActivate }, state));
|
738
735
|
this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone"] });
|
739
736
|
this.onTimeRangeChange = (timeRange) => {
|
740
737
|
const update = {};
|
@@ -1401,25 +1398,25 @@ function collectAllVariables(sceneObject, record = {}) {
|
|
1401
1398
|
return record;
|
1402
1399
|
}
|
1403
1400
|
|
1404
|
-
var __defProp$
|
1405
|
-
var __defProps$
|
1406
|
-
var __getOwnPropDescs$
|
1407
|
-
var __getOwnPropSymbols$
|
1408
|
-
var __hasOwnProp$
|
1409
|
-
var __propIsEnum$
|
1410
|
-
var __defNormalProp$
|
1411
|
-
var __spreadValues$
|
1401
|
+
var __defProp$D = Object.defineProperty;
|
1402
|
+
var __defProps$r = Object.defineProperties;
|
1403
|
+
var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
|
1404
|
+
var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
|
1405
|
+
var __hasOwnProp$D = Object.prototype.hasOwnProperty;
|
1406
|
+
var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
|
1407
|
+
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
1408
|
+
var __spreadValues$D = (a, b) => {
|
1412
1409
|
for (var prop in b || (b = {}))
|
1413
|
-
if (__hasOwnProp$
|
1414
|
-
__defNormalProp$
|
1415
|
-
if (__getOwnPropSymbols$
|
1416
|
-
for (var prop of __getOwnPropSymbols$
|
1417
|
-
if (__propIsEnum$
|
1418
|
-
__defNormalProp$
|
1410
|
+
if (__hasOwnProp$D.call(b, prop))
|
1411
|
+
__defNormalProp$D(a, prop, b[prop]);
|
1412
|
+
if (__getOwnPropSymbols$D)
|
1413
|
+
for (var prop of __getOwnPropSymbols$D(b)) {
|
1414
|
+
if (__propIsEnum$D.call(b, prop))
|
1415
|
+
__defNormalProp$D(a, prop, b[prop]);
|
1419
1416
|
}
|
1420
1417
|
return a;
|
1421
1418
|
};
|
1422
|
-
var __spreadProps$
|
1419
|
+
var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
|
1423
1420
|
function getTemplateProxyForField(field, frame, frames) {
|
1424
1421
|
return new Proxy(
|
1425
1422
|
{},
|
@@ -1435,7 +1432,7 @@ function getTemplateProxyForField(field, frame, frames) {
|
|
1435
1432
|
if (!field.labels) {
|
1436
1433
|
return "";
|
1437
1434
|
}
|
1438
|
-
return __spreadProps$
|
1435
|
+
return __spreadProps$r(__spreadValues$D({}, field.labels), {
|
1439
1436
|
__values: Object.values(field.labels).sort().join(", "),
|
1440
1437
|
toString: () => {
|
1441
1438
|
return data.formatLabels(field.labels, "", true);
|
@@ -1932,25 +1929,25 @@ function isExtraQueryProvider(obj) {
|
|
1932
1929
|
return typeof obj === "object" && "getExtraQueries" in obj;
|
1933
1930
|
}
|
1934
1931
|
|
1935
|
-
var __defProp$
|
1936
|
-
var __defProps$
|
1937
|
-
var __getOwnPropDescs$
|
1938
|
-
var __getOwnPropSymbols$
|
1939
|
-
var __hasOwnProp$
|
1940
|
-
var __propIsEnum$
|
1941
|
-
var __defNormalProp$
|
1942
|
-
var __spreadValues$
|
1932
|
+
var __defProp$C = Object.defineProperty;
|
1933
|
+
var __defProps$q = Object.defineProperties;
|
1934
|
+
var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
|
1935
|
+
var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
|
1936
|
+
var __hasOwnProp$C = Object.prototype.hasOwnProperty;
|
1937
|
+
var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
|
1938
|
+
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
1939
|
+
var __spreadValues$C = (a, b) => {
|
1943
1940
|
for (var prop in b || (b = {}))
|
1944
|
-
if (__hasOwnProp$
|
1945
|
-
__defNormalProp$
|
1946
|
-
if (__getOwnPropSymbols$
|
1947
|
-
for (var prop of __getOwnPropSymbols$
|
1948
|
-
if (__propIsEnum$
|
1949
|
-
__defNormalProp$
|
1941
|
+
if (__hasOwnProp$C.call(b, prop))
|
1942
|
+
__defNormalProp$C(a, prop, b[prop]);
|
1943
|
+
if (__getOwnPropSymbols$C)
|
1944
|
+
for (var prop of __getOwnPropSymbols$C(b)) {
|
1945
|
+
if (__propIsEnum$C.call(b, prop))
|
1946
|
+
__defNormalProp$C(a, prop, b[prop]);
|
1950
1947
|
}
|
1951
1948
|
return a;
|
1952
1949
|
};
|
1953
|
-
var __spreadProps$
|
1950
|
+
var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
|
1954
1951
|
const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
|
1955
1952
|
const extraQueryProcessingOperator = (processors) => (data) => {
|
1956
1953
|
return data.pipe(
|
@@ -1963,7 +1960,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
|
|
1963
1960
|
}),
|
1964
1961
|
rxjs.map(([primary, ...processedSecondaries]) => {
|
1965
1962
|
var _a;
|
1966
|
-
return __spreadProps$
|
1963
|
+
return __spreadProps$q(__spreadValues$C({}, primary), {
|
1967
1964
|
series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
|
1968
1965
|
annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
|
1969
1966
|
var _a2;
|
@@ -1974,25 +1971,25 @@ const extraQueryProcessingOperator = (processors) => (data) => {
|
|
1974
1971
|
);
|
1975
1972
|
};
|
1976
1973
|
|
1977
|
-
var __defProp$
|
1978
|
-
var __defProps$
|
1979
|
-
var __getOwnPropDescs$
|
1980
|
-
var __getOwnPropSymbols$
|
1981
|
-
var __hasOwnProp$
|
1982
|
-
var __propIsEnum$
|
1983
|
-
var __defNormalProp$
|
1984
|
-
var __spreadValues$
|
1974
|
+
var __defProp$B = Object.defineProperty;
|
1975
|
+
var __defProps$p = Object.defineProperties;
|
1976
|
+
var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
|
1977
|
+
var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
|
1978
|
+
var __hasOwnProp$B = Object.prototype.hasOwnProperty;
|
1979
|
+
var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
|
1980
|
+
var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
1981
|
+
var __spreadValues$B = (a, b) => {
|
1985
1982
|
for (var prop in b || (b = {}))
|
1986
|
-
if (__hasOwnProp$
|
1987
|
-
__defNormalProp$
|
1988
|
-
if (__getOwnPropSymbols$
|
1989
|
-
for (var prop of __getOwnPropSymbols$
|
1990
|
-
if (__propIsEnum$
|
1991
|
-
__defNormalProp$
|
1983
|
+
if (__hasOwnProp$B.call(b, prop))
|
1984
|
+
__defNormalProp$B(a, prop, b[prop]);
|
1985
|
+
if (__getOwnPropSymbols$B)
|
1986
|
+
for (var prop of __getOwnPropSymbols$B(b)) {
|
1987
|
+
if (__propIsEnum$B.call(b, prop))
|
1988
|
+
__defNormalProp$B(a, prop, b[prop]);
|
1992
1989
|
}
|
1993
1990
|
return a;
|
1994
1991
|
};
|
1995
|
-
var __spreadProps$
|
1992
|
+
var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
|
1996
1993
|
function filterAnnotations(data, filters) {
|
1997
1994
|
var _a;
|
1998
1995
|
if (!Array.isArray(data) || data.length === 0) {
|
@@ -2043,11 +2040,11 @@ function filterAnnotations(data, filters) {
|
|
2043
2040
|
continue;
|
2044
2041
|
}
|
2045
2042
|
}
|
2046
|
-
fields.push(__spreadProps$
|
2043
|
+
fields.push(__spreadProps$p(__spreadValues$B({}, field), {
|
2047
2044
|
values: buffer
|
2048
2045
|
}));
|
2049
2046
|
}
|
2050
|
-
processed.push(__spreadProps$
|
2047
|
+
processed.push(__spreadProps$p(__spreadValues$B({}, frame), {
|
2051
2048
|
fields,
|
2052
2049
|
length: frameLength
|
2053
2050
|
}));
|
@@ -2478,33 +2475,33 @@ function getOptionSearcher(options, includeAll) {
|
|
2478
2475
|
};
|
2479
2476
|
}
|
2480
2477
|
|
2481
|
-
var __defProp$
|
2482
|
-
var __defProps$
|
2483
|
-
var __getOwnPropDescs$
|
2484
|
-
var __getOwnPropSymbols$
|
2485
|
-
var __hasOwnProp$
|
2486
|
-
var __propIsEnum$
|
2487
|
-
var __defNormalProp$
|
2488
|
-
var __spreadValues$
|
2478
|
+
var __defProp$A = Object.defineProperty;
|
2479
|
+
var __defProps$o = Object.defineProperties;
|
2480
|
+
var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
|
2481
|
+
var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
|
2482
|
+
var __hasOwnProp$A = Object.prototype.hasOwnProperty;
|
2483
|
+
var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
|
2484
|
+
var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2485
|
+
var __spreadValues$A = (a, b) => {
|
2489
2486
|
for (var prop in b || (b = {}))
|
2490
|
-
if (__hasOwnProp$
|
2491
|
-
__defNormalProp$
|
2492
|
-
if (__getOwnPropSymbols$
|
2493
|
-
for (var prop of __getOwnPropSymbols$
|
2494
|
-
if (__propIsEnum$
|
2495
|
-
__defNormalProp$
|
2496
|
-
}
|
2497
|
-
return a;
|
2498
|
-
};
|
2499
|
-
var __spreadProps$
|
2500
|
-
var __objRest$
|
2487
|
+
if (__hasOwnProp$A.call(b, prop))
|
2488
|
+
__defNormalProp$A(a, prop, b[prop]);
|
2489
|
+
if (__getOwnPropSymbols$A)
|
2490
|
+
for (var prop of __getOwnPropSymbols$A(b)) {
|
2491
|
+
if (__propIsEnum$A.call(b, prop))
|
2492
|
+
__defNormalProp$A(a, prop, b[prop]);
|
2493
|
+
}
|
2494
|
+
return a;
|
2495
|
+
};
|
2496
|
+
var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
|
2497
|
+
var __objRest$3 = (source, exclude) => {
|
2501
2498
|
var target = {};
|
2502
2499
|
for (var prop in source)
|
2503
|
-
if (__hasOwnProp$
|
2500
|
+
if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
|
2504
2501
|
target[prop] = source[prop];
|
2505
|
-
if (source != null && __getOwnPropSymbols$
|
2506
|
-
for (var prop of __getOwnPropSymbols$
|
2507
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
2502
|
+
if (source != null && __getOwnPropSymbols$A)
|
2503
|
+
for (var prop of __getOwnPropSymbols$A(source)) {
|
2504
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
|
2508
2505
|
target[prop] = source[prop];
|
2509
2506
|
}
|
2510
2507
|
return target;
|
@@ -2632,11 +2629,11 @@ const OptionWithCheckbox = ({
|
|
2632
2629
|
renderOptionLabel
|
2633
2630
|
}) => {
|
2634
2631
|
var _b;
|
2635
|
-
const _a = innerProps, rest = __objRest$
|
2632
|
+
const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
|
2636
2633
|
const theme = ui.useTheme2();
|
2637
2634
|
const selectStyles = ui.getSelectStyles(theme);
|
2638
2635
|
const optionStyles = ui.useStyles2(getOptionStyles);
|
2639
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$
|
2636
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
|
2640
2637
|
ref: innerRef,
|
2641
2638
|
className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
|
2642
2639
|
}, rest), {
|
@@ -2775,28 +2772,53 @@ class SafeSerializableSceneObject {
|
|
2775
2772
|
}
|
2776
2773
|
_value = new WeakMap();
|
2777
2774
|
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2775
|
+
function shouldWrapInSafeSerializableSceneObject(grafanaVersion) {
|
2776
|
+
const pattern = /^(\d+)\.(\d+)\.(\d+)/;
|
2777
|
+
const match = grafanaVersion.match(pattern);
|
2778
|
+
if (!match) {
|
2779
|
+
return false;
|
2780
|
+
}
|
2781
|
+
const major = parseInt(match[1], 10);
|
2782
|
+
const minor = parseInt(match[2], 10);
|
2783
|
+
const patch = parseInt(match[3], 10);
|
2784
|
+
if (major === 11) {
|
2785
|
+
return minor === 0 && patch >= 4 || minor === 1 && patch >= 2 || minor > 1;
|
2786
|
+
}
|
2787
|
+
if (major === 10) {
|
2788
|
+
return minor === 4 && patch >= 8 || minor >= 5;
|
2789
|
+
}
|
2790
|
+
return major > 11;
|
2791
|
+
}
|
2792
|
+
function wrapInSafeSerializableSceneObject(sceneObject) {
|
2793
|
+
const version = runtime.config.buildInfo.version;
|
2794
|
+
if (shouldWrapInSafeSerializableSceneObject(version)) {
|
2795
|
+
return new SafeSerializableSceneObject(sceneObject);
|
2796
|
+
}
|
2797
|
+
return { value: sceneObject, text: "__sceneObject" };
|
2798
|
+
}
|
2799
|
+
|
2800
|
+
var __defProp$z = Object.defineProperty;
|
2801
|
+
var __defProps$n = Object.defineProperties;
|
2802
|
+
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
2803
|
+
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
2804
|
+
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
2805
|
+
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
2806
|
+
var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2807
|
+
var __spreadValues$z = (a, b) => {
|
2786
2808
|
for (var prop in b || (b = {}))
|
2787
|
-
if (__hasOwnProp$
|
2788
|
-
__defNormalProp$
|
2789
|
-
if (__getOwnPropSymbols$
|
2790
|
-
for (var prop of __getOwnPropSymbols$
|
2791
|
-
if (__propIsEnum$
|
2792
|
-
__defNormalProp$
|
2809
|
+
if (__hasOwnProp$z.call(b, prop))
|
2810
|
+
__defNormalProp$z(a, prop, b[prop]);
|
2811
|
+
if (__getOwnPropSymbols$z)
|
2812
|
+
for (var prop of __getOwnPropSymbols$z(b)) {
|
2813
|
+
if (__propIsEnum$z.call(b, prop))
|
2814
|
+
__defNormalProp$z(a, prop, b[prop]);
|
2793
2815
|
}
|
2794
2816
|
return a;
|
2795
2817
|
};
|
2796
|
-
var __spreadProps$
|
2818
|
+
var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
|
2797
2819
|
class GroupByVariable extends MultiValueVariable {
|
2798
2820
|
constructor(initialState) {
|
2799
|
-
super(__spreadProps$
|
2821
|
+
super(__spreadProps$n(__spreadValues$z({
|
2800
2822
|
isMulti: true,
|
2801
2823
|
name: "",
|
2802
2824
|
value: [],
|
@@ -2827,7 +2849,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
2827
2849
|
const queries = getQueriesForVariables(this);
|
2828
2850
|
const otherFilters = this.state.baseFilters || [];
|
2829
2851
|
const timeRange = sceneGraph.getTimeRange(this).state.value;
|
2830
|
-
const response = await ds.getTagKeys(__spreadValues$
|
2852
|
+
const response = await ds.getTagKeys(__spreadValues$z({
|
2831
2853
|
filters: otherFilters,
|
2832
2854
|
queries,
|
2833
2855
|
timeRange
|
@@ -2881,7 +2903,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
2881
2903
|
this.setState({ loading: true, error: null });
|
2882
2904
|
return rxjs.from(
|
2883
2905
|
getDataSource(this.state.datasource, {
|
2884
|
-
__sceneObject:
|
2906
|
+
__sceneObject: wrapInSafeSerializableSceneObject(this)
|
2885
2907
|
})
|
2886
2908
|
).pipe(
|
2887
2909
|
rxjs.mergeMap((ds) => {
|
@@ -3022,7 +3044,7 @@ function LoadingIndicator(props) {
|
|
3022
3044
|
}
|
3023
3045
|
|
3024
3046
|
function ControlsLabel(props) {
|
3025
|
-
const styles = ui.useStyles2(getStyles$
|
3047
|
+
const styles = ui.useStyles2(getStyles$a);
|
3026
3048
|
const theme = ui.useTheme2();
|
3027
3049
|
const isVertical = props.layout === "vertical";
|
3028
3050
|
const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
@@ -3085,7 +3107,7 @@ function ControlsLabel(props) {
|
|
3085
3107
|
}
|
3086
3108
|
return labelElement;
|
3087
3109
|
}
|
3088
|
-
const getStyles$
|
3110
|
+
const getStyles$a = (theme) => ({
|
3089
3111
|
horizontalLabel: css.css({
|
3090
3112
|
background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
|
3091
3113
|
display: `flex`,
|
@@ -3165,7 +3187,7 @@ function keyLabelToOption(key, label) {
|
|
3165
3187
|
const filterNoOp = () => true;
|
3166
3188
|
function AdHocFilterRenderer({ filter, model }) {
|
3167
3189
|
var _a, _b;
|
3168
|
-
const styles = ui.useStyles2(getStyles$
|
3190
|
+
const styles = ui.useStyles2(getStyles$9);
|
3169
3191
|
const [keys, setKeys] = React.useState([]);
|
3170
3192
|
const [values, setValues] = React.useState([]);
|
3171
3193
|
const [isKeysLoading, setIsKeysLoading] = React.useState(false);
|
@@ -3307,7 +3329,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3307
3329
|
onClick: () => model._removeFilter(filter)
|
3308
3330
|
}));
|
3309
3331
|
}
|
3310
|
-
const getStyles$
|
3332
|
+
const getStyles$9 = (theme) => ({
|
3311
3333
|
field: css.css({
|
3312
3334
|
marginBottom: 0
|
3313
3335
|
}),
|
@@ -3445,590 +3467,6 @@ function isFilter(filter) {
|
|
3445
3467
|
return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
|
3446
3468
|
}
|
3447
3469
|
|
3448
|
-
var __defProp$B = Object.defineProperty;
|
3449
|
-
var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
|
3450
|
-
var __hasOwnProp$B = Object.prototype.hasOwnProperty;
|
3451
|
-
var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
|
3452
|
-
var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3453
|
-
var __spreadValues$B = (a, b) => {
|
3454
|
-
for (var prop in b || (b = {}))
|
3455
|
-
if (__hasOwnProp$B.call(b, prop))
|
3456
|
-
__defNormalProp$B(a, prop, b[prop]);
|
3457
|
-
if (__getOwnPropSymbols$B)
|
3458
|
-
for (var prop of __getOwnPropSymbols$B(b)) {
|
3459
|
-
if (__propIsEnum$B.call(b, prop))
|
3460
|
-
__defNormalProp$B(a, prop, b[prop]);
|
3461
|
-
}
|
3462
|
-
return a;
|
3463
|
-
};
|
3464
|
-
var __objRest$3 = (source, exclude) => {
|
3465
|
-
var target = {};
|
3466
|
-
for (var prop in source)
|
3467
|
-
if (__hasOwnProp$B.call(source, prop) && exclude.indexOf(prop) < 0)
|
3468
|
-
target[prop] = source[prop];
|
3469
|
-
if (source != null && __getOwnPropSymbols$B)
|
3470
|
-
for (var prop of __getOwnPropSymbols$B(source)) {
|
3471
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$B.call(source, prop))
|
3472
|
-
target[prop] = source[prop];
|
3473
|
-
}
|
3474
|
-
return target;
|
3475
|
-
};
|
3476
|
-
const DropdownItem = React.forwardRef(
|
3477
|
-
function DropdownItem2(_a, ref) {
|
3478
|
-
var _b = _a, { children, active } = _b, rest = __objRest$3(_b, ["children", "active"]);
|
3479
|
-
const theme = ui.useTheme2();
|
3480
|
-
const selectStyles = ui.getSelectStyles(theme);
|
3481
|
-
const id = React.useId();
|
3482
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$B({
|
3483
|
-
ref,
|
3484
|
-
role: "option",
|
3485
|
-
id,
|
3486
|
-
"aria-selected": active,
|
3487
|
-
className: css.cx(selectStyles.option, active && selectStyles.optionFocused)
|
3488
|
-
}, rest), /* @__PURE__ */ React__default["default"].createElement("div", {
|
3489
|
-
className: selectStyles.optionBody,
|
3490
|
-
"data-testid": `data-testid ad hoc filter option value ${children}`
|
3491
|
-
}, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
|
3492
|
-
}
|
3493
|
-
);
|
3494
|
-
|
3495
|
-
var __defProp$A = Object.defineProperty;
|
3496
|
-
var __defProps$o = Object.defineProperties;
|
3497
|
-
var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
|
3498
|
-
var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
|
3499
|
-
var __hasOwnProp$A = Object.prototype.hasOwnProperty;
|
3500
|
-
var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
|
3501
|
-
var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3502
|
-
var __spreadValues$A = (a, b) => {
|
3503
|
-
for (var prop in b || (b = {}))
|
3504
|
-
if (__hasOwnProp$A.call(b, prop))
|
3505
|
-
__defNormalProp$A(a, prop, b[prop]);
|
3506
|
-
if (__getOwnPropSymbols$A)
|
3507
|
-
for (var prop of __getOwnPropSymbols$A(b)) {
|
3508
|
-
if (__propIsEnum$A.call(b, prop))
|
3509
|
-
__defNormalProp$A(a, prop, b[prop]);
|
3510
|
-
}
|
3511
|
-
return a;
|
3512
|
-
};
|
3513
|
-
var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
|
3514
|
-
const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, isAlwaysWip, handleChangeViewMode }, parentRef) {
|
3515
|
-
var _a;
|
3516
|
-
const [open, setOpen] = React.useState(false);
|
3517
|
-
const [options, setOptions] = React.useState([]);
|
3518
|
-
const [optionsLoading, setOptionsLoading] = React.useState(false);
|
3519
|
-
const [optionsError, setOptionsError] = React.useState(false);
|
3520
|
-
const [inputValue, setInputValue] = React.useState("");
|
3521
|
-
const [activeIndex, setActiveIndex] = React.useState(null);
|
3522
|
-
const [filterInputType, setInputType] = React.useState(!isAlwaysWip ? "value" : "key");
|
3523
|
-
const styles = ui.useStyles2(getStyles2);
|
3524
|
-
const listRef = React.useRef([]);
|
3525
|
-
const { _wip } = model.useState();
|
3526
|
-
const handleResetWip = React.useCallback(() => {
|
3527
|
-
if (isAlwaysWip) {
|
3528
|
-
model._addWip();
|
3529
|
-
setInputType("key");
|
3530
|
-
setInputValue("");
|
3531
|
-
}
|
3532
|
-
}, [model, isAlwaysWip]);
|
3533
|
-
const onOpenChange = React.useCallback(
|
3534
|
-
(nextOpen, _, reason) => {
|
3535
|
-
setOpen(nextOpen);
|
3536
|
-
if (["outside-press", "escape-key"].includes(reason || "")) {
|
3537
|
-
handleResetWip();
|
3538
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3539
|
-
}
|
3540
|
-
},
|
3541
|
-
[handleChangeViewMode, handleResetWip]
|
3542
|
-
);
|
3543
|
-
const filterToUse = filter || _wip;
|
3544
|
-
const operatorIdentifier = `${(_a = filterToUse == null ? void 0 : filterToUse.key) != null ? _a : ""}-operator`;
|
3545
|
-
const { refs, floatingStyles, context } = react.useFloating({
|
3546
|
-
whileElementsMounted: react.autoUpdate,
|
3547
|
-
open,
|
3548
|
-
onOpenChange,
|
3549
|
-
placement: "bottom-start",
|
3550
|
-
middleware: [
|
3551
|
-
react.offset(10),
|
3552
|
-
react.flip({ padding: 10 }),
|
3553
|
-
react.size({
|
3554
|
-
apply({ availableHeight, elements }) {
|
3555
|
-
elements.floating.style.maxHeight = `${availableHeight > 300 ? 300 : availableHeight}px`;
|
3556
|
-
},
|
3557
|
-
padding: 10
|
3558
|
-
})
|
3559
|
-
]
|
3560
|
-
});
|
3561
|
-
const role = react.useRole(context, { role: "listbox" });
|
3562
|
-
const dismiss = react.useDismiss(context, {
|
3563
|
-
outsidePress: (event) => {
|
3564
|
-
return !event.currentTarget.classList.contains(
|
3565
|
-
operatorIdentifier
|
3566
|
-
);
|
3567
|
-
}
|
3568
|
-
});
|
3569
|
-
const listNav = react.useListNavigation(context, {
|
3570
|
-
listRef,
|
3571
|
-
activeIndex,
|
3572
|
-
onNavigate: setActiveIndex,
|
3573
|
-
virtual: true,
|
3574
|
-
loop: true
|
3575
|
-
});
|
3576
|
-
const { getReferenceProps, getFloatingProps, getItemProps } = react.useInteractions([role, dismiss, listNav]);
|
3577
|
-
React.useImperativeHandle(parentRef, () => () => {
|
3578
|
-
var _a2;
|
3579
|
-
return (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3580
|
-
}, [refs.domReference]);
|
3581
|
-
function onChange(event) {
|
3582
|
-
const value = event.target.value;
|
3583
|
-
setInputValue(value);
|
3584
|
-
setActiveIndex(0);
|
3585
|
-
}
|
3586
|
-
const filteredDropDownItems = options.filter(
|
3587
|
-
(item) => {
|
3588
|
-
var _a2, _b;
|
3589
|
-
return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
|
3590
|
-
}
|
3591
|
-
);
|
3592
|
-
const flushSyncInputType = React.useCallback((inputType) => {
|
3593
|
-
reactDom.flushSync(() => {
|
3594
|
-
setInputType(inputType);
|
3595
|
-
});
|
3596
|
-
}, []);
|
3597
|
-
React.useEffect(() => {
|
3598
|
-
if (isAlwaysWip && !_wip) {
|
3599
|
-
model._addWip();
|
3600
|
-
}
|
3601
|
-
}, [_wip]);
|
3602
|
-
React.useEffect(() => {
|
3603
|
-
if (!isAlwaysWip && refs.domReference.current) {
|
3604
|
-
setInputType("value");
|
3605
|
-
setInputValue("");
|
3606
|
-
refs.domReference.current.focus();
|
3607
|
-
}
|
3608
|
-
}, []);
|
3609
|
-
const handleFetchOptions = React.useCallback(
|
3610
|
-
async (inputType) => {
|
3611
|
-
setOptionsError(false);
|
3612
|
-
setOptionsLoading(true);
|
3613
|
-
setOptions([]);
|
3614
|
-
let options2 = [];
|
3615
|
-
try {
|
3616
|
-
if (inputType === "key") {
|
3617
|
-
options2 = await model._getKeys(null);
|
3618
|
-
} else if (inputType === "operator") {
|
3619
|
-
options2 = model._getOperators();
|
3620
|
-
} else if (inputType === "value") {
|
3621
|
-
options2 = await model._getValuesFor(filterToUse);
|
3622
|
-
}
|
3623
|
-
setOptions(options2);
|
3624
|
-
} catch (e) {
|
3625
|
-
setOptionsError(true);
|
3626
|
-
}
|
3627
|
-
setOptionsLoading(false);
|
3628
|
-
},
|
3629
|
-
[filterToUse, model]
|
3630
|
-
);
|
3631
|
-
const handleBackspaceInput = React.useCallback(
|
3632
|
-
(event) => {
|
3633
|
-
if (event.key === "Backspace" && !inputValue && filterInputType === "key") {
|
3634
|
-
model._removeLastFilter();
|
3635
|
-
handleFetchOptions(filterInputType);
|
3636
|
-
}
|
3637
|
-
},
|
3638
|
-
[inputValue, filterInputType]
|
3639
|
-
);
|
3640
|
-
const handleTabInput = React.useCallback((event) => {
|
3641
|
-
if (event.key === "Tab" && !event.shiftKey) {
|
3642
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3643
|
-
handleResetWip();
|
3644
|
-
}
|
3645
|
-
}, []);
|
3646
|
-
const handleShiftTabInput = React.useCallback((event) => {
|
3647
|
-
if (event.key === "Tab" && event.shiftKey) {
|
3648
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3649
|
-
handleResetWip();
|
3650
|
-
}
|
3651
|
-
}, []);
|
3652
|
-
const handleEnterInput = React.useCallback(
|
3653
|
-
(event) => {
|
3654
|
-
var _a2;
|
3655
|
-
if (event.key === "Enter" && activeIndex != null) {
|
3656
|
-
if (filterInputType !== "value" && !filteredDropDownItems[activeIndex]) {
|
3657
|
-
return;
|
3658
|
-
}
|
3659
|
-
let dropdownItem = filteredDropDownItems[activeIndex];
|
3660
|
-
if (filterInputType === "value" && !filteredDropDownItems[activeIndex]) {
|
3661
|
-
if (!inputValue.trim()) {
|
3662
|
-
return;
|
3663
|
-
}
|
3664
|
-
dropdownItem = { value: inputValue };
|
3665
|
-
}
|
3666
|
-
model._updateFilter(filterToUse, filterInputType, dropdownItem);
|
3667
|
-
setInputValue("");
|
3668
|
-
setActiveIndex(0);
|
3669
|
-
if (filterInputType === "key") {
|
3670
|
-
flushSyncInputType("operator");
|
3671
|
-
} else if (filterInputType === "operator") {
|
3672
|
-
flushSyncInputType("value");
|
3673
|
-
} else if (filterInputType === "value") {
|
3674
|
-
flushSyncInputType("key");
|
3675
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3676
|
-
}
|
3677
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3678
|
-
}
|
3679
|
-
},
|
3680
|
-
[activeIndex, filterToUse, filterInputType, filteredDropDownItems, model]
|
3681
|
-
);
|
3682
|
-
React.useEffect(() => {
|
3683
|
-
if (open) {
|
3684
|
-
handleFetchOptions(filterInputType);
|
3685
|
-
}
|
3686
|
-
}, [open, filterInputType]);
|
3687
|
-
const rowVirtualizer = reactVirtual.useVirtualizer({
|
3688
|
-
count: filteredDropDownItems.length,
|
3689
|
-
getScrollElement: () => refs.floating.current,
|
3690
|
-
estimateSize: () => 38,
|
3691
|
-
overscan: 5
|
3692
|
-
});
|
3693
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
3694
|
-
className: styles.comboboxWrapper
|
3695
|
-
}, filterToUse ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
3696
|
-
className: styles.pillWrapper
|
3697
|
-
}, (filterToUse == null ? void 0 : filterToUse.key) ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
3698
|
-
className: css.cx(styles.basePill, styles.keyPill)
|
3699
|
-
}, filterToUse.key) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && filterInputType !== "operator" ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
3700
|
-
className: css.cx(styles.basePill, styles.operatorPill, operatorIdentifier),
|
3701
|
-
role: "button",
|
3702
|
-
"aria-label": "Edit filter operator",
|
3703
|
-
tabIndex: 0,
|
3704
|
-
onClick: (event) => {
|
3705
|
-
var _a2;
|
3706
|
-
event.stopPropagation();
|
3707
|
-
flushSyncInputType("operator");
|
3708
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3709
|
-
},
|
3710
|
-
onKeyDown: (event) => {
|
3711
|
-
var _a2;
|
3712
|
-
handleShiftTabInput(event);
|
3713
|
-
if (event.key === "Enter") {
|
3714
|
-
flushSyncInputType("operator");
|
3715
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3716
|
-
}
|
3717
|
-
}
|
3718
|
-
}, filterToUse.operator) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && (filterToUse == null ? void 0 : filterToUse.value) && !["operator", "value"].includes(filterInputType) ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
3719
|
-
className: css.cx(styles.basePill, styles.valuePill)
|
3720
|
-
}, filterToUse.value) : null) : null, /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$o(__spreadValues$A({}, getReferenceProps({
|
3721
|
-
ref: refs.setReference,
|
3722
|
-
onChange,
|
3723
|
-
value: inputValue,
|
3724
|
-
placeholder: !isAlwaysWip ? filterInputType === "operator" ? `${filterToUse[filterInputType]} ${filterToUse.value || ""}` : filterToUse[filterInputType] : "Filter by label values",
|
3725
|
-
"aria-autocomplete": "list",
|
3726
|
-
onKeyDown(event) {
|
3727
|
-
if (!open) {
|
3728
|
-
setOpen(true);
|
3729
|
-
return;
|
3730
|
-
}
|
3731
|
-
if (filterInputType === "operator") {
|
3732
|
-
handleShiftTabInput(event);
|
3733
|
-
}
|
3734
|
-
handleBackspaceInput(event);
|
3735
|
-
handleTabInput(event);
|
3736
|
-
handleEnterInput(event);
|
3737
|
-
}
|
3738
|
-
})), {
|
3739
|
-
className: styles.inputStyle,
|
3740
|
-
onClick: (event) => {
|
3741
|
-
event.stopPropagation();
|
3742
|
-
setOpen(true);
|
3743
|
-
},
|
3744
|
-
onFocus: () => {
|
3745
|
-
setActiveIndex(0);
|
3746
|
-
setOpen(true);
|
3747
|
-
}
|
3748
|
-
})), /* @__PURE__ */ React__default["default"].createElement(react.FloatingPortal, null, open && /* @__PURE__ */ React__default["default"].createElement(react.FloatingFocusManager, {
|
3749
|
-
context,
|
3750
|
-
initialFocus: -1,
|
3751
|
-
visuallyHiddenDismiss: true
|
3752
|
-
}, /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({}, getFloatingProps({
|
3753
|
-
ref: refs.setFloating,
|
3754
|
-
style: __spreadProps$o(__spreadValues$A({}, floatingStyles), {
|
3755
|
-
overflowY: "auto",
|
3756
|
-
zIndex: 1
|
3757
|
-
})
|
3758
|
-
})), {
|
3759
|
-
className: styles.dropdownWrapper
|
3760
|
-
}), optionsLoading ? /* @__PURE__ */ React__default["default"].createElement(LoadingOptionsPlaceholder, null) : optionsError ? /* @__PURE__ */ React__default["default"].createElement(OptionsErrorPlaceholder, {
|
3761
|
-
handleFetchOptions: () => handleFetchOptions(filterInputType)
|
3762
|
-
}) : !filteredDropDownItems.length && filterInputType !== "value" ? /* @__PURE__ */ React__default["default"].createElement(NoOptionsPlaceholder, null) : /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, rowVirtualizer.getVirtualItems().map((virtualItem) => {
|
3763
|
-
var _a2;
|
3764
|
-
const item = filteredDropDownItems[virtualItem.index];
|
3765
|
-
const index = virtualItem.index;
|
3766
|
-
return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, __spreadProps$o(__spreadValues$A({}, getItemProps({
|
3767
|
-
key: `${item.value}-${index}`,
|
3768
|
-
ref(node) {
|
3769
|
-
listRef.current[index] = node;
|
3770
|
-
},
|
3771
|
-
onClick(event) {
|
3772
|
-
var _a3;
|
3773
|
-
if (filterInputType !== "value") {
|
3774
|
-
event.stopPropagation();
|
3775
|
-
}
|
3776
|
-
model._updateFilter(filterToUse, filterInputType, item);
|
3777
|
-
setInputValue("");
|
3778
|
-
if (filterInputType === "key") {
|
3779
|
-
flushSyncInputType("operator");
|
3780
|
-
} else if (filterInputType === "operator") {
|
3781
|
-
flushSyncInputType("value");
|
3782
|
-
} else if (filterInputType === "value") {
|
3783
|
-
flushSyncInputType("key");
|
3784
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3785
|
-
}
|
3786
|
-
(_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
|
3787
|
-
}
|
3788
|
-
})), {
|
3789
|
-
active: activeIndex === index
|
3790
|
-
}), (_a2 = item.label) != null ? _a2 : item.value);
|
3791
|
-
}), filterInputType === "value" && inputValue ? /* @__PURE__ */ React__default["default"].createElement(DropdownItem, __spreadProps$o(__spreadValues$A({}, getItemProps({
|
3792
|
-
key: "__custom_value_list_item",
|
3793
|
-
ref(node) {
|
3794
|
-
listRef.current[filteredDropDownItems.length ? filteredDropDownItems.length + 1 : 0] = node;
|
3795
|
-
},
|
3796
|
-
onClick() {
|
3797
|
-
var _a2;
|
3798
|
-
model._updateFilter(filterToUse, filterInputType, { value: inputValue });
|
3799
|
-
setInputValue("");
|
3800
|
-
flushSyncInputType("key");
|
3801
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3802
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3803
|
-
}
|
3804
|
-
})), {
|
3805
|
-
active: activeIndex === (filteredDropDownItems.length ? filteredDropDownItems.length + 1 : 0)
|
3806
|
-
}), "Use custom value: ", inputValue) : null)))));
|
3807
|
-
});
|
3808
|
-
const LoadingOptionsPlaceholder = () => {
|
3809
|
-
return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, {
|
3810
|
-
active: false
|
3811
|
-
}, "Loading options...");
|
3812
|
-
};
|
3813
|
-
const NoOptionsPlaceholder = () => {
|
3814
|
-
return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, {
|
3815
|
-
active: false
|
3816
|
-
}, "No options found");
|
3817
|
-
};
|
3818
|
-
const OptionsErrorPlaceholder = ({ handleFetchOptions }) => {
|
3819
|
-
return /* @__PURE__ */ React__default["default"].createElement(DropdownItem, {
|
3820
|
-
active: false,
|
3821
|
-
onClick: handleFetchOptions
|
3822
|
-
}, "Error. Click to try again!");
|
3823
|
-
};
|
3824
|
-
const getStyles2 = (theme) => ({
|
3825
|
-
comboboxWrapper: css.css({
|
3826
|
-
display: "flex",
|
3827
|
-
flexWrap: "nowrap"
|
3828
|
-
}),
|
3829
|
-
pillWrapper: css.css({
|
3830
|
-
display: "flex",
|
3831
|
-
alignItems: "center",
|
3832
|
-
whiteSpace: "nowrap"
|
3833
|
-
}),
|
3834
|
-
basePill: css.css(__spreadProps$o(__spreadValues$A({
|
3835
|
-
display: "flex",
|
3836
|
-
alignItems: "center",
|
3837
|
-
background: theme.colors.action.disabledBackground,
|
3838
|
-
border: `1px solid ${theme.colors.border.weak}`,
|
3839
|
-
padding: theme.spacing(0.125, 1, 0.125, 1),
|
3840
|
-
color: theme.colors.text.primary,
|
3841
|
-
overflow: "hidden",
|
3842
|
-
whiteSpace: "nowrap",
|
3843
|
-
minHeight: "22px"
|
3844
|
-
}, theme.typography.bodySmall), {
|
3845
|
-
cursor: "pointer"
|
3846
|
-
})),
|
3847
|
-
keyPill: css.css({
|
3848
|
-
fontWeight: theme.typography.fontWeightBold,
|
3849
|
-
cursor: "default"
|
3850
|
-
}),
|
3851
|
-
operatorPill: css.css({
|
3852
|
-
"&:hover": {
|
3853
|
-
background: theme.colors.action.hover
|
3854
|
-
}
|
3855
|
-
}),
|
3856
|
-
valuePill: css.css({
|
3857
|
-
background: theme.colors.action.selected
|
3858
|
-
}),
|
3859
|
-
dropdownWrapper: css.css({
|
3860
|
-
backgroundColor: theme.colors.background.primary,
|
3861
|
-
color: theme.colors.text.primary,
|
3862
|
-
boxShadow: theme.shadows.z2
|
3863
|
-
}),
|
3864
|
-
inputStyle: css.css({
|
3865
|
-
paddingBlock: 0,
|
3866
|
-
"&:focus": {
|
3867
|
-
outline: "none"
|
3868
|
-
}
|
3869
|
-
})
|
3870
|
-
});
|
3871
|
-
|
3872
|
-
var __defProp$z = Object.defineProperty;
|
3873
|
-
var __defProps$n = Object.defineProperties;
|
3874
|
-
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
3875
|
-
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
3876
|
-
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
3877
|
-
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
3878
|
-
var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3879
|
-
var __spreadValues$z = (a, b) => {
|
3880
|
-
for (var prop in b || (b = {}))
|
3881
|
-
if (__hasOwnProp$z.call(b, prop))
|
3882
|
-
__defNormalProp$z(a, prop, b[prop]);
|
3883
|
-
if (__getOwnPropSymbols$z)
|
3884
|
-
for (var prop of __getOwnPropSymbols$z(b)) {
|
3885
|
-
if (__propIsEnum$z.call(b, prop))
|
3886
|
-
__defNormalProp$z(a, prop, b[prop]);
|
3887
|
-
}
|
3888
|
-
return a;
|
3889
|
-
};
|
3890
|
-
var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
|
3891
|
-
function AdHocFiltersComboboxEditSwitch({
|
3892
|
-
filter,
|
3893
|
-
model
|
3894
|
-
}) {
|
3895
|
-
const styles = ui.useStyles2(getStyles$a);
|
3896
|
-
const [viewMode, setViewMode] = React.useState(true);
|
3897
|
-
const pillWrapperRef = React.useRef(null);
|
3898
|
-
const handleChangeViewMode = React.useCallback((event) => {
|
3899
|
-
var _a;
|
3900
|
-
event == null ? void 0 : event.stopPropagation();
|
3901
|
-
let viewMode2 = false;
|
3902
|
-
reactDom.flushSync(() => {
|
3903
|
-
setViewMode((mode) => {
|
3904
|
-
viewMode2 = mode;
|
3905
|
-
return !mode;
|
3906
|
-
});
|
3907
|
-
});
|
3908
|
-
if (!viewMode2) {
|
3909
|
-
(_a = pillWrapperRef.current) == null ? void 0 : _a.focus();
|
3910
|
-
}
|
3911
|
-
}, []);
|
3912
|
-
if (viewMode) {
|
3913
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
3914
|
-
className: styles.combinedFilterPill,
|
3915
|
-
onClick: handleChangeViewMode,
|
3916
|
-
onKeyDown: (e) => {
|
3917
|
-
if (e.key === "Enter") {
|
3918
|
-
handleChangeViewMode();
|
3919
|
-
}
|
3920
|
-
},
|
3921
|
-
role: "button",
|
3922
|
-
"aria-label": `Edit filter with key ${filter.key}`,
|
3923
|
-
tabIndex: 0,
|
3924
|
-
ref: pillWrapperRef
|
3925
|
-
}, /* @__PURE__ */ React__default["default"].createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
|
3926
|
-
onClick: (e) => {
|
3927
|
-
e.stopPropagation();
|
3928
|
-
model._removeFilter(filter);
|
3929
|
-
},
|
3930
|
-
onKeyDownCapture: (e) => {
|
3931
|
-
if (e.key === "Enter") {
|
3932
|
-
e.preventDefault();
|
3933
|
-
e.stopPropagation();
|
3934
|
-
model._removeFilter(filter);
|
3935
|
-
}
|
3936
|
-
},
|
3937
|
-
name: "times",
|
3938
|
-
size: "md",
|
3939
|
-
className: styles.removeButton,
|
3940
|
-
tooltip: `Remove filter with key ${filter.key}`
|
3941
|
-
}));
|
3942
|
-
}
|
3943
|
-
return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
|
3944
|
-
filter,
|
3945
|
-
model,
|
3946
|
-
handleChangeViewMode
|
3947
|
-
});
|
3948
|
-
}
|
3949
|
-
const getStyles$a = (theme) => ({
|
3950
|
-
combinedFilterPill: css.css(__spreadProps$n(__spreadValues$z({
|
3951
|
-
display: "flex",
|
3952
|
-
alignItems: "center",
|
3953
|
-
background: theme.colors.action.selected,
|
3954
|
-
borderRadius: theme.shape.radius.default,
|
3955
|
-
border: `1px solid ${theme.colors.border.weak}`,
|
3956
|
-
padding: theme.spacing(0.125, 0, 0.125, 1),
|
3957
|
-
color: theme.colors.text.primary,
|
3958
|
-
overflow: "hidden",
|
3959
|
-
whiteSpace: "nowrap",
|
3960
|
-
minHeight: "22px"
|
3961
|
-
}, theme.typography.bodySmall), {
|
3962
|
-
fontWeight: theme.typography.fontWeightBold,
|
3963
|
-
cursor: "pointer",
|
3964
|
-
"&:hover": {
|
3965
|
-
background: theme.colors.action.hover
|
3966
|
-
}
|
3967
|
-
})),
|
3968
|
-
removeButton: css.css({
|
3969
|
-
marginInline: theme.spacing(0.5),
|
3970
|
-
cursor: "pointer",
|
3971
|
-
"&:hover": {
|
3972
|
-
color: theme.colors.text.primary
|
3973
|
-
}
|
3974
|
-
})
|
3975
|
-
});
|
3976
|
-
|
3977
|
-
const AdHocFiltersComboboxRenderer = React.memo(function AdHocFiltersComboboxRenderer2({
|
3978
|
-
model
|
3979
|
-
}) {
|
3980
|
-
const { filters } = model.useState();
|
3981
|
-
const styles = ui.useStyles2(getStyles$9);
|
3982
|
-
const focusOnInputRef = React.useRef();
|
3983
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
3984
|
-
className: styles.comboboxWrapper,
|
3985
|
-
onClick: () => {
|
3986
|
-
var _a;
|
3987
|
-
(_a = focusOnInputRef.current) == null ? void 0 : _a.call(focusOnInputRef);
|
3988
|
-
}
|
3989
|
-
}, /* @__PURE__ */ React__default["default"].createElement(ui.Icon, {
|
3990
|
-
name: "filter",
|
3991
|
-
className: styles.filterIcon,
|
3992
|
-
size: "lg"
|
3993
|
-
}), filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxEditSwitch, {
|
3994
|
-
key: index,
|
3995
|
-
filter,
|
3996
|
-
model
|
3997
|
-
})), /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
|
3998
|
-
model,
|
3999
|
-
isAlwaysWip: true,
|
4000
|
-
ref: focusOnInputRef
|
4001
|
-
}));
|
4002
|
-
});
|
4003
|
-
const getStyles$9 = (theme) => ({
|
4004
|
-
comboboxWrapper: css.css({
|
4005
|
-
display: "flex",
|
4006
|
-
flexWrap: "wrap",
|
4007
|
-
alignItems: "center",
|
4008
|
-
columnGap: theme.spacing(1),
|
4009
|
-
rowGap: theme.spacing(0.5),
|
4010
|
-
minHeight: theme.spacing(4),
|
4011
|
-
backgroundColor: theme.components.input.background,
|
4012
|
-
border: `1px solid ${theme.colors.border.strong}`,
|
4013
|
-
borderRadius: theme.shape.radius.default,
|
4014
|
-
paddingInline: theme.spacing(1),
|
4015
|
-
paddingBlock: theme.spacing(0.5),
|
4016
|
-
flexGrow: 1,
|
4017
|
-
"&:focus-within": {
|
4018
|
-
outline: "2px dotted transparent",
|
4019
|
-
outlineOffset: "2px",
|
4020
|
-
boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
|
4021
|
-
transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
|
4022
|
-
transitionDuration: "0.2s",
|
4023
|
-
transitionProperty: "outline, outline-offset, box-shadow"
|
4024
|
-
}
|
4025
|
-
}),
|
4026
|
-
filterIcon: css.css({
|
4027
|
-
color: theme.colors.text.secondary,
|
4028
|
-
alignSelf: "center"
|
4029
|
-
})
|
4030
|
-
});
|
4031
|
-
|
4032
3470
|
var __defProp$y = Object.defineProperty;
|
4033
3471
|
var __defProps$m = Object.defineProperties;
|
4034
3472
|
var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
|
@@ -4059,7 +3497,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
4059
3497
|
applyMode: "auto",
|
4060
3498
|
filterExpression: (_b = state.filterExpression) != null ? _b : renderExpression(state.expressionBuilder, state.filters)
|
4061
3499
|
}, state));
|
4062
|
-
this._scopedVars = { __sceneObject:
|
3500
|
+
this._scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };
|
4063
3501
|
this._dataSourceSrv = runtime.getDataSourceSrv();
|
4064
3502
|
this._urlSync = new AdHocFiltersVariableUrlSyncHandler(this);
|
4065
3503
|
if (this.state.applyMode === "auto") {
|
@@ -4114,12 +3552,6 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
4114
3552
|
}
|
4115
3553
|
this.setState({ filters: this.state.filters.filter((f) => f !== filter) });
|
4116
3554
|
}
|
4117
|
-
_removeLastFilter() {
|
4118
|
-
const filterToRemove = this.state.filters.at(-1);
|
4119
|
-
if (filterToRemove) {
|
4120
|
-
this._removeFilter(filterToRemove);
|
4121
|
-
}
|
4122
|
-
}
|
4123
3555
|
async _getKeys(currentKey) {
|
4124
3556
|
var _a, _b, _c;
|
4125
3557
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
|
@@ -4201,11 +3633,6 @@ function renderExpression(builder, filters) {
|
|
4201
3633
|
function AdHocFiltersVariableRenderer({ model }) {
|
4202
3634
|
const { filters, readOnly, addFilterButtonText } = model.useState();
|
4203
3635
|
const styles = ui.useStyles2(getStyles$8);
|
4204
|
-
if (model.state.layout === "combobox") {
|
4205
|
-
return /* @__PURE__ */ React__default["default"].createElement(AdHocFiltersComboboxRenderer, {
|
4206
|
-
model
|
4207
|
-
});
|
4208
|
-
}
|
4209
3636
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
4210
3637
|
className: styles.wrapper
|
4211
3638
|
}, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
|
@@ -4226,6 +3653,10 @@ const getStyles$8 = (theme) => ({
|
|
4226
3653
|
alignItems: "flex-end",
|
4227
3654
|
columnGap: theme.spacing(2),
|
4228
3655
|
rowGap: theme.spacing(1)
|
3656
|
+
}),
|
3657
|
+
filterIcon: css.css({
|
3658
|
+
color: theme.colors.text.secondary,
|
3659
|
+
paddingRight: theme.spacing(0.5)
|
4229
3660
|
})
|
4230
3661
|
});
|
4231
3662
|
function toSelectableValue(input) {
|
@@ -4314,7 +3745,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
4314
3745
|
this._dataLayersMerger = new DataLayersMerger();
|
4315
3746
|
this._variableValueRecorder = new VariableValueRecorder();
|
4316
3747
|
this._results = new rxjs.ReplaySubject(1);
|
4317
|
-
this._scopedVars = { __sceneObject:
|
3748
|
+
this._scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };
|
4318
3749
|
this._variableDependency = new VariableDependencyConfig(this, {
|
4319
3750
|
statePaths: ["queries", "datasource"],
|
4320
3751
|
onVariableUpdateCompleted: this.onVariableUpdatesCompleted.bind(this),
|
@@ -5383,7 +4814,7 @@ class QueryVariable extends MultiValueVariable {
|
|
5383
4814
|
this.setState({ loading: true, error: null });
|
5384
4815
|
return rxjs.from(
|
5385
4816
|
getDataSource(this.state.datasource, {
|
5386
|
-
__sceneObject:
|
4817
|
+
__sceneObject: wrapInSafeSerializableSceneObject(this)
|
5387
4818
|
})
|
5388
4819
|
).pipe(
|
5389
4820
|
rxjs.mergeMap((ds) => {
|
@@ -5424,7 +4855,7 @@ class QueryVariable extends MultiValueVariable {
|
|
5424
4855
|
}
|
5425
4856
|
getRequest(target, searchFilter) {
|
5426
4857
|
const scopedVars = {
|
5427
|
-
__sceneObject:
|
4858
|
+
__sceneObject: wrapInSafeSerializableSceneObject(this)
|
5428
4859
|
};
|
5429
4860
|
if (searchFilter) {
|
5430
4861
|
scopedVars.__searchFilter = { value: searchFilter, text: searchFilter };
|
@@ -7147,7 +6578,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
|
|
7147
6578
|
__interval: { text: interval.interval, value: interval.interval },
|
7148
6579
|
__interval_ms: { text: interval.intervalMs.toString(), value: interval.intervalMs },
|
7149
6580
|
__annotation: { text: annotation.name, value: annotation },
|
7150
|
-
__sceneObject:
|
6581
|
+
__sceneObject: wrapInSafeSerializableSceneObject(layer)
|
7151
6582
|
};
|
7152
6583
|
const queryRequest = __spreadValues$o(__spreadProps$e(__spreadValues$o({
|
7153
6584
|
startTime: Date.now(),
|
@@ -7292,7 +6723,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
|
|
7292
6723
|
["query"]
|
7293
6724
|
);
|
7294
6725
|
this._scopedVars = {
|
7295
|
-
__sceneObject:
|
6726
|
+
__sceneObject: wrapInSafeSerializableSceneObject(this)
|
7296
6727
|
};
|
7297
6728
|
}
|
7298
6729
|
onEnable() {
|