@grafana/scenes 5.3.9--canary.830.9911285459.0 → 5.3.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +16 -0
- package/dist/esm/components/VizPanel/VizPanelRenderer.js +1 -0
- package/dist/esm/components/VizPanel/VizPanelRenderer.js.map +1 -1
- package/dist/esm/components/layout/grid/SceneGridRow.js +4 -0
- package/dist/esm/components/layout/grid/SceneGridRow.js.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +2 -6
- package/dist/index.js +583 -1020
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/dist/esm/variables/adhoc/AdHocCombobox.js +0 -396
- package/dist/esm/variables/adhoc/AdHocCombobox.js.map +0 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariableV2.js +0 -58
- package/dist/esm/variables/adhoc/AdHocFiltersVariableV2.js.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@grafana/scenes",
|
3
|
-
"version": "5.3.9
|
3
|
+
"version": "5.3.9",
|
4
4
|
"description": "Grafana framework for building dynamic dashboards",
|
5
5
|
"author": "Grafana Labs",
|
6
6
|
"license": "AGPL-3.0-only",
|
@@ -37,7 +37,6 @@
|
|
37
37
|
"url": "https://github.com/grafana/scenes/issues"
|
38
38
|
},
|
39
39
|
"dependencies": {
|
40
|
-
"@floating-ui/react": "0.26.16",
|
41
40
|
"@grafana/e2e-selectors": "^11.0.0",
|
42
41
|
"@leeoniya/ufuzzy": "^1.0.14",
|
43
42
|
"react-grid-layout": "1.3.4",
|
@@ -114,5 +113,5 @@
|
|
114
113
|
"prettier --write"
|
115
114
|
]
|
116
115
|
},
|
117
|
-
"gitHead": "
|
116
|
+
"gitHead": "b07eb1d8778ed340a1cfc4c430c88e7095e3d5f5"
|
118
117
|
}
|
@@ -1,396 +0,0 @@
|
|
1
|
-
import React, { forwardRef, useState, useRef, useCallback, useEffect } from 'react';
|
2
|
-
import { useId, useFloating, autoUpdate, flip, size, useRole, useDismiss, useListNavigation, useInteractions, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
|
3
|
-
import { useTheme2, getSelectStyles, useStyles2, IconButton } from '@grafana/ui';
|
4
|
-
import { cx, css } from '@emotion/css';
|
5
|
-
import { flushSync } from 'react-dom';
|
6
|
-
|
7
|
-
var __defProp = Object.defineProperty;
|
8
|
-
var __defProps = Object.defineProperties;
|
9
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
10
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
12
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
13
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
14
|
-
var __spreadValues = (a, b) => {
|
15
|
-
for (var prop in b || (b = {}))
|
16
|
-
if (__hasOwnProp.call(b, prop))
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
18
|
-
if (__getOwnPropSymbols)
|
19
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
20
|
-
if (__propIsEnum.call(b, prop))
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
22
|
-
}
|
23
|
-
return a;
|
24
|
-
};
|
25
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
26
|
-
var __objRest = (source, exclude) => {
|
27
|
-
var target = {};
|
28
|
-
for (var prop in source)
|
29
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
30
|
-
target[prop] = source[prop];
|
31
|
-
if (source != null && __getOwnPropSymbols)
|
32
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
33
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
34
|
-
target[prop] = source[prop];
|
35
|
-
}
|
36
|
-
return target;
|
37
|
-
};
|
38
|
-
const Item = forwardRef(
|
39
|
-
(_a, ref) => {
|
40
|
-
var _b = _a, { children, active } = _b, rest = __objRest(_b, ["children", "active"]);
|
41
|
-
const theme = useTheme2();
|
42
|
-
const selectStyles = getSelectStyles(theme);
|
43
|
-
const id = useId();
|
44
|
-
return /* @__PURE__ */ React.createElement("div", __spreadValues({
|
45
|
-
ref,
|
46
|
-
role: "option",
|
47
|
-
id,
|
48
|
-
"aria-selected": active,
|
49
|
-
className: cx(selectStyles.option, active && selectStyles.optionFocused)
|
50
|
-
}, rest), /* @__PURE__ */ React.createElement("div", {
|
51
|
-
className: selectStyles.optionBody,
|
52
|
-
"data-testid": `data-testid ad hoc filter option value ${children}`
|
53
|
-
}, /* @__PURE__ */ React.createElement("span", null, children)));
|
54
|
-
}
|
55
|
-
);
|
56
|
-
function AdHocCombobox({ filter, model, wip, handleChangeViewMode }) {
|
57
|
-
var _a;
|
58
|
-
const [open, setOpen] = useState(false);
|
59
|
-
const [options, setOptions] = useState([]);
|
60
|
-
const [inputValue, setInputValue] = useState("");
|
61
|
-
const [activeIndex, setActiveIndex] = useState(null);
|
62
|
-
const [inputType, setInputType] = useState(!wip ? "value" : "key");
|
63
|
-
const styles = useStyles2(getStyles2);
|
64
|
-
const listRef = useRef([]);
|
65
|
-
const { _wip } = model.useState();
|
66
|
-
const filterToUse = filter || _wip;
|
67
|
-
const operatorIdentifier = `${(_a = filterToUse == null ? void 0 : filterToUse.key) != null ? _a : ""}-operator`;
|
68
|
-
const { refs, floatingStyles, context } = useFloating({
|
69
|
-
whileElementsMounted: autoUpdate,
|
70
|
-
open,
|
71
|
-
onOpenChange: (nextOpen, _, reason) => {
|
72
|
-
setOpen(nextOpen);
|
73
|
-
if (reason === "outside-press") {
|
74
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
75
|
-
}
|
76
|
-
},
|
77
|
-
middleware: [
|
78
|
-
flip({ padding: 10 }),
|
79
|
-
size({
|
80
|
-
apply({ rects, availableHeight, elements }) {
|
81
|
-
Object.assign(elements.floating.style, {
|
82
|
-
width: `${rects.reference.width}px`,
|
83
|
-
maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`
|
84
|
-
});
|
85
|
-
},
|
86
|
-
padding: 10
|
87
|
-
})
|
88
|
-
]
|
89
|
-
});
|
90
|
-
const role = useRole(context, { role: "listbox" });
|
91
|
-
const dismiss = useDismiss(context, {
|
92
|
-
outsidePress: (event) => {
|
93
|
-
return !event.currentTarget.classList.contains(
|
94
|
-
operatorIdentifier
|
95
|
-
);
|
96
|
-
}
|
97
|
-
});
|
98
|
-
const listNav = useListNavigation(context, {
|
99
|
-
listRef,
|
100
|
-
activeIndex,
|
101
|
-
onNavigate: setActiveIndex,
|
102
|
-
virtual: true,
|
103
|
-
loop: true
|
104
|
-
});
|
105
|
-
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNav]);
|
106
|
-
function onChange(event) {
|
107
|
-
var _a2, _b;
|
108
|
-
if (inputType === "key") {
|
109
|
-
const lastChar = event.target.value.slice(-1);
|
110
|
-
if (["=", "!", "<", ">"].includes(lastChar)) {
|
111
|
-
const key = event.target.value.slice(0, -1);
|
112
|
-
const optionIndex = options.findIndex((option) => option.value === key);
|
113
|
-
if (optionIndex >= 0) {
|
114
|
-
model._updateFilter(filterToUse, inputType, options[optionIndex]);
|
115
|
-
setInputValue(lastChar);
|
116
|
-
}
|
117
|
-
flushSync(() => {
|
118
|
-
setInputType("operator");
|
119
|
-
});
|
120
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
121
|
-
return;
|
122
|
-
}
|
123
|
-
}
|
124
|
-
if (inputType === "operator") {
|
125
|
-
const lastChar = event.target.value.slice(-1);
|
126
|
-
if (/\w/.test(lastChar)) {
|
127
|
-
const operator = event.target.value.slice(0, -1);
|
128
|
-
if (!/\w/.test(operator)) {
|
129
|
-
const optionIndex = options.findIndex((option) => option.value === operator);
|
130
|
-
if (optionIndex >= 0) {
|
131
|
-
model._updateFilter(filterToUse, inputType, options[optionIndex]);
|
132
|
-
setInputValue(lastChar);
|
133
|
-
}
|
134
|
-
flushSync(() => {
|
135
|
-
setInputType("value");
|
136
|
-
});
|
137
|
-
(_b = refs.domReference.current) == null ? void 0 : _b.focus();
|
138
|
-
return;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
}
|
142
|
-
const value = event.target.value;
|
143
|
-
setInputValue(value);
|
144
|
-
setActiveIndex(0);
|
145
|
-
}
|
146
|
-
const items = options.filter(
|
147
|
-
(item) => {
|
148
|
-
var _a2, _b;
|
149
|
-
return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
|
150
|
-
}
|
151
|
-
);
|
152
|
-
const flushInputType = useCallback((inputType2) => {
|
153
|
-
flushSync(() => {
|
154
|
-
setInputType(inputType2);
|
155
|
-
});
|
156
|
-
}, []);
|
157
|
-
useEffect(() => {
|
158
|
-
if (wip && !_wip) {
|
159
|
-
model._addWip();
|
160
|
-
}
|
161
|
-
}, [_wip]);
|
162
|
-
useEffect(() => {
|
163
|
-
if (!wip && refs.domReference.current) {
|
164
|
-
setInputType("value");
|
165
|
-
setInputValue("");
|
166
|
-
refs.domReference.current.focus();
|
167
|
-
}
|
168
|
-
}, []);
|
169
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, filterToUse ? /* @__PURE__ */ React.createElement("div", {
|
170
|
-
className: styles.pillWrapper
|
171
|
-
}, (filterToUse == null ? void 0 : filterToUse.key) ? /* @__PURE__ */ React.createElement("div", {
|
172
|
-
className: cx(styles.basePill, styles.keyPill)
|
173
|
-
}, filterToUse.key) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && inputType !== "operator" ? /* @__PURE__ */ React.createElement("div", {
|
174
|
-
className: cx(styles.basePill, operatorIdentifier),
|
175
|
-
role: "button",
|
176
|
-
"aria-label": "Edit filter operator",
|
177
|
-
tabIndex: 0,
|
178
|
-
onClick: () => {
|
179
|
-
var _a2;
|
180
|
-
flushInputType("operator");
|
181
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
182
|
-
},
|
183
|
-
onKeyDown: (e) => {
|
184
|
-
var _a2;
|
185
|
-
if (e.key === "Enter") {
|
186
|
-
flushInputType("operator");
|
187
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
188
|
-
}
|
189
|
-
}
|
190
|
-
}, filterToUse.operator) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && (filterToUse == null ? void 0 : filterToUse.value) && !["operator", "value"].includes(inputType) ? /* @__PURE__ */ React.createElement("div", {
|
191
|
-
className: cx(styles.basePill, styles.valuePill)
|
192
|
-
}, filterToUse.value) : null) : null, /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, getReferenceProps({
|
193
|
-
ref: refs.setReference,
|
194
|
-
onChange,
|
195
|
-
value: inputValue,
|
196
|
-
placeholder: !wip ? inputType === "operator" ? `${filterToUse[inputType]} ${filterToUse.value || ""}` : filterToUse[inputType] : "Filter by label values",
|
197
|
-
"aria-autocomplete": "list",
|
198
|
-
onKeyDown(event) {
|
199
|
-
var _a2;
|
200
|
-
if (event.key === "Enter" && activeIndex != null && items[activeIndex]) {
|
201
|
-
model._updateFilter(filterToUse, inputType, items[activeIndex]);
|
202
|
-
setInputValue("");
|
203
|
-
if (inputType === "key") {
|
204
|
-
flushInputType("operator");
|
205
|
-
} else if (inputType === "operator") {
|
206
|
-
flushInputType("value");
|
207
|
-
} else if (inputType === "value") {
|
208
|
-
flushInputType("key");
|
209
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
210
|
-
}
|
211
|
-
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
212
|
-
}
|
213
|
-
}
|
214
|
-
})), {
|
215
|
-
className: styles.inputStyle,
|
216
|
-
key: inputType,
|
217
|
-
onFocus: async () => {
|
218
|
-
let options2 = [];
|
219
|
-
if (inputType === "key") {
|
220
|
-
options2 = await model._getKeys(null);
|
221
|
-
} else if (inputType === "operator") {
|
222
|
-
options2 = model._getOperators();
|
223
|
-
} else if (inputType === "value") {
|
224
|
-
options2 = await model._getValuesFor(filterToUse);
|
225
|
-
}
|
226
|
-
setActiveIndex(0);
|
227
|
-
setOptions(options2);
|
228
|
-
setOpen(true);
|
229
|
-
}
|
230
|
-
})), /* @__PURE__ */ React.createElement(FloatingPortal, null, open && /* @__PURE__ */ React.createElement(FloatingFocusManager, {
|
231
|
-
context,
|
232
|
-
initialFocus: -1,
|
233
|
-
visuallyHiddenDismiss: true
|
234
|
-
}, /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, getFloatingProps({
|
235
|
-
ref: refs.setFloating,
|
236
|
-
style: __spreadProps(__spreadValues({}, floatingStyles), {
|
237
|
-
overflowY: "auto"
|
238
|
-
})
|
239
|
-
})), {
|
240
|
-
className: styles.dropdownWrapper
|
241
|
-
}), items.map((item, index) => {
|
242
|
-
var _a2;
|
243
|
-
return /* @__PURE__ */ React.createElement(Item, __spreadProps(__spreadValues({}, getItemProps({
|
244
|
-
key: item.value,
|
245
|
-
ref(node) {
|
246
|
-
listRef.current[index] = node;
|
247
|
-
},
|
248
|
-
onClick() {
|
249
|
-
var _a3;
|
250
|
-
model._updateFilter(filterToUse, inputType, item);
|
251
|
-
setInputValue("");
|
252
|
-
if (inputType === "key") {
|
253
|
-
flushInputType("operator");
|
254
|
-
} else if (inputType === "operator") {
|
255
|
-
flushInputType("value");
|
256
|
-
} else if (inputType === "value") {
|
257
|
-
flushInputType("key");
|
258
|
-
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
259
|
-
}
|
260
|
-
(_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
|
261
|
-
}
|
262
|
-
})), {
|
263
|
-
active: activeIndex === index
|
264
|
-
}), (_a2 = item.label) != null ? _a2 : item.value);
|
265
|
-
})))));
|
266
|
-
}
|
267
|
-
const getStyles2 = (theme) => ({
|
268
|
-
pillWrapper: css({
|
269
|
-
display: "flex",
|
270
|
-
alignItems: "center",
|
271
|
-
whiteSpace: "nowrap"
|
272
|
-
}),
|
273
|
-
basePill: css(__spreadProps(__spreadValues({
|
274
|
-
display: "flex",
|
275
|
-
alignItems: "center",
|
276
|
-
background: theme.colors.action.disabledBackground,
|
277
|
-
border: `1px solid ${theme.colors.border.weak}`,
|
278
|
-
padding: theme.spacing(0.125, 1, 0.125, 1),
|
279
|
-
color: theme.colors.text.primary,
|
280
|
-
overflow: "hidden",
|
281
|
-
whiteSpace: "nowrap",
|
282
|
-
minHeight: "22px"
|
283
|
-
}, theme.typography.bodySmall), {
|
284
|
-
cursor: "pointer"
|
285
|
-
})),
|
286
|
-
keyPill: css({
|
287
|
-
fontWeight: theme.typography.fontWeightBold,
|
288
|
-
cursor: "default"
|
289
|
-
}),
|
290
|
-
valuePill: css({
|
291
|
-
background: theme.colors.action.selected
|
292
|
-
}),
|
293
|
-
dropdownWrapper: css({
|
294
|
-
backgroundColor: theme.colors.background.primary,
|
295
|
-
color: theme.colors.text.primary,
|
296
|
-
boxShadow: theme.shadows.z2
|
297
|
-
}),
|
298
|
-
inputStyle: css({
|
299
|
-
paddingBlock: 0,
|
300
|
-
"&:focus": {
|
301
|
-
outline: "none"
|
302
|
-
}
|
303
|
-
})
|
304
|
-
});
|
305
|
-
function AdHocFilterEditSwitch({ filter, model }) {
|
306
|
-
const styles = useStyles2(getStyles3);
|
307
|
-
const [viewMode, setViewMode] = useState(true);
|
308
|
-
const wrapRef = useRef(null);
|
309
|
-
const handleChangeViewMode = useCallback(() => {
|
310
|
-
flushSync(() => {
|
311
|
-
setViewMode((mode) => !mode);
|
312
|
-
});
|
313
|
-
if (wrapRef.current) {
|
314
|
-
wrapRef.current.focus();
|
315
|
-
}
|
316
|
-
}, []);
|
317
|
-
if (viewMode) {
|
318
|
-
return /* @__PURE__ */ React.createElement("div", {
|
319
|
-
className: styles.combinedFilterPill,
|
320
|
-
onClick: handleChangeViewMode,
|
321
|
-
onKeyDown: (e) => {
|
322
|
-
if (e.key === "Enter") {
|
323
|
-
handleChangeViewMode();
|
324
|
-
}
|
325
|
-
},
|
326
|
-
role: "button",
|
327
|
-
"aria-label": "Edit filter",
|
328
|
-
tabIndex: 0,
|
329
|
-
ref: wrapRef
|
330
|
-
}, /* @__PURE__ */ React.createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), /* @__PURE__ */ React.createElement(IconButton, {
|
331
|
-
onClick: (e) => {
|
332
|
-
e.stopPropagation();
|
333
|
-
model._removeFilter(filter);
|
334
|
-
},
|
335
|
-
name: "times",
|
336
|
-
size: "md",
|
337
|
-
className: styles.removeButton,
|
338
|
-
tooltip: "Remove filter"
|
339
|
-
}));
|
340
|
-
}
|
341
|
-
return /* @__PURE__ */ React.createElement(AdHocCombobox, {
|
342
|
-
filter,
|
343
|
-
model,
|
344
|
-
handleChangeViewMode
|
345
|
-
});
|
346
|
-
}
|
347
|
-
const getStyles3 = (theme) => ({
|
348
|
-
wrapper: css({
|
349
|
-
display: "flex",
|
350
|
-
flexWrap: "wrap",
|
351
|
-
alignItems: "center",
|
352
|
-
columnGap: theme.spacing(1),
|
353
|
-
rowGap: theme.spacing(1),
|
354
|
-
minHeight: theme.spacing(4),
|
355
|
-
backgroundColor: theme.components.input.background,
|
356
|
-
border: `1px solid ${theme.colors.border.strong}`,
|
357
|
-
borderRadius: theme.shape.radius.default,
|
358
|
-
paddingInline: theme.spacing(1),
|
359
|
-
"&:focus-within": {
|
360
|
-
outline: "2px dotted transparent",
|
361
|
-
outlineOffset: "2px",
|
362
|
-
boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
|
363
|
-
transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
|
364
|
-
transitionDuration: "0.2s",
|
365
|
-
transitionProperty: "outline, outline-offset, box-shadow"
|
366
|
-
}
|
367
|
-
}),
|
368
|
-
combinedFilterPill: css(__spreadProps(__spreadValues({
|
369
|
-
display: "flex",
|
370
|
-
alignItems: "center",
|
371
|
-
background: theme.colors.action.selected,
|
372
|
-
borderRadius: theme.shape.radius.default,
|
373
|
-
border: `1px solid ${theme.colors.border.weak}`,
|
374
|
-
padding: theme.spacing(0.125, 0, 0.125, 1),
|
375
|
-
color: theme.colors.text.primary,
|
376
|
-
overflow: "hidden",
|
377
|
-
whiteSpace: "nowrap",
|
378
|
-
minHeight: "22px"
|
379
|
-
}, theme.typography.bodySmall), {
|
380
|
-
fontWeight: theme.typography.fontWeightBold,
|
381
|
-
cursor: "pointer",
|
382
|
-
"&:hover": {
|
383
|
-
background: theme.colors.emphasize(theme.colors.background.secondary)
|
384
|
-
}
|
385
|
-
})),
|
386
|
-
removeButton: css({
|
387
|
-
marginInline: theme.spacing(0.5),
|
388
|
-
cursor: "pointer",
|
389
|
-
"&:hover": {
|
390
|
-
color: theme.colors.text.primary
|
391
|
-
}
|
392
|
-
})
|
393
|
-
});
|
394
|
-
|
395
|
-
export { AdHocCombobox, AdHocFilterEditSwitch };
|
396
|
-
//# sourceMappingURL=AdHocCombobox.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"AdHocCombobox.js","sources":["../../../../src/variables/adhoc/AdHocCombobox.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport {\n autoUpdate,\n size,\n flip,\n useId,\n useDismiss,\n useFloating,\n useInteractions,\n useListNavigation,\n useRole,\n FloatingFocusManager,\n FloatingPortal,\n} from '@floating-ui/react';\nimport { IconButton, getSelectStyles, useStyles2, useTheme2 } from '@grafana/ui';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable } from './AdHocFiltersVariable';\nimport { flushSync } from 'react-dom';\n\ninterface ItemProps {\n children: React.ReactNode;\n active: boolean;\n}\n\n// eslint-disable-next-line react/display-name\nconst Item = forwardRef<HTMLDivElement, ItemProps & React.HTMLProps<HTMLDivElement>>(\n ({ children, active, ...rest }, ref) => {\n const theme = useTheme2();\n const selectStyles = getSelectStyles(theme);\n const id = useId();\n return (\n <div\n ref={ref}\n role=\"option\"\n id={id}\n aria-selected={active}\n className={cx(selectStyles.option, active && selectStyles.optionFocused)}\n {...rest}\n >\n <div className={selectStyles.optionBody} data-testid={`data-testid ad hoc filter option value ${children}`}>\n <span>{children}</span>\n </div>\n </div>\n );\n }\n);\n\ninterface AdHocComboboxProps {\n filter?: AdHocFilterWithLabels;\n wip?: boolean;\n model: AdHocFiltersVariable;\n handleChangeViewMode?: () => void;\n}\n\ntype AdHocInputType = 'key' | 'operator' | 'value';\n\nexport function AdHocCombobox({ filter, model, wip, handleChangeViewMode }: AdHocComboboxProps) {\n const [open, setOpen] = useState(false);\n // const [optionsLoading, setOptionsLoading] = useState<boolean>(false);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>([]);\n const [inputValue, setInputValue] = useState('');\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n const [inputType, setInputType] = useState<AdHocInputType>(!wip ? 'value' : 'key');\n const styles = useStyles2(getStyles2);\n\n const listRef = useRef<Array<HTMLElement | null>>([]);\n const { _wip } = model.useState();\n\n const filterToUse = filter || _wip;\n\n const operatorIdentifier = `${filterToUse?.key ?? ''}-operator`;\n\n const { refs, floatingStyles, context } = useFloating<HTMLInputElement>({\n whileElementsMounted: autoUpdate,\n open,\n onOpenChange: (nextOpen, _, reason) => {\n setOpen(nextOpen);\n // change from filter edit mode to filter view mode when clicked\n // outside input or dropdown\n if (reason === 'outside-press') {\n handleChangeViewMode?.();\n }\n },\n middleware: [\n flip({ padding: 10 }),\n size({\n apply({ rects, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n width: `${rects.reference.width}px`,\n // limit the maxHeight of dropdown\n maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`,\n });\n },\n padding: 10,\n }),\n ],\n });\n\n const role = useRole(context, { role: 'listbox' });\n const dismiss = useDismiss(context, {\n // if outside click lands on operator pill, then ignore outside click\n outsidePress: (event) => {\n return !(event as unknown as React.MouseEvent<HTMLElement, MouseEvent>).currentTarget.classList.contains(\n operatorIdentifier\n );\n },\n });\n const listNav = useListNavigation(context, {\n listRef,\n activeIndex,\n onNavigate: setActiveIndex,\n virtual: true,\n loop: true,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNav]);\n\n function onChange(event: React.ChangeEvent<HTMLInputElement>) {\n // part of POC for seamless filter parser\n if (inputType === 'key') {\n const lastChar = event.target.value.slice(-1);\n if (['=', '!', '<', '>'].includes(lastChar)) {\n const key = event.target.value.slice(0, -1);\n const optionIndex = options.findIndex((option) => option.value === key);\n if (optionIndex >= 0) {\n model._updateFilter(filterToUse!, inputType, options[optionIndex]);\n setInputValue(lastChar);\n }\n flushSync(() => {\n setInputType('operator');\n });\n refs.domReference.current?.focus();\n return;\n }\n }\n if (inputType === 'operator') {\n const lastChar = event.target.value.slice(-1);\n if (/\\w/.test(lastChar)) {\n const operator = event.target.value.slice(0, -1);\n if (!/\\w/.test(operator)) {\n const optionIndex = options.findIndex((option) => option.value === operator);\n if (optionIndex >= 0) {\n model._updateFilter(filterToUse!, inputType, options[optionIndex]);\n setInputValue(lastChar);\n }\n flushSync(() => {\n setInputType('value');\n });\n refs.domReference.current?.focus();\n return;\n }\n }\n }\n\n const value = event.target.value;\n setInputValue(value);\n setActiveIndex(0);\n }\n\n const items = options.filter((item) =>\n (item.label ?? item.value)?.toLocaleLowerCase().startsWith(inputValue.toLowerCase())\n );\n\n const flushInputType = useCallback((inputType: AdHocInputType) => {\n flushSync(() => {\n setInputType(inputType);\n });\n }, []);\n\n // when combobox is in wip mode then check and add _wip if its missing\n // needed on first render and when _wip is reset on filter value commit\n useEffect(() => {\n if (wip && !_wip) {\n model._addWip();\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_wip]);\n\n // when not in wip mode this is the point of switching from view to edit mode\n // and in this case we default to 'value' input type and focus input\n useEffect(() => {\n if (!wip && refs.domReference.current) {\n setInputType('value');\n setInputValue('');\n\n refs.domReference.current.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <>\n {filterToUse ? (\n <div className={styles.pillWrapper}>\n {filterToUse?.key ? <div className={cx(styles.basePill, styles.keyPill)}>{filterToUse.key}</div> : null}\n {filterToUse?.key && filterToUse?.operator && inputType !== 'operator' ? (\n <div\n className={cx(styles.basePill, operatorIdentifier)}\n role=\"button\"\n aria-label=\"Edit filter operator\"\n tabIndex={0}\n onClick={() => {\n flushInputType('operator');\n\n refs.domReference.current?.focus();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n flushInputType('operator');\n\n refs.domReference.current?.focus();\n }\n }}\n >\n {filterToUse.operator}\n </div>\n ) : null}\n {filterToUse?.key &&\n filterToUse?.operator &&\n filterToUse?.value &&\n !['operator', 'value'].includes(inputType) ? (\n <div className={cx(styles.basePill, styles.valuePill)}>{filterToUse.value}</div>\n ) : null}\n </div>\n ) : null}\n\n <input\n {...getReferenceProps({\n ref: refs.setReference,\n onChange,\n value: inputValue,\n // dynamic placeholder to display operator and/or value in filter edit mode\n placeholder: !wip\n ? inputType === 'operator'\n ? `${filterToUse![inputType]} ${filterToUse!.value || ''}`\n : filterToUse![inputType]\n : 'Filter by label values',\n 'aria-autocomplete': 'list',\n onKeyDown(event) {\n if (event.key === 'Enter' && activeIndex != null && items[activeIndex]) {\n model._updateFilter(filterToUse!, inputType, items[activeIndex]);\n setInputValue('');\n\n if (inputType === 'key') {\n flushInputType('operator');\n } else if (inputType === 'operator') {\n flushInputType('value');\n } else if (inputType === 'value') {\n flushInputType('key');\n\n handleChangeViewMode?.();\n }\n\n refs.domReference.current?.focus();\n }\n },\n })}\n className={styles.inputStyle}\n key={inputType}\n onFocus={async () => {\n let options: Array<SelectableValue<string>> = [];\n // TODO: missing async placeholder while options load\n if (inputType === 'key') {\n options = await model._getKeys(null);\n } else if (inputType === 'operator') {\n options = model._getOperators();\n } else if (inputType === 'value') {\n options = await model._getValuesFor(filterToUse!);\n }\n\n setActiveIndex(0);\n setOptions(options);\n setOpen(true);\n }}\n />\n <FloatingPortal>\n {open && (\n <FloatingFocusManager context={context} initialFocus={-1} visuallyHiddenDismiss>\n <div\n {...getFloatingProps({\n ref: refs.setFloating,\n style: {\n ...floatingStyles,\n overflowY: 'auto',\n },\n })}\n className={styles.dropdownWrapper}\n >\n {items.map((item, index) => (\n // eslint-disable-next-line react/jsx-key\n <Item\n {...getItemProps({\n key: item.value!,\n ref(node) {\n listRef.current[index] = node;\n },\n onClick() {\n model._updateFilter(filterToUse!, inputType, item);\n setInputValue('');\n\n if (inputType === 'key') {\n flushInputType('operator');\n } else if (inputType === 'operator') {\n flushInputType('value');\n } else if (inputType === 'value') {\n flushInputType('key');\n handleChangeViewMode?.();\n }\n\n refs.domReference.current?.focus();\n },\n })}\n active={activeIndex === index}\n >\n {item.label ?? item.value}\n </Item>\n ))}\n </div>\n </FloatingFocusManager>\n )}\n </FloatingPortal>\n </>\n );\n}\n\nconst getStyles2 = (theme: GrafanaTheme2) => ({\n pillWrapper: css({\n display: 'flex',\n alignItems: 'center',\n whiteSpace: 'nowrap',\n }),\n basePill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.disabledBackground,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 1, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: '22px',\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n keyPill: css({\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'default',\n }),\n valuePill: css({\n background: theme.colors.action.selected,\n }),\n dropdownWrapper: css({\n backgroundColor: theme.colors.background.primary,\n color: theme.colors.text.primary,\n boxShadow: theme.shadows.z2,\n }),\n inputStyle: css({\n paddingBlock: 0,\n '&:focus': {\n outline: 'none',\n },\n }),\n});\n\ninterface AdHocFilterEditSwitchProps {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n}\n\nexport function AdHocFilterEditSwitch({ filter, model }: AdHocFilterEditSwitchProps) {\n const styles = useStyles2(getStyles3);\n const [viewMode, setViewMode] = useState(true);\n const wrapRef = useRef<HTMLDivElement>(null);\n\n const handleChangeViewMode = useCallback(() => {\n flushSync(() => {\n setViewMode((mode) => !mode);\n });\n // focus is lost when switching to view mode with keyboard, so forcing\n // focus back in parent after finished editing\n if (wrapRef.current) {\n wrapRef.current.focus();\n }\n }, []);\n\n if (viewMode) {\n return (\n <div\n className={styles.combinedFilterPill}\n onClick={handleChangeViewMode}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n handleChangeViewMode();\n }\n }}\n role=\"button\"\n aria-label=\"Edit filter\"\n tabIndex={0}\n ref={wrapRef}\n >\n <span>\n {filter.key} {filter.operator} {filter.value}\n </span>\n <IconButton\n onClick={(e) => {\n e.stopPropagation();\n model._removeFilter(filter);\n }}\n name=\"times\"\n size=\"md\"\n className={styles.removeButton}\n tooltip=\"Remove filter\"\n />\n </div>\n );\n }\n\n return <AdHocCombobox filter={filter} model={model} handleChangeViewMode={handleChangeViewMode} />;\n}\n\nconst getStyles3 = (theme: GrafanaTheme2) => ({\n wrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n columnGap: theme.spacing(1),\n rowGap: theme.spacing(1),\n minHeight: theme.spacing(4),\n backgroundColor: theme.components.input.background,\n border: `1px solid ${theme.colors.border.strong}`,\n borderRadius: theme.shape.radius.default,\n paddingInline: theme.spacing(1),\n\n '&:focus-within': {\n outline: '2px dotted transparent',\n outlineOffset: '2px',\n boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,\n transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,\n transitionDuration: '0.2s',\n transitionProperty: 'outline, outline-offset, box-shadow',\n },\n }),\n combinedFilterPill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.selected,\n borderRadius: theme.shape.radius.default,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 0, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: '22px',\n ...theme.typography.bodySmall,\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'pointer',\n\n '&:hover': {\n background: theme.colors.emphasize(theme.colors.background.secondary),\n },\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n});\n"],"names":["_a","inputType","options"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,IAAO,GAAA,UAAA;AAAA,EACX,CAAC,IAA+B,GAAQ,KAAA;AAAvC,IAAA,IAAA,EAAA,GAAA,EAAA,EAAE,YAAU,MA3Bf,EAAA,GA2BG,IAAuB,IAAvB,GAAA,SAAA,CAAA,EAAA,EAAuB,CAArB,UAAU,EAAA,QAAA,CAAA,CAAA,CAAA;AACX,IAAA,MAAM,QAAQ,SAAU,EAAA,CAAA;AACxB,IAAM,MAAA,YAAA,GAAe,gBAAgB,KAAK,CAAA,CAAA;AAC1C,IAAA,MAAM,KAAK,KAAM,EAAA,CAAA;AACjB,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,cAAA,CAAA;AAAA,MACC,GAAA;AAAA,MACA,IAAK,EAAA,QAAA;AAAA,MACL,EAAA;AAAA,MACA,eAAe,EAAA,MAAA;AAAA,MACf,WAAW,EAAG,CAAA,YAAA,CAAa,MAAQ,EAAA,MAAA,IAAU,aAAa,aAAa,CAAA;AAAA,KAAA,EACnE,uBAEH,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MAAI,WAAW,YAAa,CAAA,UAAA;AAAA,MAAY,eAAa,CAA0C,uCAAA,EAAA,QAAA,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Q,EAAA,SAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,KAC3B;AAAA,GACD,CAAA;AACH,CAAA,CAAA;;;;"}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
import { css } from '@emotion/css';
|
2
|
-
import { useStyles2, Icon } from '@grafana/ui';
|
3
|
-
import React from 'react';
|
4
|
-
import { AdHocFilterEditSwitch, AdHocCombobox } from './AdHocCombobox.js';
|
5
|
-
import { AdHocFiltersVariable } from './AdHocFiltersVariable.js';
|
6
|
-
|
7
|
-
class AdHocFiltersVariableV2 extends AdHocFiltersVariable {
|
8
|
-
}
|
9
|
-
AdHocFiltersVariableV2.Component = AdHocFiltersVariableRendererV2;
|
10
|
-
function AdHocFiltersVariableRendererV2({ model }) {
|
11
|
-
const { filters } = model.useState();
|
12
|
-
const styles = useStyles2(getStyles2);
|
13
|
-
return /* @__PURE__ */ React.createElement("div", {
|
14
|
-
className: styles.wrapper
|
15
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
16
|
-
name: "filter",
|
17
|
-
className: styles.filterIcon,
|
18
|
-
size: "lg"
|
19
|
-
}), filters.map((filter, index) => /* @__PURE__ */ React.createElement(AdHocFilterEditSwitch, {
|
20
|
-
key: index,
|
21
|
-
filter,
|
22
|
-
model
|
23
|
-
})), /* @__PURE__ */ React.createElement(AdHocCombobox, {
|
24
|
-
model,
|
25
|
-
wip: true
|
26
|
-
}));
|
27
|
-
}
|
28
|
-
const getStyles2 = (theme) => ({
|
29
|
-
wrapper: css({
|
30
|
-
display: "flex",
|
31
|
-
flexWrap: "wrap",
|
32
|
-
alignItems: "center",
|
33
|
-
columnGap: theme.spacing(1),
|
34
|
-
rowGap: theme.spacing(0.5),
|
35
|
-
minHeight: theme.spacing(4),
|
36
|
-
backgroundColor: theme.components.input.background,
|
37
|
-
border: `1px solid ${theme.colors.border.strong}`,
|
38
|
-
borderRadius: theme.shape.radius.default,
|
39
|
-
paddingInline: theme.spacing(1),
|
40
|
-
paddingBlock: theme.spacing(0.5),
|
41
|
-
flexGrow: 1,
|
42
|
-
"&:focus-within": {
|
43
|
-
outline: "2px dotted transparent",
|
44
|
-
outlineOffset: "2px",
|
45
|
-
boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
|
46
|
-
transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
|
47
|
-
transitionDuration: "0.2s",
|
48
|
-
transitionProperty: "outline, outline-offset, box-shadow"
|
49
|
-
}
|
50
|
-
}),
|
51
|
-
filterIcon: css({
|
52
|
-
color: theme.colors.text.secondary,
|
53
|
-
alignSelf: "center"
|
54
|
-
})
|
55
|
-
});
|
56
|
-
|
57
|
-
export { AdHocFiltersVariableRendererV2, AdHocFiltersVariableV2 };
|
58
|
-
//# sourceMappingURL=AdHocFiltersVariableV2.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"AdHocFiltersVariableV2.js","sources":["../../../../src/variables/adhoc/AdHocFiltersVariableV2.tsx"],"sourcesContent":["import { css } from '@emotion/css';\nimport { useStyles2, Icon } from '@grafana/ui';\nimport React from 'react';\nimport { SceneComponentProps } from '../../core/types';\nimport { AdHocCombobox, AdHocFilterEditSwitch } from './AdHocCombobox';\nimport { AdHocFiltersVariable } from './AdHocFiltersVariable';\nimport { GrafanaTheme2 } from '@grafana/data';\n\nexport class AdHocFiltersVariableV2 extends AdHocFiltersVariable {\n static Component = AdHocFiltersVariableRendererV2;\n}\n\nexport function AdHocFiltersVariableRendererV2({ model }: SceneComponentProps<AdHocFiltersVariable>) {\n const { filters } = model.useState();\n const styles = useStyles2(getStyles2);\n\n return (\n <div className={styles.wrapper}>\n <Icon name=\"filter\" className={styles.filterIcon} size=\"lg\" />\n\n {filters.map((filter, index) => (\n <AdHocFilterEditSwitch key={index} filter={filter} model={model} />\n ))}\n\n <AdHocCombobox model={model} wip />\n </div>\n );\n}\n\nconst getStyles2 = (theme: GrafanaTheme2) => ({\n wrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n columnGap: theme.spacing(1),\n rowGap: theme.spacing(0.5),\n minHeight: theme.spacing(4),\n backgroundColor: theme.components.input.background,\n border: `1px solid ${theme.colors.border.strong}`,\n borderRadius: theme.shape.radius.default,\n paddingInline: theme.spacing(1),\n paddingBlock: theme.spacing(0.5),\n flexGrow: 1,\n\n '&:focus-within': {\n outline: '2px dotted transparent',\n outlineOffset: '2px',\n boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,\n transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,\n transitionDuration: '0.2s',\n transitionProperty: 'outline, outline-offset, box-shadow',\n },\n }),\n filterIcon: css({\n color: theme.colors.text.secondary,\n alignSelf: 'center',\n }),\n});\n"],"names":[],"mappings":";;;;;;AAQO,MAAM,+BAA+B,oBAAqB,CAAA;AAEjE,CAAA;AAFa,sBAAA,CACJ,SAAY,GAAA,8BAAA,CAAA;AAGL,SAAA,8BAAA,CAA+B,EAAE,KAAA,EAAoD,EAAA;AACnG,EAAA,MAAM,EAAE,OAAA,EAAY,GAAA,KAAA,CAAM,QAAS,EAAA,CAAA;AACnC,EAAM,MAAA,MAAA,GAAS,WAAW,UAAU,CAAA,CAAA;AAEpC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IAAI,WAAW,MAAO,CAAA,OAAA;AAAA,GAAA,kBACpB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAK,IAAK,EAAA,QAAA;AAAA,IAAS,WAAW,MAAO,CAAA,UAAA;AAAA,IAAY,IAAK,EAAA,IAAA;AAAA,GAAK,GAE3D,OAAQ,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,0BACnB,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA;AAAA,IAAsB,GAAK,EAAA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