@grafana/scenes 5.4.1 → 5.4.2--canary.830.9989651797.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/variables/adhoc/AdHocCombobox.js +471 -0
- package/dist/esm/variables/adhoc/AdHocCombobox.js.map +1 -0
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +1 -4
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +59 -4
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +713 -197
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
@@ -0,0 +1,471 @@
|
|
1
|
+
import React, { forwardRef, useState, useRef, useCallback, useImperativeHandle, 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
|
+
const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, wip, handleChangeViewMode }, parentRef) {
|
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 handleResetWip = useCallback(() => {
|
67
|
+
if (wip) {
|
68
|
+
model._addWip();
|
69
|
+
setInputType("key");
|
70
|
+
setInputValue("");
|
71
|
+
}
|
72
|
+
}, [model, wip]);
|
73
|
+
const filterToUse = filter || _wip;
|
74
|
+
const operatorIdentifier = `${(_a = filterToUse == null ? void 0 : filterToUse.key) != null ? _a : ""}-operator`;
|
75
|
+
const { refs, floatingStyles, context } = useFloating({
|
76
|
+
whileElementsMounted: autoUpdate,
|
77
|
+
open,
|
78
|
+
onOpenChange: (nextOpen, _, reason) => {
|
79
|
+
setOpen(nextOpen);
|
80
|
+
if (["outside-press", "escape-key"].includes(reason || "")) {
|
81
|
+
handleResetWip();
|
82
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
83
|
+
}
|
84
|
+
},
|
85
|
+
middleware: [
|
86
|
+
flip({ padding: 10 }),
|
87
|
+
size({
|
88
|
+
apply({ rects, availableHeight, elements }) {
|
89
|
+
Object.assign(elements.floating.style, {
|
90
|
+
width: `${rects.reference.width}px`,
|
91
|
+
maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`
|
92
|
+
});
|
93
|
+
},
|
94
|
+
padding: 10
|
95
|
+
})
|
96
|
+
]
|
97
|
+
});
|
98
|
+
const role = useRole(context, { role: "listbox" });
|
99
|
+
const dismiss = useDismiss(context, {
|
100
|
+
outsidePress: (event) => {
|
101
|
+
return !event.currentTarget.classList.contains(
|
102
|
+
operatorIdentifier
|
103
|
+
);
|
104
|
+
}
|
105
|
+
});
|
106
|
+
const listNav = useListNavigation(context, {
|
107
|
+
listRef,
|
108
|
+
activeIndex,
|
109
|
+
onNavigate: setActiveIndex,
|
110
|
+
virtual: true,
|
111
|
+
loop: true
|
112
|
+
});
|
113
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNav]);
|
114
|
+
useImperativeHandle(parentRef, () => () => {
|
115
|
+
var _a2;
|
116
|
+
return (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
117
|
+
}, [refs.domReference]);
|
118
|
+
function onChange(event) {
|
119
|
+
var _a2, _b;
|
120
|
+
if (inputType === "key") {
|
121
|
+
const lastChar = event.target.value.slice(-1);
|
122
|
+
if (["=", "!", "<", ">"].includes(lastChar)) {
|
123
|
+
const key = event.target.value.slice(0, -1);
|
124
|
+
const optionIndex = options.findIndex((option) => option.value === key);
|
125
|
+
if (optionIndex >= 0) {
|
126
|
+
model._updateFilter(filterToUse, inputType, options[optionIndex]);
|
127
|
+
setInputValue(lastChar);
|
128
|
+
}
|
129
|
+
flushSync(() => {
|
130
|
+
setInputType("operator");
|
131
|
+
});
|
132
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
if (inputType === "operator") {
|
137
|
+
const lastChar = event.target.value.slice(-1);
|
138
|
+
if (/\w/.test(lastChar)) {
|
139
|
+
const operator = event.target.value.slice(0, -1);
|
140
|
+
if (!/\w/.test(operator)) {
|
141
|
+
const optionIndex = options.findIndex((option) => option.value === operator);
|
142
|
+
if (optionIndex >= 0) {
|
143
|
+
model._updateFilter(filterToUse, inputType, options[optionIndex]);
|
144
|
+
setInputValue(lastChar);
|
145
|
+
}
|
146
|
+
flushSync(() => {
|
147
|
+
setInputType("value");
|
148
|
+
});
|
149
|
+
(_b = refs.domReference.current) == null ? void 0 : _b.focus();
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
const value = event.target.value;
|
155
|
+
setInputValue(value);
|
156
|
+
setActiveIndex(0);
|
157
|
+
}
|
158
|
+
const items = options.filter(
|
159
|
+
(item) => {
|
160
|
+
var _a2, _b;
|
161
|
+
return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
|
162
|
+
}
|
163
|
+
);
|
164
|
+
const flushInputType = useCallback((inputType2) => {
|
165
|
+
flushSync(() => {
|
166
|
+
setInputType(inputType2);
|
167
|
+
});
|
168
|
+
}, []);
|
169
|
+
useEffect(() => {
|
170
|
+
if (wip && !_wip) {
|
171
|
+
model._addWip();
|
172
|
+
}
|
173
|
+
}, [_wip]);
|
174
|
+
useEffect(() => {
|
175
|
+
if (!wip && refs.domReference.current) {
|
176
|
+
setInputType("value");
|
177
|
+
setInputValue("");
|
178
|
+
refs.domReference.current.focus();
|
179
|
+
}
|
180
|
+
}, []);
|
181
|
+
const handleFetchOptions = useCallback(async () => {
|
182
|
+
let options2 = [];
|
183
|
+
if (inputType === "key") {
|
184
|
+
options2 = await model._getKeys(null);
|
185
|
+
} else if (inputType === "operator") {
|
186
|
+
options2 = model._getOperators();
|
187
|
+
} else if (inputType === "value") {
|
188
|
+
options2 = await model._getValuesFor(filterToUse);
|
189
|
+
}
|
190
|
+
setOptions(options2);
|
191
|
+
}, [filterToUse, inputType, model]);
|
192
|
+
const handleBackspaceInput = useCallback(
|
193
|
+
(event) => {
|
194
|
+
if (event.key === "Backspace" && !inputValue && inputType === "key") {
|
195
|
+
model._removeLastFilter();
|
196
|
+
setOpen(false);
|
197
|
+
}
|
198
|
+
},
|
199
|
+
[inputValue, inputType]
|
200
|
+
);
|
201
|
+
const handleTabInput = useCallback((event) => {
|
202
|
+
if (event.key === "Tab" && !event.shiftKey) {
|
203
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
204
|
+
handleResetWip();
|
205
|
+
}
|
206
|
+
}, []);
|
207
|
+
const handleShiftTabInput = useCallback((event) => {
|
208
|
+
if (event.key === "Tab" && event.shiftKey) {
|
209
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
210
|
+
handleResetWip();
|
211
|
+
}
|
212
|
+
}, []);
|
213
|
+
const handleEnterInput = useCallback(
|
214
|
+
(event) => {
|
215
|
+
var _a2;
|
216
|
+
if (event.key === "Enter" && activeIndex != null && items[activeIndex]) {
|
217
|
+
model._updateFilter(filterToUse, inputType, items[activeIndex]);
|
218
|
+
setInputValue("");
|
219
|
+
if (inputType === "key") {
|
220
|
+
flushInputType("operator");
|
221
|
+
} else if (inputType === "operator") {
|
222
|
+
flushInputType("value");
|
223
|
+
} else if (inputType === "value") {
|
224
|
+
flushInputType("key");
|
225
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
226
|
+
}
|
227
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
228
|
+
}
|
229
|
+
},
|
230
|
+
[activeIndex, filterToUse, inputType, items, model]
|
231
|
+
);
|
232
|
+
useEffect(() => {
|
233
|
+
if (open) {
|
234
|
+
handleFetchOptions();
|
235
|
+
}
|
236
|
+
}, [open, inputType]);
|
237
|
+
return /* @__PURE__ */ React.createElement("div", {
|
238
|
+
className: styles.comboboxWrapper
|
239
|
+
}, filterToUse ? /* @__PURE__ */ React.createElement("div", {
|
240
|
+
className: styles.pillWrapper
|
241
|
+
}, (filterToUse == null ? void 0 : filterToUse.key) ? /* @__PURE__ */ React.createElement("div", {
|
242
|
+
className: cx(styles.basePill, styles.keyPill)
|
243
|
+
}, filterToUse.key) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && inputType !== "operator" ? /* @__PURE__ */ React.createElement("div", {
|
244
|
+
className: cx(styles.basePill, operatorIdentifier),
|
245
|
+
role: "button",
|
246
|
+
"aria-label": "Edit filter operator",
|
247
|
+
tabIndex: 0,
|
248
|
+
onClick: (event) => {
|
249
|
+
var _a2;
|
250
|
+
event.stopPropagation();
|
251
|
+
flushInputType("operator");
|
252
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
253
|
+
},
|
254
|
+
onKeyDown: (event) => {
|
255
|
+
var _a2;
|
256
|
+
handleShiftTabInput(event);
|
257
|
+
if (event.key === "Enter") {
|
258
|
+
flushInputType("operator");
|
259
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
260
|
+
}
|
261
|
+
}
|
262
|
+
}, 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", {
|
263
|
+
className: cx(styles.basePill, styles.valuePill)
|
264
|
+
}, filterToUse.value) : null) : null, /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, getReferenceProps({
|
265
|
+
ref: refs.setReference,
|
266
|
+
onChange,
|
267
|
+
value: inputValue,
|
268
|
+
placeholder: !wip ? inputType === "operator" ? `${filterToUse[inputType]} ${filterToUse.value || ""}` : filterToUse[inputType] : "Filter by label values",
|
269
|
+
"aria-autocomplete": "list",
|
270
|
+
onKeyDown(event) {
|
271
|
+
if (inputType === "operator") {
|
272
|
+
handleShiftTabInput(event);
|
273
|
+
}
|
274
|
+
handleBackspaceInput(event);
|
275
|
+
handleTabInput(event);
|
276
|
+
handleEnterInput(event);
|
277
|
+
}
|
278
|
+
})), {
|
279
|
+
className: styles.inputStyle,
|
280
|
+
onClick: (event) => {
|
281
|
+
event.stopPropagation();
|
282
|
+
setOpen(true);
|
283
|
+
},
|
284
|
+
onFocus: () => {
|
285
|
+
setActiveIndex(0);
|
286
|
+
setOpen(true);
|
287
|
+
}
|
288
|
+
})), /* @__PURE__ */ React.createElement(FloatingPortal, null, open && /* @__PURE__ */ React.createElement(FloatingFocusManager, {
|
289
|
+
context,
|
290
|
+
initialFocus: -1,
|
291
|
+
visuallyHiddenDismiss: true
|
292
|
+
}, /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, getFloatingProps({
|
293
|
+
ref: refs.setFloating,
|
294
|
+
style: __spreadProps(__spreadValues({}, floatingStyles), {
|
295
|
+
overflowY: "auto"
|
296
|
+
})
|
297
|
+
})), {
|
298
|
+
className: styles.dropdownWrapper
|
299
|
+
}), items.map((item, index) => {
|
300
|
+
var _a2;
|
301
|
+
return /* @__PURE__ */ React.createElement(Item, __spreadProps(__spreadValues({}, getItemProps({
|
302
|
+
key: item.value,
|
303
|
+
ref(node) {
|
304
|
+
listRef.current[index] = node;
|
305
|
+
},
|
306
|
+
onClick() {
|
307
|
+
var _a3;
|
308
|
+
model._updateFilter(filterToUse, inputType, item);
|
309
|
+
setInputValue("");
|
310
|
+
if (inputType === "key") {
|
311
|
+
flushInputType("operator");
|
312
|
+
} else if (inputType === "operator") {
|
313
|
+
flushInputType("value");
|
314
|
+
} else if (inputType === "value") {
|
315
|
+
flushInputType("key");
|
316
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
317
|
+
}
|
318
|
+
(_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
|
319
|
+
}
|
320
|
+
})), {
|
321
|
+
active: activeIndex === index
|
322
|
+
}), (_a2 = item.label) != null ? _a2 : item.value);
|
323
|
+
})))));
|
324
|
+
});
|
325
|
+
const getStyles2 = (theme) => ({
|
326
|
+
comboboxWrapper: css({
|
327
|
+
display: "flex",
|
328
|
+
flexWrap: "nowrap"
|
329
|
+
}),
|
330
|
+
pillWrapper: css({
|
331
|
+
display: "flex",
|
332
|
+
alignItems: "center",
|
333
|
+
whiteSpace: "nowrap"
|
334
|
+
}),
|
335
|
+
basePill: css(__spreadProps(__spreadValues({
|
336
|
+
display: "flex",
|
337
|
+
alignItems: "center",
|
338
|
+
background: theme.colors.action.disabledBackground,
|
339
|
+
border: `1px solid ${theme.colors.border.weak}`,
|
340
|
+
padding: theme.spacing(0.125, 1, 0.125, 1),
|
341
|
+
color: theme.colors.text.primary,
|
342
|
+
overflow: "hidden",
|
343
|
+
whiteSpace: "nowrap",
|
344
|
+
minHeight: "22px"
|
345
|
+
}, theme.typography.bodySmall), {
|
346
|
+
cursor: "pointer"
|
347
|
+
})),
|
348
|
+
keyPill: css({
|
349
|
+
fontWeight: theme.typography.fontWeightBold,
|
350
|
+
cursor: "default"
|
351
|
+
}),
|
352
|
+
valuePill: css({
|
353
|
+
background: theme.colors.action.selected
|
354
|
+
}),
|
355
|
+
dropdownWrapper: css({
|
356
|
+
backgroundColor: theme.colors.background.primary,
|
357
|
+
color: theme.colors.text.primary,
|
358
|
+
boxShadow: theme.shadows.z2
|
359
|
+
}),
|
360
|
+
inputStyle: css({
|
361
|
+
paddingBlock: 0,
|
362
|
+
"&:focus": {
|
363
|
+
outline: "none"
|
364
|
+
}
|
365
|
+
})
|
366
|
+
});
|
367
|
+
function AdHocFilterEditSwitch({ filter, model }) {
|
368
|
+
const styles = useStyles2(getStyles3);
|
369
|
+
const [viewMode, setViewMode] = useState(true);
|
370
|
+
const pillWrapperRef = useRef(null);
|
371
|
+
const handleChangeViewMode = useCallback((event) => {
|
372
|
+
var _a;
|
373
|
+
event == null ? void 0 : event.stopPropagation();
|
374
|
+
let viewMode2 = false;
|
375
|
+
flushSync(() => {
|
376
|
+
setViewMode((mode) => {
|
377
|
+
viewMode2 = mode;
|
378
|
+
return !mode;
|
379
|
+
});
|
380
|
+
});
|
381
|
+
if (!viewMode2) {
|
382
|
+
(_a = pillWrapperRef.current) == null ? void 0 : _a.focus();
|
383
|
+
}
|
384
|
+
}, []);
|
385
|
+
if (viewMode) {
|
386
|
+
return /* @__PURE__ */ React.createElement("div", {
|
387
|
+
className: styles.combinedFilterPill,
|
388
|
+
onClick: handleChangeViewMode,
|
389
|
+
onKeyDown: (e) => {
|
390
|
+
if (e.key === "Enter") {
|
391
|
+
handleChangeViewMode();
|
392
|
+
}
|
393
|
+
},
|
394
|
+
role: "button",
|
395
|
+
"aria-label": "Edit filter",
|
396
|
+
tabIndex: 0,
|
397
|
+
ref: pillWrapperRef
|
398
|
+
}, /* @__PURE__ */ React.createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), /* @__PURE__ */ React.createElement(IconButton, {
|
399
|
+
onClick: (e) => {
|
400
|
+
e.stopPropagation();
|
401
|
+
model._removeFilter(filter);
|
402
|
+
},
|
403
|
+
onKeyDownCapture: (e) => {
|
404
|
+
if (e.key === "Enter") {
|
405
|
+
e.preventDefault();
|
406
|
+
e.stopPropagation();
|
407
|
+
model._removeFilter(filter);
|
408
|
+
}
|
409
|
+
},
|
410
|
+
name: "times",
|
411
|
+
size: "md",
|
412
|
+
className: styles.removeButton,
|
413
|
+
tooltip: "Remove filter"
|
414
|
+
}));
|
415
|
+
}
|
416
|
+
return /* @__PURE__ */ React.createElement(AdHocCombobox, {
|
417
|
+
filter,
|
418
|
+
model,
|
419
|
+
handleChangeViewMode
|
420
|
+
});
|
421
|
+
}
|
422
|
+
const getStyles3 = (theme) => ({
|
423
|
+
wrapper: css({
|
424
|
+
display: "flex",
|
425
|
+
flexWrap: "wrap",
|
426
|
+
alignItems: "center",
|
427
|
+
columnGap: theme.spacing(1),
|
428
|
+
rowGap: theme.spacing(1),
|
429
|
+
minHeight: theme.spacing(4),
|
430
|
+
backgroundColor: theme.components.input.background,
|
431
|
+
border: `1px solid ${theme.colors.border.strong}`,
|
432
|
+
borderRadius: theme.shape.radius.default,
|
433
|
+
paddingInline: theme.spacing(1),
|
434
|
+
"&:focus-within": {
|
435
|
+
outline: "2px dotted transparent",
|
436
|
+
outlineOffset: "2px",
|
437
|
+
boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
|
438
|
+
transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
|
439
|
+
transitionDuration: "0.2s",
|
440
|
+
transitionProperty: "outline, outline-offset, box-shadow"
|
441
|
+
}
|
442
|
+
}),
|
443
|
+
combinedFilterPill: css(__spreadProps(__spreadValues({
|
444
|
+
display: "flex",
|
445
|
+
alignItems: "center",
|
446
|
+
background: theme.colors.action.selected,
|
447
|
+
borderRadius: theme.shape.radius.default,
|
448
|
+
border: `1px solid ${theme.colors.border.weak}`,
|
449
|
+
padding: theme.spacing(0.125, 0, 0.125, 1),
|
450
|
+
color: theme.colors.text.primary,
|
451
|
+
overflow: "hidden",
|
452
|
+
whiteSpace: "nowrap",
|
453
|
+
minHeight: "22px"
|
454
|
+
}, theme.typography.bodySmall), {
|
455
|
+
fontWeight: theme.typography.fontWeightBold,
|
456
|
+
cursor: "pointer",
|
457
|
+
"&:hover": {
|
458
|
+
background: theme.colors.emphasize(theme.colors.background.secondary)
|
459
|
+
}
|
460
|
+
})),
|
461
|
+
removeButton: css({
|
462
|
+
marginInline: theme.spacing(0.5),
|
463
|
+
cursor: "pointer",
|
464
|
+
"&:hover": {
|
465
|
+
color: theme.colors.text.primary
|
466
|
+
}
|
467
|
+
})
|
468
|
+
});
|
469
|
+
|
470
|
+
export { AdHocCombobox, AdHocFilterEditSwitch };
|
471
|
+
//# sourceMappingURL=AdHocCombobox.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AdHocCombobox.js","sources":["../../../../src/variables/adhoc/AdHocCombobox.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useEffect, useImperativeHandle, 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 const AdHocCombobox = forwardRef(function AdHocCombobox(\n { filter, model, wip, handleChangeViewMode }: AdHocComboboxProps,\n parentRef\n) {\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 handleResetWip = useCallback(() => {\n if (wip) {\n model._addWip();\n setInputType('key');\n setInputValue('');\n }\n }, [model, wip]);\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 (['outside-press', 'escape-key'].includes(reason || '')) {\n handleResetWip();\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 // pass ability to focus on input element back to parent\n useImperativeHandle(parentRef, () => () => refs.domReference.current?.focus(), [refs.domReference]);\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 const handleFetchOptions = useCallback(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 setOptions(options);\n }, [filterToUse, inputType, model]);\n\n const handleBackspaceInput = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key === 'Backspace' && !inputValue && inputType === 'key') {\n model._removeLastFilter();\n setOpen(false);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [inputValue, inputType]\n );\n\n const handleTabInput = useCallback((event: React.KeyboardEvent) => {\n // change filter to view mode when navigating away with Tab key\n // this is needed because useDismiss only reacts to mousedown\n if (event.key === 'Tab' && !event.shiftKey) {\n handleChangeViewMode?.();\n handleResetWip();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleShiftTabInput = useCallback((event: React.KeyboardEvent) => {\n if (event.key === 'Tab' && event.shiftKey) {\n handleChangeViewMode?.();\n handleResetWip();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleEnterInput = useCallback(\n (event: React.KeyboardEvent) => {\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 // eslint-disable-next-line react-hooks/exhaustive-deps\n [activeIndex, filterToUse, inputType, items, model]\n );\n\n useEffect(() => {\n if (open) {\n handleFetchOptions();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, inputType]);\n\n return (\n <div className={styles.comboboxWrapper}>\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={(event) => {\n event.stopPropagation();\n flushInputType('operator');\n\n refs.domReference.current?.focus();\n }}\n onKeyDown={(event) => {\n handleShiftTabInput(event);\n if (event.key === 'Enter') {\n flushInputType('operator');\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 (inputType === 'operator') {\n handleShiftTabInput(event);\n }\n handleBackspaceInput(event);\n handleTabInput(event);\n handleEnterInput(event);\n },\n })}\n className={styles.inputStyle}\n onClick={(event) => {\n event.stopPropagation();\n setOpen(true);\n }}\n onFocus={() => {\n setActiveIndex(0);\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 </div>\n );\n});\n\nconst getStyles2 = (theme: GrafanaTheme2) => ({\n comboboxWrapper: css({\n display: 'flex',\n flexWrap: 'nowrap',\n }),\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 pillWrapperRef = useRef<HTMLDivElement>(null);\n\n const handleChangeViewMode = useCallback((event?: React.MouseEvent) => {\n event?.stopPropagation();\n let viewMode = false;\n flushSync(() => {\n setViewMode((mode) => {\n viewMode = mode;\n return !mode;\n });\n });\n if (!viewMode) {\n pillWrapperRef.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={pillWrapperRef}\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 onKeyDownCapture={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n model._removeFilter(filter);\n }\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":["AdHocCombobox","_a","inputType","options","viewMode"],"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,CAAA,CAAA;AAAA,KAAA,kBAC7F,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAM,QAAS,CAClB,CACF,CAAA,CAAA;AAAA,GAEJ;AACF,CAAA,CAAA;AAWa,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AA;AAAA,IACzC,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,IACzB,QAAU,EAAA,QAAA;AAAA,IACV,UAAY,EAAA,QAAA;AAAA,IACZ,SAAW,EAAA,MAAA;AAAA,GACR,EAAA,KAAA,CAAM,WAAW,SAXE,CAAA,EAAA;AAAA,IAYtB,UAAA,EAAY,MAAM,UAAW,CAAA,cAAA;AAAA,IAC7B,MAAQ,EAAA,SAAA;AAAA,IAER,SAAW,EAAA;AAAA,MACT,YAAY,KAAM,CAAA,MAAA,CAAO,UAAU,KAAM,CAAA,MAAA,CAAO,WAAW,SAAS,CAAA;AAAA,KACtE;AAAA,GACD,CAAA,CAAA;AAAA,EACD,cAAc,GAAI,CAAA;AAAA,IAChB,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC/B,MAAQ,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;;;;"}
|
@@ -25,10 +25,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
25
25
|
const [valueHasCustomValue, setValueHasCustomValue] = useState(false);
|
26
26
|
const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
|
27
27
|
const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
|
28
|
-
const optionSearcher = useMemo(
|
29
|
-
() => getAdhocOptionSearcher(values),
|
30
|
-
[values]
|
31
|
-
);
|
28
|
+
const optionSearcher = useMemo(() => getAdhocOptionSearcher(values), [values]);
|
32
29
|
const onValueInputChange = (value, { action }) => {
|
33
30
|
if (action === "input-change") {
|
34
31
|
setValueInputValue(value);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AdHocFilterRenderer.js","sources":["../../../../src/variables/adhoc/AdHocFilterRenderer.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\n\nimport { AdHocFiltersVariable, AdHocFilterWithLabels } from './AdHocFiltersVariable';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Button, Field, InputActionMeta, Select, useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { ControlsLabel } from '../../utils/ControlsLabel';\nimport { getAdhocOptionSearcher } from './getAdhocOptionSearcher';\nimport { handleOptionGroups } from '../utils';\n\ninterface Props {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n}\n\nfunction keyLabelToOption(key: string, label?: string): SelectableValue | null {\n return key !== ''\n ? {\n value: key,\n label: label || key,\n }\n : null;\n}\n\nconst filterNoOp = () => true;\n\nexport function AdHocFilterRenderer({ filter, model }: Props) {\n const styles = useStyles2(getStyles);\n\n const [keys, setKeys] = useState<SelectableValue[]>([]);\n const [values, setValues] = useState<SelectableValue[]>([]);\n const [isKeysLoading, setIsKeysLoading] = useState(false);\n const [isValuesLoading, setIsValuesLoading] = useState(false);\n const [isKeysOpen, setIsKeysOpen] = useState(false);\n const [isValuesOpen, setIsValuesOpen] = useState(false);\n const [valueInputValue, setValueInputValue] = useState('');\n const [valueHasCustomValue, setValueHasCustomValue] = useState(false);\n\n const keyValue = keyLabelToOption(filter.key, filter.keyLabel);\n const valueValue = keyLabelToOption(filter.value, filter.valueLabel);\n\n const optionSearcher = useMemo(\n () => getAdhocOptionSearcher(values),\n [values]\n );\n\n const onValueInputChange = (value: string, { action }: InputActionMeta) => {\n if (action === 'input-change') {\n setValueInputValue(value);\n }\n return value;\n };\n\n const filteredValueOptions = useMemo(\n () => handleOptionGroups(optionSearcher(valueInputValue)),\n [optionSearcher, valueInputValue]\n );\n\n const valueSelect = (\n <Select\n virtualized\n allowCustomValue\n isValidNewOption={(inputValue) => inputValue.trim().length > 0}\n allowCreateWhileLoading\n formatCreateLabel={(inputValue) => `Use custom value: ${inputValue}`}\n disabled={model.state.readOnly}\n className={cx(styles.value, isKeysOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n value={valueValue}\n filterOption={filterNoOp}\n placeholder={'Select value'}\n options={filteredValueOptions}\n inputValue={valueInputValue}\n onInputChange={onValueInputChange}\n onChange={(v) => {\n model._updateFilter(filter, 'value', v);\n\n if (valueHasCustomValue !== v.__isNew__) {\n setValueHasCustomValue(v.__isNew__);\n }\n }}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isValuesOpen && !isValuesLoading}\n isLoading={isValuesLoading}\n autoFocus={filter.key !== '' && filter.value === ''}\n openMenuOnFocus={true}\n onOpenMenu={async () => {\n setIsValuesLoading(true);\n setIsValuesOpen(true);\n const values = await model._getValuesFor(filter);\n setIsValuesLoading(false);\n setValues(values);\n if (valueHasCustomValue) {\n setValueInputValue(valueValue?.label ?? '');\n }\n }}\n onCloseMenu={() => {\n setIsValuesOpen(false);\n setValueInputValue('');\n }}\n />\n );\n\n const keySelect = (\n <Select\n // By changing the key, we reset the Select component,\n // to ensure that the loaded values are shown after they are loaded\n key={`${isValuesLoading ? 'loading' : 'loaded'}`}\n disabled={model.state.readOnly}\n className={cx(styles.key, isKeysOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n value={keyValue}\n placeholder={'Select label'}\n options={handleOptionGroups(keys)}\n onChange={(v) => model._updateFilter(filter, 'key', v)}\n autoFocus={filter.key === ''}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isKeysOpen && !isKeysLoading}\n isLoading={isKeysLoading}\n onOpenMenu={async () => {\n setIsKeysOpen(true);\n setIsKeysLoading(true);\n const keys = await model._getKeys(filter.key);\n setIsKeysLoading(false);\n setKeys(keys);\n }}\n onCloseMenu={() => {\n setIsKeysOpen(false);\n }}\n onBlur={() => {\n if (filter.key === '') {\n model._removeFilter(filter);\n }\n }}\n openMenuOnFocus={true}\n />\n );\n\n if (model.state.layout === 'vertical') {\n if (filter.key) {\n const label = (\n <ControlsLabel layout=\"vertical\" label={filter.key ?? ''} onRemove={() => model._removeFilter(filter)} />\n );\n\n return (\n <Field label={label} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n <div className={styles.wrapper}>\n <Select\n className={styles.operator}\n value={filter.operator}\n disabled={model.state.readOnly}\n options={model._getOperators()}\n width=\"auto\"\n onChange={(v) => model._updateFilter(filter, 'operator', v)}\n />\n {valueSelect}\n </div>\n </Field>\n );\n } else {\n return (\n <Field label={'Select label'} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n {keySelect}\n </Field>\n );\n }\n }\n\n return (\n <div className={styles.wrapper} data-testid={`AdHocFilter-${filter.key}`}>\n {keySelect}\n <Select\n className={styles.operator}\n value={filter.operator}\n disabled={model.state.readOnly}\n options={model._getOperators()}\n width=\"auto\"\n onChange={(v) => model._updateFilter(filter, 'operator', v)}\n />\n {valueSelect}\n <Button\n variant=\"secondary\"\n aria-label=\"Remove filter\"\n title=\"Remove filter\"\n className={styles.removeButton}\n icon=\"times\"\n data-testid={`AdHocFilter-remove-${filter.key ?? ''}`}\n onClick={() => model._removeFilter(filter)}\n />\n </div>\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n field: css({\n marginBottom: 0,\n }),\n wrapper: css({\n display: 'flex',\n '> *': {\n '&:not(:first-child)': {\n // Negative margin hides the double-border on adjacent selects\n marginLeft: -1,\n },\n\n '&:first-child': {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n '&:last-child': {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n\n '&:not(:first-child):not(:last-child)': {\n borderRadius: 0,\n },\n\n // Fix focus state zIndex issues\n position: 'relative',\n zIndex: 0,\n\n // Adjacent borders are overlapping, so raise children up when hovering etc\n // so all that child's borders are visible.\n '&:hover': {\n zIndex: 1,\n },\n\n '&:focus-within': {\n zIndex: 2,\n },\n },\n }),\n widthWhenOpen: css({\n minWidth: theme.spacing(16),\n }),\n value: css({\n flexShrink: 1,\n }),\n key: css({\n minWidth: '90px',\n flexShrink: 1,\n }),\n operator: css({\n flexShrink: 0,\n }),\n removeButton: css({\n paddingLeft: theme.spacing(3 / 2),\n paddingRight: theme.spacing(3 / 2),\n borderLeft: 'none',\n width: theme.spacing(3),\n marginRight: theme.spacing(1),\n boxSizing: 'border-box',\n // To not have button background and last select border intersect\n position: 'relative',\n left: '1px',\n }),\n});\n"],"names":["_a","values","keys"],"mappings":";;;;;;;AAeA,SAAS,gBAAA,CAAiB,KAAa,KAAwC,EAAA;AAC7E,EAAA,OAAO,QAAQ,EACX,GAAA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,OAAO,KAAS,IAAA,GAAA;AAAA,GAElB,GAAA,IAAA,CAAA;AACN,CAAA;AAEA,MAAM,aAAa,MAAM,IAAA,CAAA;AAElB,SAAS,mBAAoB,CAAA,EAAE,MAAQ,EAAA,KAAA,EAAgB,EAAA;AA1B9D,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA2BE,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AAEnC,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAA,QAAA,CAA4B,EAAE,CAAA,CAAA;AACtD,EAAA,MAAM,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAA,QAAA,CAA4B,EAAE,CAAA,CAAA;AAC1D,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACxD,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAC5D,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAClD,EAAA,MAAM,CAAC,YAAA,E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AA;AAAA,IACjC,UAAY,EAAA,MAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACtB,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC5B,SAAW,EAAA,YAAA;AAAA,IAEX,QAAU,EAAA,UAAA;AAAA,IACV,IAAM,EAAA,KAAA;AAAA,GACP,CAAA;AACH,CAAA,CAAA;;;;"}
|
1
|
+
{"version":3,"file":"AdHocFilterRenderer.js","sources":["../../../../src/variables/adhoc/AdHocFilterRenderer.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\n\nimport { AdHocFiltersVariable, AdHocFilterWithLabels } from './AdHocFiltersVariable';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Button, Field, InputActionMeta, Select, useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { ControlsLabel } from '../../utils/ControlsLabel';\nimport { getAdhocOptionSearcher } from './getAdhocOptionSearcher';\nimport { handleOptionGroups } from '../utils';\n\ninterface Props {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n}\n\nfunction keyLabelToOption(key: string, label?: string): SelectableValue | null {\n return key !== ''\n ? {\n value: key,\n label: label || key,\n }\n : null;\n}\n\nconst filterNoOp = () => true;\n\nexport function AdHocFilterRenderer({ filter, model }: Props) {\n const styles = useStyles2(getStyles);\n\n const [keys, setKeys] = useState<SelectableValue[]>([]);\n const [values, setValues] = useState<SelectableValue[]>([]);\n const [isKeysLoading, setIsKeysLoading] = useState(false);\n const [isValuesLoading, setIsValuesLoading] = useState(false);\n const [isKeysOpen, setIsKeysOpen] = useState(false);\n const [isValuesOpen, setIsValuesOpen] = useState(false);\n const [valueInputValue, setValueInputValue] = useState('');\n const [valueHasCustomValue, setValueHasCustomValue] = useState(false);\n\n const keyValue = keyLabelToOption(filter.key, filter.keyLabel);\n const valueValue = keyLabelToOption(filter.value, filter.valueLabel);\n\n const optionSearcher = useMemo(() => getAdhocOptionSearcher(values), [values]);\n\n const onValueInputChange = (value: string, { action }: InputActionMeta) => {\n if (action === 'input-change') {\n setValueInputValue(value);\n }\n return value;\n };\n\n const filteredValueOptions = useMemo(\n () => handleOptionGroups(optionSearcher(valueInputValue)),\n [optionSearcher, valueInputValue]\n );\n\n const valueSelect = (\n <Select\n virtualized\n allowCustomValue\n isValidNewOption={(inputValue) => inputValue.trim().length > 0}\n allowCreateWhileLoading\n formatCreateLabel={(inputValue) => `Use custom value: ${inputValue}`}\n disabled={model.state.readOnly}\n className={cx(styles.value, isKeysOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n value={valueValue}\n filterOption={filterNoOp}\n placeholder={'Select value'}\n options={filteredValueOptions}\n inputValue={valueInputValue}\n onInputChange={onValueInputChange}\n onChange={(v) => {\n model._updateFilter(filter, 'value', v);\n\n if (valueHasCustomValue !== v.__isNew__) {\n setValueHasCustomValue(v.__isNew__);\n }\n }}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isValuesOpen && !isValuesLoading}\n isLoading={isValuesLoading}\n autoFocus={filter.key !== '' && filter.value === ''}\n openMenuOnFocus={true}\n onOpenMenu={async () => {\n setIsValuesLoading(true);\n setIsValuesOpen(true);\n const values = await model._getValuesFor(filter);\n setIsValuesLoading(false);\n setValues(values);\n if (valueHasCustomValue) {\n setValueInputValue(valueValue?.label ?? '');\n }\n }}\n onCloseMenu={() => {\n setIsValuesOpen(false);\n setValueInputValue('');\n }}\n />\n );\n\n const keySelect = (\n <Select\n // By changing the key, we reset the Select component,\n // to ensure that the loaded values are shown after they are loaded\n key={`${isValuesLoading ? 'loading' : 'loaded'}`}\n disabled={model.state.readOnly}\n className={cx(styles.key, isKeysOpen ? styles.widthWhenOpen : undefined)}\n width=\"auto\"\n value={keyValue}\n placeholder={'Select label'}\n options={handleOptionGroups(keys)}\n onChange={(v) => model._updateFilter(filter, 'key', v)}\n autoFocus={filter.key === ''}\n // there's a bug in react-select where the menu doesn't recalculate its position when the options are loaded asynchronously\n // see https://github.com/grafana/grafana/issues/63558\n // instead, we explicitly control the menu visibility and prevent showing it until the options have fully loaded\n isOpen={isKeysOpen && !isKeysLoading}\n isLoading={isKeysLoading}\n onOpenMenu={async () => {\n setIsKeysOpen(true);\n setIsKeysLoading(true);\n const keys = await model._getKeys(filter.key);\n setIsKeysLoading(false);\n setKeys(keys);\n }}\n onCloseMenu={() => {\n setIsKeysOpen(false);\n }}\n onBlur={() => {\n if (filter.key === '') {\n model._removeFilter(filter);\n }\n }}\n openMenuOnFocus={true}\n />\n );\n\n if (model.state.layout === 'vertical') {\n if (filter.key) {\n const label = (\n <ControlsLabel layout=\"vertical\" label={filter.key ?? ''} onRemove={() => model._removeFilter(filter)} />\n );\n\n return (\n <Field label={label} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n <div className={styles.wrapper}>\n <Select\n className={styles.operator}\n value={filter.operator}\n disabled={model.state.readOnly}\n options={model._getOperators()}\n width=\"auto\"\n onChange={(v) => model._updateFilter(filter, 'operator', v)}\n />\n {valueSelect}\n </div>\n </Field>\n );\n } else {\n return (\n <Field label={'Select label'} data-testid={`AdHocFilter-${filter.key}`} className={styles.field}>\n {keySelect}\n </Field>\n );\n }\n }\n\n return (\n <div className={styles.wrapper} data-testid={`AdHocFilter-${filter.key}`}>\n {keySelect}\n <Select\n className={styles.operator}\n value={filter.operator}\n disabled={model.state.readOnly}\n options={model._getOperators()}\n width=\"auto\"\n onChange={(v) => model._updateFilter(filter, 'operator', v)}\n />\n {valueSelect}\n <Button\n variant=\"secondary\"\n aria-label=\"Remove filter\"\n title=\"Remove filter\"\n className={styles.removeButton}\n icon=\"times\"\n data-testid={`AdHocFilter-remove-${filter.key ?? ''}`}\n onClick={() => model._removeFilter(filter)}\n />\n </div>\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n field: css({\n marginBottom: 0,\n }),\n wrapper: css({\n display: 'flex',\n '> *': {\n '&:not(:first-child)': {\n // Negative margin hides the double-border on adjacent selects\n marginLeft: -1,\n },\n\n '&:first-child': {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n '&:last-child': {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n\n '&:not(:first-child):not(:last-child)': {\n borderRadius: 0,\n },\n\n // Fix focus state zIndex issues\n position: 'relative',\n zIndex: 0,\n\n // Adjacent borders are overlapping, so raise children up when hovering etc\n // so all that child's borders are visible.\n '&:hover': {\n zIndex: 1,\n },\n\n '&:focus-within': {\n zIndex: 2,\n },\n },\n }),\n widthWhenOpen: css({\n minWidth: theme.spacing(16),\n }),\n value: css({\n flexShrink: 1,\n }),\n key: css({\n minWidth: '90px',\n flexShrink: 1,\n }),\n operator: css({\n flexShrink: 0,\n }),\n removeButton: css({\n paddingLeft: theme.spacing(3 / 2),\n paddingRight: theme.spacing(3 / 2),\n borderLeft: 'none',\n width: theme.spacing(3),\n marginRight: theme.spacing(1),\n boxSizing: 'border-box',\n // To not have button background and last select border intersect\n position: 'relative',\n left: '1px',\n }),\n});\n"],"names":["_a","values","keys"],"mappings":";;;;;;;AAeA,SAAS,gBAAA,CAAiB,KAAa,KAAwC,EAAA;AAC7E,EAAA,OAAO,QAAQ,EACX,GAAA;AAAA,IACE,KAAO,EAAA,GAAA;AAAA,IACP,OAAO,KAAS,IAAA,GAAA;AAAA,GAElB,GAAA,IAAA,CAAA;AACN,CAAA;AAEA,MAAM,aAAa,MAAM,IAAA,CAAA;AAElB,SAAS,mBAAoB,CAAA,EAAE,MAAQ,EAAA,KAAA,EAAgB,EAAA;AA1B9D,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA2BE,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AAEnC,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAA,QAAA,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