@grafana/scenes 4.11.2--canary.690.8734061653.0 → 4.11.2--canary.687.8737546972.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +20 -12
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +5 -8
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +12 -36
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +55 -3
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/variables/sets/SceneVariableSet.js +3 -0
- package/dist/esm/variables/sets/SceneVariableSet.js.map +1 -1
- package/dist/esm/variables/types.js.map +1 -1
- package/dist/esm/variables/utils.js +20 -2
- package/dist/esm/variables/utils.js.map +1 -1
- package/dist/esm/variables/variants/TestVariable.js +3 -1
- package/dist/esm/variables/variants/TestVariable.js.map +1 -1
- package/dist/index.d.ts +16 -13
- package/dist/index.js +184 -132
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2840,79 +2840,6 @@ class CustomAllValue {
|
|
|
2840
2840
|
}
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
|
-
function VariableValueSelect({ model }) {
|
|
2844
|
-
const { value, key } = model.useState();
|
|
2845
|
-
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
2846
|
-
if (meta.action === "input-change") {
|
|
2847
|
-
model.onSearchChange(value2);
|
|
2848
|
-
}
|
|
2849
|
-
} : void 0;
|
|
2850
|
-
return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
|
|
2851
|
-
id: key,
|
|
2852
|
-
placeholder: "Select value",
|
|
2853
|
-
width: "auto",
|
|
2854
|
-
value,
|
|
2855
|
-
allowCustomValue: true,
|
|
2856
|
-
virtualized: true,
|
|
2857
|
-
tabSelectsValue: false,
|
|
2858
|
-
onInputChange,
|
|
2859
|
-
options: model.getOptionsForSelect(),
|
|
2860
|
-
onChange: (newValue) => {
|
|
2861
|
-
model.changeValueTo(newValue.value, newValue.label);
|
|
2862
|
-
}
|
|
2863
|
-
});
|
|
2864
|
-
}
|
|
2865
|
-
function VariableValueSelectMulti({ model }) {
|
|
2866
|
-
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
2867
|
-
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
2868
|
-
const options = model.getOptionsForSelect();
|
|
2869
|
-
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
2870
|
-
React.useEffect(() => {
|
|
2871
|
-
setUncommittedValue(arrayValue);
|
|
2872
|
-
}, [arrayValue]);
|
|
2873
|
-
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
2874
|
-
if (meta.action === "input-change") {
|
|
2875
|
-
model.onSearchChange(value2);
|
|
2876
|
-
}
|
|
2877
|
-
} : void 0;
|
|
2878
|
-
const placeholder = options.length > 0 ? "Select value" : "";
|
|
2879
|
-
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
2880
|
-
id: key,
|
|
2881
|
-
placeholder,
|
|
2882
|
-
width: "auto",
|
|
2883
|
-
value: uncommittedValue,
|
|
2884
|
-
noMultiValueWrap: true,
|
|
2885
|
-
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
2886
|
-
tabSelectsValue: false,
|
|
2887
|
-
virtualized: true,
|
|
2888
|
-
allowCustomValue: true,
|
|
2889
|
-
options: model.getOptionsForSelect(),
|
|
2890
|
-
closeMenuOnSelect: false,
|
|
2891
|
-
isClearable: true,
|
|
2892
|
-
onInputChange,
|
|
2893
|
-
onBlur: () => {
|
|
2894
|
-
model.changeValueTo(uncommittedValue);
|
|
2895
|
-
},
|
|
2896
|
-
onChange: (newValue, action) => {
|
|
2897
|
-
if (action.action === "clear" && noValueOnClear) {
|
|
2898
|
-
model.changeValueTo([]);
|
|
2899
|
-
}
|
|
2900
|
-
setUncommittedValue(newValue.map((x) => x.value));
|
|
2901
|
-
}
|
|
2902
|
-
});
|
|
2903
|
-
}
|
|
2904
|
-
function renderSelectForVariable(model) {
|
|
2905
|
-
if (model.state.isMulti) {
|
|
2906
|
-
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
|
|
2907
|
-
model
|
|
2908
|
-
});
|
|
2909
|
-
} else {
|
|
2910
|
-
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
|
|
2911
|
-
model
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
|
-
}
|
|
2915
|
-
|
|
2916
2843
|
var __defProp$z = Object.defineProperty;
|
|
2917
2844
|
var __defProps$n = Object.defineProperties;
|
|
2918
2845
|
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
|
@@ -2948,6 +2875,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
2948
2875
|
}, initialState), {
|
|
2949
2876
|
noValueOnClear: true
|
|
2950
2877
|
}));
|
|
2878
|
+
this.isLazy = true;
|
|
2951
2879
|
this._getKeys = async (ds) => {
|
|
2952
2880
|
var _a, _b, _c;
|
|
2953
2881
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, null));
|
|
@@ -3033,7 +2961,56 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3033
2961
|
}
|
|
3034
2962
|
GroupByVariable.Component = GroupByVariableRenderer;
|
|
3035
2963
|
function GroupByVariableRenderer({ model }) {
|
|
3036
|
-
|
|
2964
|
+
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
2965
|
+
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
2966
|
+
const [isFetchingOptions, setIsFetchingOptions] = React.useState(false);
|
|
2967
|
+
const [isOptionsOpen, setIsOptionsOpen] = React.useState(false);
|
|
2968
|
+
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
2969
|
+
React.useEffect(() => {
|
|
2970
|
+
setUncommittedValue(arrayValue);
|
|
2971
|
+
}, [arrayValue]);
|
|
2972
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
2973
|
+
if (meta.action === "input-change") {
|
|
2974
|
+
model.onSearchChange(value2);
|
|
2975
|
+
}
|
|
2976
|
+
} : void 0;
|
|
2977
|
+
const placeholder = "Select value";
|
|
2978
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
2979
|
+
"data-testid": `GroupBySelect-${key}`,
|
|
2980
|
+
id: key,
|
|
2981
|
+
placeholder,
|
|
2982
|
+
width: "auto",
|
|
2983
|
+
value: uncommittedValue,
|
|
2984
|
+
noMultiValueWrap: true,
|
|
2985
|
+
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
2986
|
+
tabSelectsValue: false,
|
|
2987
|
+
virtualized: true,
|
|
2988
|
+
allowCustomValue: true,
|
|
2989
|
+
options: model.getOptionsForSelect(),
|
|
2990
|
+
closeMenuOnSelect: false,
|
|
2991
|
+
isOpen: isOptionsOpen,
|
|
2992
|
+
isClearable: true,
|
|
2993
|
+
isLoading: isFetchingOptions,
|
|
2994
|
+
onInputChange,
|
|
2995
|
+
onBlur: () => {
|
|
2996
|
+
model.changeValueTo(uncommittedValue);
|
|
2997
|
+
},
|
|
2998
|
+
onChange: (newValue, action) => {
|
|
2999
|
+
if (action.action === "clear" && noValueOnClear) {
|
|
3000
|
+
model.changeValueTo([]);
|
|
3001
|
+
}
|
|
3002
|
+
setUncommittedValue(newValue.map((x) => x.value));
|
|
3003
|
+
},
|
|
3004
|
+
onOpenMenu: async () => {
|
|
3005
|
+
setIsFetchingOptions(true);
|
|
3006
|
+
await rxjs.lastValueFrom(model.validateAndUpdate());
|
|
3007
|
+
setIsFetchingOptions(false);
|
|
3008
|
+
setIsOptionsOpen(true);
|
|
3009
|
+
},
|
|
3010
|
+
onCloseMenu: () => {
|
|
3011
|
+
setIsOptionsOpen(false);
|
|
3012
|
+
}
|
|
3013
|
+
});
|
|
3037
3014
|
}
|
|
3038
3015
|
|
|
3039
3016
|
function LoadingIndicator(props) {
|
|
@@ -3168,18 +3145,24 @@ var __spreadValues$y = (a, b) => {
|
|
|
3168
3145
|
return a;
|
|
3169
3146
|
};
|
|
3170
3147
|
var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
|
|
3171
|
-
function keyLabelToOption(key, label) {
|
|
3172
|
-
return key !== "" ? {
|
|
3173
|
-
value: key,
|
|
3174
|
-
label: label || key
|
|
3175
|
-
} : null;
|
|
3176
|
-
}
|
|
3177
3148
|
function AdHocFilterRenderer({ filter, model }) {
|
|
3178
3149
|
var _a, _b;
|
|
3179
3150
|
const styles = ui.useStyles2(getStyles$7);
|
|
3180
3151
|
const [state, setState] = React.useState({});
|
|
3181
|
-
const keyValue =
|
|
3182
|
-
|
|
3152
|
+
const keyValue = React.useMemo(() => {
|
|
3153
|
+
if (filter.key !== "") {
|
|
3154
|
+
if (model.state.defaultKeys) {
|
|
3155
|
+
const matchingDefaultKey = model.state.defaultKeys.find((option) => option.value === filter.key);
|
|
3156
|
+
if (matchingDefaultKey) {
|
|
3157
|
+
return toSelectableValue(matchingDefaultKey);
|
|
3158
|
+
}
|
|
3159
|
+
} else {
|
|
3160
|
+
return data.toOption(filter.key);
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
return null;
|
|
3164
|
+
}, [filter.key, model.state.defaultKeys]);
|
|
3165
|
+
const valueValue = filter.value !== "" ? data.toOption(filter.value) : null;
|
|
3183
3166
|
const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
|
|
3184
3167
|
allowCustomValue: true,
|
|
3185
3168
|
formatCreateLabel: (inputValue) => `Use custom value: ${inputValue}`,
|
|
@@ -3189,7 +3172,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
3189
3172
|
value: valueValue,
|
|
3190
3173
|
placeholder: "Select value",
|
|
3191
3174
|
options: state.values,
|
|
3192
|
-
onChange: (v) => model._updateFilter(filter, "value", v),
|
|
3175
|
+
onChange: (v) => model._updateFilter(filter, "value", v.value),
|
|
3193
3176
|
isOpen: state.isValuesOpen,
|
|
3194
3177
|
isLoading: state.isValuesLoading,
|
|
3195
3178
|
autoFocus: filter.key !== "" && filter.value === "",
|
|
@@ -3211,7 +3194,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
3211
3194
|
value: keyValue,
|
|
3212
3195
|
placeholder: "Select label",
|
|
3213
3196
|
options: state.keys,
|
|
3214
|
-
onChange: (v) => model._updateFilter(filter, "key", v),
|
|
3197
|
+
onChange: (v) => model._updateFilter(filter, "key", v.value),
|
|
3215
3198
|
autoFocus: filter.key === "",
|
|
3216
3199
|
isOpen: state.isKeysOpen,
|
|
3217
3200
|
isLoading: state.isKeysLoading,
|
|
@@ -3258,7 +3241,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
3258
3241
|
disabled: model.state.readOnly,
|
|
3259
3242
|
options: model._getOperators(),
|
|
3260
3243
|
width: "auto",
|
|
3261
|
-
onChange: (v) => model._updateFilter(filter, "operator", v)
|
|
3244
|
+
onChange: (v) => model._updateFilter(filter, "operator", v.value)
|
|
3262
3245
|
}), valueSelect, /* @__PURE__ */ React__default["default"].createElement(ui.Button, {
|
|
3263
3246
|
variant: "secondary",
|
|
3264
3247
|
"aria-label": "Remove filter",
|
|
@@ -3345,7 +3328,7 @@ class AdHocFiltersVariableUrlSyncHandler {
|
|
|
3345
3328
|
if (filters.length === 0) {
|
|
3346
3329
|
return { [this.getKey()]: [""] };
|
|
3347
3330
|
}
|
|
3348
|
-
const value = filters.map((filter) => toArray(filter).map(
|
|
3331
|
+
const value = filters.map((filter) => toArray(filter).map(escapeDelimiter).join("|"));
|
|
3349
3332
|
return { [this.getKey()]: value };
|
|
3350
3333
|
}
|
|
3351
3334
|
updateFromUrl(values) {
|
|
@@ -3365,54 +3348,30 @@ function deserializeUrlToFilters(value) {
|
|
|
3365
3348
|
const filter = toFilter(value);
|
|
3366
3349
|
return filter === null ? [] : [filter];
|
|
3367
3350
|
}
|
|
3368
|
-
function
|
|
3351
|
+
function escapeDelimiter(value) {
|
|
3369
3352
|
if (value === null || value === void 0) {
|
|
3370
3353
|
return "";
|
|
3371
3354
|
}
|
|
3372
|
-
return
|
|
3355
|
+
return /\|/g[Symbol.replace](value, "__gfp__");
|
|
3373
3356
|
}
|
|
3374
|
-
function
|
|
3357
|
+
function unescapeDelimiter(value) {
|
|
3375
3358
|
if (value === null || value === void 0) {
|
|
3376
3359
|
return "";
|
|
3377
3360
|
}
|
|
3378
|
-
return
|
|
3379
|
-
}
|
|
3380
|
-
function unescapeDelimiters(value) {
|
|
3381
|
-
if (value === null || value === void 0) {
|
|
3382
|
-
return "";
|
|
3383
|
-
}
|
|
3384
|
-
value = /__gfp__/g[Symbol.replace](value, "|");
|
|
3385
|
-
value = /__gfc__/g[Symbol.replace](value, ",");
|
|
3386
|
-
return value;
|
|
3361
|
+
return /__gfp__/g[Symbol.replace](value, "|");
|
|
3387
3362
|
}
|
|
3388
3363
|
function toArray(filter) {
|
|
3389
|
-
return [
|
|
3390
|
-
toCommaDelimitedString(filter.key, filter.keyLabel),
|
|
3391
|
-
filter.operator,
|
|
3392
|
-
toCommaDelimitedString(filter.value, filter.valueLabel)
|
|
3393
|
-
];
|
|
3394
|
-
}
|
|
3395
|
-
function toCommaDelimitedString(key, label) {
|
|
3396
|
-
if (!label || key === label) {
|
|
3397
|
-
return escapeCommaDelimiters(key);
|
|
3398
|
-
}
|
|
3399
|
-
return [key, label].map(escapeCommaDelimiters).join(",");
|
|
3364
|
+
return [filter.key, filter.operator, filter.value];
|
|
3400
3365
|
}
|
|
3401
|
-
function toFilter(
|
|
3402
|
-
if (typeof
|
|
3366
|
+
function toFilter(value) {
|
|
3367
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
3403
3368
|
return null;
|
|
3404
3369
|
}
|
|
3405
|
-
const
|
|
3406
|
-
const [key2, label] = v.split(",");
|
|
3407
|
-
acc.push(key2, label != null ? label : key2);
|
|
3408
|
-
return acc;
|
|
3409
|
-
}, []).map(unescapeDelimiters);
|
|
3370
|
+
const parts = value.split("|").map(unescapeDelimiter);
|
|
3410
3371
|
return {
|
|
3411
|
-
key,
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
value,
|
|
3415
|
-
valueLabel,
|
|
3372
|
+
key: parts[0],
|
|
3373
|
+
operator: parts[1],
|
|
3374
|
+
value: parts[2],
|
|
3416
3375
|
condition: ""
|
|
3417
3376
|
};
|
|
3418
3377
|
}
|
|
@@ -3471,23 +3430,22 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
3471
3430
|
getValue() {
|
|
3472
3431
|
return this.state.filterExpression;
|
|
3473
3432
|
}
|
|
3474
|
-
_updateFilter(filter, prop,
|
|
3433
|
+
_updateFilter(filter, prop, value) {
|
|
3475
3434
|
if (value == null) {
|
|
3476
3435
|
return;
|
|
3477
3436
|
}
|
|
3478
3437
|
const { filters, _wip } = this.state;
|
|
3479
|
-
const propLabelKey = `${prop}Label`;
|
|
3480
3438
|
if (filter === _wip) {
|
|
3481
3439
|
if (prop === "value") {
|
|
3482
|
-
this.setState({ filters: [...filters, __spreadProps$l(__spreadValues$x({}, _wip), { [prop]: value
|
|
3440
|
+
this.setState({ filters: [...filters, __spreadProps$l(__spreadValues$x({}, _wip), { [prop]: value })], _wip: void 0 });
|
|
3483
3441
|
} else {
|
|
3484
|
-
this.setState({ _wip: __spreadProps$l(__spreadValues$x({}, filter), { [prop]: value
|
|
3442
|
+
this.setState({ _wip: __spreadProps$l(__spreadValues$x({}, filter), { [prop]: value }) });
|
|
3485
3443
|
}
|
|
3486
3444
|
return;
|
|
3487
3445
|
}
|
|
3488
3446
|
const updatedFilters = this.state.filters.map((f) => {
|
|
3489
3447
|
if (f === filter) {
|
|
3490
|
-
return __spreadProps$l(__spreadValues$x({}, f), { [prop]: value
|
|
3448
|
+
return __spreadProps$l(__spreadValues$x({}, f), { [prop]: value });
|
|
3491
3449
|
}
|
|
3492
3450
|
return f;
|
|
3493
3451
|
});
|
|
@@ -3546,9 +3504,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
3546
3504
|
return values.map(toSelectableValue);
|
|
3547
3505
|
}
|
|
3548
3506
|
_addWip() {
|
|
3549
|
-
this.setState({
|
|
3550
|
-
_wip: { key: "", keyLabel: "", value: "", valueLabel: "", operator: "=", condition: "" }
|
|
3551
|
-
});
|
|
3507
|
+
this.setState({ _wip: { key: "", value: "", operator: "=", condition: "" } });
|
|
3552
3508
|
}
|
|
3553
3509
|
_getOperators() {
|
|
3554
3510
|
return ["=", "!=", "<", ">", "=~", "!~"].map((value) => ({
|
|
@@ -4070,9 +4026,9 @@ function escapeLokiRegexp(value) {
|
|
|
4070
4026
|
function getQueriesForVariables(sourceObject) {
|
|
4071
4027
|
const runners = sceneGraph.findAllObjects(
|
|
4072
4028
|
sourceObject.getRoot(),
|
|
4073
|
-
(o) => o instanceof SceneQueryRunner
|
|
4029
|
+
(o) => o instanceof SceneQueryRunner
|
|
4074
4030
|
);
|
|
4075
|
-
const applicableRunners = runners.filter((r) => {
|
|
4031
|
+
const applicableRunners = filterOutInactiveRunnerDuplicates(runners).filter((r) => {
|
|
4076
4032
|
var _a, _b;
|
|
4077
4033
|
return ((_a = r.state.datasource) == null ? void 0 : _a.uid) === ((_b = sourceObject.state.datasource) == null ? void 0 : _b.uid);
|
|
4078
4034
|
});
|
|
@@ -4085,6 +4041,24 @@ function getQueriesForVariables(sourceObject) {
|
|
|
4085
4041
|
});
|
|
4086
4042
|
return result;
|
|
4087
4043
|
}
|
|
4044
|
+
function filterOutInactiveRunnerDuplicates(runners) {
|
|
4045
|
+
const groupedItems = {};
|
|
4046
|
+
for (const item of runners) {
|
|
4047
|
+
if (item.state.key) {
|
|
4048
|
+
if (!(item.state.key in groupedItems)) {
|
|
4049
|
+
groupedItems[item.state.key] = [];
|
|
4050
|
+
}
|
|
4051
|
+
groupedItems[item.state.key].push(item);
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
return Object.values(groupedItems).flatMap((group) => {
|
|
4055
|
+
const activeItems = group.filter((item) => item.isActive);
|
|
4056
|
+
if (activeItems.length === 0 && group.length === 1) {
|
|
4057
|
+
return group;
|
|
4058
|
+
}
|
|
4059
|
+
return activeItems;
|
|
4060
|
+
});
|
|
4061
|
+
}
|
|
4088
4062
|
|
|
4089
4063
|
function isAdHocVariable(variable) {
|
|
4090
4064
|
return variable.state.type === "adhoc";
|
|
@@ -6156,6 +6130,9 @@ class SceneVariableSet extends SceneObjectBase {
|
|
|
6156
6130
|
}
|
|
6157
6131
|
}
|
|
6158
6132
|
_variableNeedsUpdate(variable) {
|
|
6133
|
+
if (variable.isLazy) {
|
|
6134
|
+
return false;
|
|
6135
|
+
}
|
|
6159
6136
|
if (!variable.validateAndUpdate) {
|
|
6160
6137
|
return false;
|
|
6161
6138
|
}
|
|
@@ -6333,6 +6310,79 @@ class ConstantVariable extends SceneObjectBase {
|
|
|
6333
6310
|
}
|
|
6334
6311
|
}
|
|
6335
6312
|
|
|
6313
|
+
function VariableValueSelect({ model }) {
|
|
6314
|
+
const { value, key } = model.useState();
|
|
6315
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
6316
|
+
if (meta.action === "input-change") {
|
|
6317
|
+
model.onSearchChange(value2);
|
|
6318
|
+
}
|
|
6319
|
+
} : void 0;
|
|
6320
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
|
|
6321
|
+
id: key,
|
|
6322
|
+
placeholder: "Select value",
|
|
6323
|
+
width: "auto",
|
|
6324
|
+
value,
|
|
6325
|
+
allowCustomValue: true,
|
|
6326
|
+
virtualized: true,
|
|
6327
|
+
tabSelectsValue: false,
|
|
6328
|
+
onInputChange,
|
|
6329
|
+
options: model.getOptionsForSelect(),
|
|
6330
|
+
onChange: (newValue) => {
|
|
6331
|
+
model.changeValueTo(newValue.value, newValue.label);
|
|
6332
|
+
}
|
|
6333
|
+
});
|
|
6334
|
+
}
|
|
6335
|
+
function VariableValueSelectMulti({ model }) {
|
|
6336
|
+
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
6337
|
+
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
6338
|
+
const options = model.getOptionsForSelect();
|
|
6339
|
+
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
6340
|
+
React.useEffect(() => {
|
|
6341
|
+
setUncommittedValue(arrayValue);
|
|
6342
|
+
}, [arrayValue]);
|
|
6343
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
6344
|
+
if (meta.action === "input-change") {
|
|
6345
|
+
model.onSearchChange(value2);
|
|
6346
|
+
}
|
|
6347
|
+
} : void 0;
|
|
6348
|
+
const placeholder = options.length > 0 ? "Select value" : "";
|
|
6349
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
6350
|
+
id: key,
|
|
6351
|
+
placeholder,
|
|
6352
|
+
width: "auto",
|
|
6353
|
+
value: uncommittedValue,
|
|
6354
|
+
noMultiValueWrap: true,
|
|
6355
|
+
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
6356
|
+
tabSelectsValue: false,
|
|
6357
|
+
virtualized: true,
|
|
6358
|
+
allowCustomValue: true,
|
|
6359
|
+
options: model.getOptionsForSelect(),
|
|
6360
|
+
closeMenuOnSelect: false,
|
|
6361
|
+
isClearable: true,
|
|
6362
|
+
onInputChange,
|
|
6363
|
+
onBlur: () => {
|
|
6364
|
+
model.changeValueTo(uncommittedValue);
|
|
6365
|
+
},
|
|
6366
|
+
onChange: (newValue, action) => {
|
|
6367
|
+
if (action.action === "clear" && noValueOnClear) {
|
|
6368
|
+
model.changeValueTo([]);
|
|
6369
|
+
}
|
|
6370
|
+
setUncommittedValue(newValue.map((x) => x.value));
|
|
6371
|
+
}
|
|
6372
|
+
});
|
|
6373
|
+
}
|
|
6374
|
+
function renderSelectForVariable(model) {
|
|
6375
|
+
if (model.state.isMulti) {
|
|
6376
|
+
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
|
|
6377
|
+
model
|
|
6378
|
+
});
|
|
6379
|
+
} else {
|
|
6380
|
+
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
|
|
6381
|
+
model
|
|
6382
|
+
});
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6336
6386
|
var __defProp$i = Object.defineProperty;
|
|
6337
6387
|
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
6338
6388
|
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
@@ -7007,7 +7057,7 @@ var __spreadValues$e = (a, b) => {
|
|
|
7007
7057
|
return a;
|
|
7008
7058
|
};
|
|
7009
7059
|
class TestVariable extends MultiValueVariable {
|
|
7010
|
-
constructor(initialState) {
|
|
7060
|
+
constructor(initialState, isLazy = false) {
|
|
7011
7061
|
super(__spreadValues$e({
|
|
7012
7062
|
type: "custom",
|
|
7013
7063
|
name: "Test",
|
|
@@ -7020,9 +7070,11 @@ class TestVariable extends MultiValueVariable {
|
|
|
7020
7070
|
this.completeUpdate = new rxjs.Subject();
|
|
7021
7071
|
this.isGettingValues = true;
|
|
7022
7072
|
this.getValueOptionsCount = 0;
|
|
7073
|
+
this.isLazy = false;
|
|
7023
7074
|
this._variableDependency = new VariableDependencyConfig(this, {
|
|
7024
7075
|
statePaths: ["query"]
|
|
7025
7076
|
});
|
|
7077
|
+
this.isLazy = isLazy;
|
|
7026
7078
|
}
|
|
7027
7079
|
getValueOptions(args) {
|
|
7028
7080
|
const { delayMs } = this.state;
|