@uniformdev/mesh-sdk-react 19.140.2-alpha.7 → 19.142.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/index.d.mts +458 -18
- package/dist/index.d.ts +458 -18
- package/dist/index.esm.js +1787 -171
- package/dist/index.js +1807 -163
- package/dist/index.mjs +1787 -171
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -2945,15 +2945,16 @@ import {
|
|
|
2945
2945
|
KEY_BACKSPACE_COMMAND,
|
|
2946
2946
|
KEY_DELETE_COMMAND
|
|
2947
2947
|
} from "lexical";
|
|
2948
|
-
import { useCallback as useCallback3, useEffect as
|
|
2948
|
+
import { useCallback as useCallback3, useEffect as useEffect9 } from "react";
|
|
2949
2949
|
|
|
2950
2950
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
2951
2951
|
function prettifyBindExpression(bindExpression) {
|
|
2952
|
-
|
|
2952
|
+
const [, expression] = bindExpression.split(":");
|
|
2953
|
+
return expression;
|
|
2953
2954
|
}
|
|
2954
2955
|
|
|
2955
2956
|
// src/components/Variables/composer/VariableChip.tsx
|
|
2956
|
-
import { MultilineChip } from "@uniformdev/design-system";
|
|
2957
|
+
import { MultilineChip, Tooltip, VerticalRhythm } from "@uniformdev/design-system";
|
|
2957
2958
|
import { Fragment as Fragment5 } from "react";
|
|
2958
2959
|
import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
|
|
2959
2960
|
function VariableChip({
|
|
@@ -2969,42 +2970,58 @@ function VariableChip({
|
|
|
2969
2970
|
}) {
|
|
2970
2971
|
const hasClickEvent = !!onClick;
|
|
2971
2972
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
2972
|
-
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
|
|
2973
|
+
const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
|
|
2973
2974
|
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
2975
|
+
const chippy = /* @__PURE__ */ jsx30(MultilineChip, { onClick, "aria-selected": selected ? true : void 0, "aria-disabled": disabled, children: /* @__PURE__ */ jsx30(Wrapper, { children: displayName || reference }) });
|
|
2976
|
+
if (tooltip) {
|
|
2977
|
+
const tip = tooltip ? `${tooltip}${extraTitle ? `
|
|
2978
|
+
|
|
2979
|
+
${extraTitle}` : ""}` : extraTitle != null ? extraTitle : "";
|
|
2980
|
+
const tipLines = tip.split("\n");
|
|
2981
|
+
return /* @__PURE__ */ jsx30(
|
|
2982
|
+
Tooltip,
|
|
2983
|
+
{
|
|
2984
|
+
title: /* @__PURE__ */ jsx30(VerticalRhythm, { gap: "sm", children: tipLines.map((t, index) => /* @__PURE__ */ jsx30("div", { children: t }, index)) }),
|
|
2985
|
+
children: /* @__PURE__ */ jsx30("span", { children: chippy })
|
|
2986
|
+
}
|
|
2987
|
+
);
|
|
2988
|
+
}
|
|
2989
|
+
return chippy;
|
|
2990
|
+
}
|
|
2991
|
+
function UndefinedVariableReference({ children }) {
|
|
2974
2992
|
return /* @__PURE__ */ jsx30(
|
|
2975
|
-
|
|
2993
|
+
"span",
|
|
2976
2994
|
{
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
children: /* @__PURE__ */ jsx30(Wrapper, { children: displayName || reference })
|
|
2995
|
+
style: {
|
|
2996
|
+
textDecoration: "underline",
|
|
2997
|
+
textDecorationStyle: "wavy",
|
|
2998
|
+
textDecorationColor: "var(--error)"
|
|
2999
|
+
},
|
|
3000
|
+
children
|
|
2984
3001
|
}
|
|
2985
3002
|
);
|
|
2986
3003
|
}
|
|
2987
|
-
function
|
|
3004
|
+
function InfoVariableReference({ children }) {
|
|
2988
3005
|
return /* @__PURE__ */ jsx30(
|
|
2989
3006
|
"span",
|
|
2990
3007
|
{
|
|
2991
3008
|
style: {
|
|
2992
3009
|
textDecoration: "underline",
|
|
2993
3010
|
textDecorationStyle: "wavy",
|
|
2994
|
-
textDecorationColor: "
|
|
3011
|
+
textDecorationColor: "var(--primary-action-default)"
|
|
2995
3012
|
},
|
|
2996
3013
|
children
|
|
2997
3014
|
}
|
|
2998
3015
|
);
|
|
2999
3016
|
}
|
|
3000
|
-
function
|
|
3017
|
+
function WarningVariableReference({ children }) {
|
|
3001
3018
|
return /* @__PURE__ */ jsx30(
|
|
3002
3019
|
"span",
|
|
3003
3020
|
{
|
|
3004
3021
|
style: {
|
|
3005
3022
|
textDecoration: "underline",
|
|
3006
3023
|
textDecorationStyle: "wavy",
|
|
3007
|
-
textDecorationColor: "
|
|
3024
|
+
textDecorationColor: "var(--alert)"
|
|
3008
3025
|
},
|
|
3009
3026
|
children
|
|
3010
3027
|
}
|
|
@@ -3034,7 +3051,7 @@ import {
|
|
|
3034
3051
|
COMMAND_PRIORITY_NORMAL,
|
|
3035
3052
|
createCommand
|
|
3036
3053
|
} from "lexical";
|
|
3037
|
-
import { useCallback as useCallback2, useEffect as
|
|
3054
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
|
|
3038
3055
|
import { createPortal } from "react-dom";
|
|
3039
3056
|
|
|
3040
3057
|
// src/components/Variables/toolbox/SelectVariableMenu.styles.ts
|
|
@@ -3068,7 +3085,7 @@ var variablesTipText = css18`
|
|
|
3068
3085
|
|
|
3069
3086
|
// src/components/Variables/VariablesProvider.tsx
|
|
3070
3087
|
import mitt from "mitt";
|
|
3071
|
-
import { createContext as createContext3, useContext as useContext5, useMemo as useMemo7, useState as useState9 } from "react";
|
|
3088
|
+
import { createContext as createContext3, useContext as useContext5, useEffect as useEffect7, useMemo as useMemo7, useState as useState9 } from "react";
|
|
3072
3089
|
|
|
3073
3090
|
// src/components/Variables/util/useVariableEditTransaction.ts
|
|
3074
3091
|
import { useCallback, useEffect as useEffect6, useState as useState8 } from "react";
|
|
@@ -3265,7 +3282,8 @@ function VariablesProvider({
|
|
|
3265
3282
|
readOnly,
|
|
3266
3283
|
isLoading,
|
|
3267
3284
|
children,
|
|
3268
|
-
knownUndefinedValues = {}
|
|
3285
|
+
knownUndefinedValues = {},
|
|
3286
|
+
onChangeKnownUndefinedValue
|
|
3269
3287
|
}) {
|
|
3270
3288
|
const [editing, setEditing] = useState9();
|
|
3271
3289
|
const [editingContext, setEditingContext] = useState9();
|
|
@@ -3332,6 +3350,15 @@ function VariablesProvider({
|
|
|
3332
3350
|
isLoading: !!isLoading
|
|
3333
3351
|
};
|
|
3334
3352
|
}, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
|
|
3353
|
+
useEffect7(() => {
|
|
3354
|
+
if (editing === void 0) {
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
3357
|
+
const activeElement = document.activeElement;
|
|
3358
|
+
if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") {
|
|
3359
|
+
activeElement.blur();
|
|
3360
|
+
}
|
|
3361
|
+
}, [editing]);
|
|
3335
3362
|
return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
|
|
3336
3363
|
children,
|
|
3337
3364
|
typeof editing !== "undefined" ? /* @__PURE__ */ jsx32(
|
|
@@ -3340,9 +3367,19 @@ function VariablesProvider({
|
|
|
3340
3367
|
context: editingContext,
|
|
3341
3368
|
onSubmit: (val, editorCompletedContext) => {
|
|
3342
3369
|
contextValue.dispatch({ type: "cancelEdit" });
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3370
|
+
if ("resultType" in val) {
|
|
3371
|
+
if (!onChangeKnownUndefinedValue) {
|
|
3372
|
+
throw new Error(
|
|
3373
|
+
"onChangeKnownUndefinedValue must be provided to handle known-undefined-value results"
|
|
3374
|
+
);
|
|
3375
|
+
}
|
|
3376
|
+
const { name, ...kuv } = val;
|
|
3377
|
+
onChangeKnownUndefinedValue(val.name, kuv);
|
|
3378
|
+
} else {
|
|
3379
|
+
const { name, ...varValue } = val;
|
|
3380
|
+
const latestValue = { ...value, [name]: varValue };
|
|
3381
|
+
onChange == null ? void 0 : onChange(latestValue);
|
|
3382
|
+
}
|
|
3346
3383
|
events.emit("editCompleted", {
|
|
3347
3384
|
canceled: false,
|
|
3348
3385
|
selectedVariable: val,
|
|
@@ -3625,7 +3662,7 @@ function VariablesPlugin({
|
|
|
3625
3662
|
},
|
|
3626
3663
|
[editor, onSelect, queryString, replaceValueOnVariableInsert]
|
|
3627
3664
|
);
|
|
3628
|
-
|
|
3665
|
+
useEffect8(() => {
|
|
3629
3666
|
return mergeRegister(
|
|
3630
3667
|
editor.registerCommand(
|
|
3631
3668
|
EDIT_VARIABLE_COMMAND,
|
|
@@ -3757,21 +3794,21 @@ function VariablesPlugin({
|
|
|
3757
3794
|
]);
|
|
3758
3795
|
const updateExistingNodeIfChanged = useCallback2(
|
|
3759
3796
|
(variableNode) => {
|
|
3760
|
-
var _a, _b, _c;
|
|
3797
|
+
var _a, _b, _c, _d;
|
|
3761
3798
|
const targetVar = variablesRef.current.variables[variableNode.reference];
|
|
3762
3799
|
const targetUndefinedVar = variablesRef.current.knownUndefinedValues[variableNode.reference];
|
|
3763
3800
|
const isLoadingVariables = variablesRef.current.isLoading;
|
|
3764
3801
|
const currentState = variableNode.getState();
|
|
3765
|
-
if (currentState.isFresh && !targetVar) {
|
|
3802
|
+
if (currentState.isFresh && !targetVar && !targetUndefinedVar) {
|
|
3766
3803
|
return;
|
|
3767
3804
|
}
|
|
3768
|
-
const tooltip = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
|
|
3805
|
+
const tooltip = (_d = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
|
|
3769
3806
|
const newState = {
|
|
3770
3807
|
...currentState,
|
|
3771
3808
|
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
|
|
3772
3809
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
3773
3810
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
3774
|
-
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
3811
|
+
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
3775
3812
|
tooltip,
|
|
3776
3813
|
isFresh: false
|
|
3777
3814
|
};
|
|
@@ -3781,14 +3818,14 @@ function VariablesPlugin({
|
|
|
3781
3818
|
},
|
|
3782
3819
|
[canEditVariable]
|
|
3783
3820
|
);
|
|
3784
|
-
|
|
3821
|
+
useEffect8(() => {
|
|
3785
3822
|
editor.update(() => {
|
|
3786
3823
|
$nodesOfType2(VariableNode).forEach((variableNode) => {
|
|
3787
3824
|
updateExistingNodeIfChanged(variableNode);
|
|
3788
3825
|
});
|
|
3789
3826
|
});
|
|
3790
|
-
}, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
|
|
3791
|
-
|
|
3827
|
+
}, [editor, variables, knownUndefinedValues, canEditVariable, updateExistingNodeIfChanged]);
|
|
3828
|
+
useEffect8(() => {
|
|
3792
3829
|
return editor.registerNodeTransform(VariableNode, (variableNode) => {
|
|
3793
3830
|
updateExistingNodeIfChanged(variableNode);
|
|
3794
3831
|
});
|
|
@@ -3967,7 +4004,7 @@ function VariableNodeComponent({
|
|
|
3967
4004
|
},
|
|
3968
4005
|
[isSelected, nodeKey]
|
|
3969
4006
|
);
|
|
3970
|
-
|
|
4007
|
+
useEffect9(() => {
|
|
3971
4008
|
return mergeRegister2(
|
|
3972
4009
|
editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW),
|
|
3973
4010
|
editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW),
|
|
@@ -4084,10 +4121,10 @@ function EditorRefPlugin({
|
|
|
4084
4121
|
import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
|
|
4085
4122
|
import { mergeRegister as mergeRegister3 } from "@lexical/utils";
|
|
4086
4123
|
import { $getSelection as $getSelection3, $isRangeSelection as $isRangeSelection2, COMMAND_PRIORITY_HIGH, PASTE_COMMAND } from "lexical";
|
|
4087
|
-
import { useEffect as
|
|
4124
|
+
import { useEffect as useEffect10 } from "react";
|
|
4088
4125
|
function PasteTransformerPlugin({ transformPaste }) {
|
|
4089
4126
|
const [editor] = useLexicalComposerContext5();
|
|
4090
|
-
|
|
4127
|
+
useEffect10(() => {
|
|
4091
4128
|
return mergeRegister3(
|
|
4092
4129
|
editor.registerCommand(
|
|
4093
4130
|
PASTE_COMMAND,
|
|
@@ -4551,10 +4588,10 @@ import { useMemo as useMemo10, useRef as useRef12, useState as useState12 } from
|
|
|
4551
4588
|
|
|
4552
4589
|
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4553
4590
|
import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
|
|
4554
|
-
import { useEffect as
|
|
4591
|
+
import { useEffect as useEffect12 } from "react";
|
|
4555
4592
|
function DisablePlugin({ disabled }) {
|
|
4556
4593
|
const [editor] = useLexicalComposerContext7();
|
|
4557
|
-
|
|
4594
|
+
useEffect12(() => {
|
|
4558
4595
|
editor.setEditable(!disabled);
|
|
4559
4596
|
}, [editor, disabled]);
|
|
4560
4597
|
return null;
|
|
@@ -4563,10 +4600,10 @@ function DisablePlugin({ disabled }) {
|
|
|
4563
4600
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4564
4601
|
import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
|
|
4565
4602
|
import { LineBreakNode } from "lexical";
|
|
4566
|
-
import { useEffect as
|
|
4603
|
+
import { useEffect as useEffect13 } from "react";
|
|
4567
4604
|
function SingleLineTextPlugin() {
|
|
4568
4605
|
const [editor] = useLexicalComposerContext8();
|
|
4569
|
-
|
|
4606
|
+
useEffect13(() => {
|
|
4570
4607
|
editor.registerNodeTransform(LineBreakNode, (node) => {
|
|
4571
4608
|
node.remove();
|
|
4572
4609
|
});
|
|
@@ -4688,10 +4725,10 @@ import {
|
|
|
4688
4725
|
CUT_COMMAND,
|
|
4689
4726
|
PASTE_COMMAND as PASTE_COMMAND2
|
|
4690
4727
|
} from "lexical";
|
|
4691
|
-
import { useEffect as
|
|
4728
|
+
import { useEffect as useEffect14 } from "react";
|
|
4692
4729
|
import { Fragment as Fragment9, jsx as jsx39, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
|
|
4693
4730
|
function VariablesComposerInput({
|
|
4694
|
-
css:
|
|
4731
|
+
css: css39,
|
|
4695
4732
|
placeholder,
|
|
4696
4733
|
...contentEditableProps
|
|
4697
4734
|
}) {
|
|
@@ -4710,7 +4747,7 @@ function VariablesComposerInput({
|
|
|
4710
4747
|
}
|
|
4711
4748
|
function RichishCopyAndPastePlugin() {
|
|
4712
4749
|
const [editor] = useLexicalComposerContext9();
|
|
4713
|
-
|
|
4750
|
+
useEffect14(() => {
|
|
4714
4751
|
return mergeRegister4(
|
|
4715
4752
|
editor.registerCommand(
|
|
4716
4753
|
COPY_COMMAND,
|
|
@@ -4812,7 +4849,8 @@ function InputVariables(props) {
|
|
|
4812
4849
|
editorRef,
|
|
4813
4850
|
filterVariable,
|
|
4814
4851
|
styleVariant = "default",
|
|
4815
|
-
renderMenuInPortal
|
|
4852
|
+
renderMenuInPortal,
|
|
4853
|
+
disableDismissEditorOnChange
|
|
4816
4854
|
} = props;
|
|
4817
4855
|
const [finalId] = useState13(id != null ? id : () => v42());
|
|
4818
4856
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -4822,7 +4860,7 @@ function InputVariables(props) {
|
|
|
4822
4860
|
"div",
|
|
4823
4861
|
{
|
|
4824
4862
|
onKeyDown: () => {
|
|
4825
|
-
if (isEditing && canDispatch) {
|
|
4863
|
+
if (!disableDismissEditorOnChange && isEditing && canDispatch) {
|
|
4826
4864
|
dispatch({ type: "cancelEdit" });
|
|
4827
4865
|
}
|
|
4828
4866
|
},
|
|
@@ -5009,7 +5047,7 @@ import { useCallback as useCallback4 } from "react";
|
|
|
5009
5047
|
import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
|
|
5010
5048
|
import { mergeRegister as mergeRegister5 } from "@lexical/utils";
|
|
5011
5049
|
import { $getNodeByKey as $getNodeByKey3, COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH3 } from "lexical";
|
|
5012
|
-
import { useEffect as
|
|
5050
|
+
import { useEffect as useEffect15, useRef as useRef13 } from "react";
|
|
5013
5051
|
function OnDisconnectPlugin({
|
|
5014
5052
|
onDisconnect
|
|
5015
5053
|
}) {
|
|
@@ -5017,7 +5055,7 @@ function OnDisconnectPlugin({
|
|
|
5017
5055
|
const { variables } = useVariables(true);
|
|
5018
5056
|
const variablesRef = useRef13(variables);
|
|
5019
5057
|
variablesRef.current = variables;
|
|
5020
|
-
|
|
5058
|
+
useEffect15(() => {
|
|
5021
5059
|
return mergeRegister5(
|
|
5022
5060
|
editor.registerCommand(
|
|
5023
5061
|
DISCONNECT_VARIABLE_COMMAND,
|
|
@@ -5154,19 +5192,17 @@ function ParameterVariables(props) {
|
|
|
5154
5192
|
children: [
|
|
5155
5193
|
editorRef ? /* @__PURE__ */ jsx43(EditorRefPlugin, { editorRef }) : null,
|
|
5156
5194
|
/* @__PURE__ */ jsx43(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
|
|
5157
|
-
/* @__PURE__ */ jsxs26(
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
}
|
|
5167
|
-
|
|
5168
|
-
children: [
|
|
5169
|
-
/* @__PURE__ */ jsx43("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx43(
|
|
5195
|
+
/* @__PURE__ */ jsxs26(HorizontalRhythm7, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5196
|
+
/* @__PURE__ */ jsx43(
|
|
5197
|
+
"div",
|
|
5198
|
+
{
|
|
5199
|
+
css: { flex: 1 },
|
|
5200
|
+
onKeyDown: () => {
|
|
5201
|
+
if (isEditing && canDispatch) {
|
|
5202
|
+
dispatch({ type: "cancelEdit" });
|
|
5203
|
+
}
|
|
5204
|
+
},
|
|
5205
|
+
children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx43(
|
|
5170
5206
|
VariablesComposerInput,
|
|
5171
5207
|
{
|
|
5172
5208
|
"aria-label": ariaLabel,
|
|
@@ -5178,20 +5214,20 @@ function ParameterVariables(props) {
|
|
|
5178
5214
|
inputCss != null ? inputCss : css25``
|
|
5179
5215
|
]
|
|
5180
5216
|
}
|
|
5181
|
-
) }),
|
|
5182
|
-
disableVariablesForReals ? null : /* @__PURE__ */ jsx43(
|
|
5183
|
-
VariablesComposerVariableMenu,
|
|
5184
|
-
{
|
|
5185
|
-
...sharedMenuProps,
|
|
5186
|
-
buttonCss: [variableBindButton],
|
|
5187
|
-
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5188
|
-
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5189
|
-
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5190
|
-
}
|
|
5191
5217
|
)
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5218
|
+
}
|
|
5219
|
+
),
|
|
5220
|
+
disableVariablesForReals ? null : /* @__PURE__ */ jsx43(
|
|
5221
|
+
VariablesComposerVariableMenu,
|
|
5222
|
+
{
|
|
5223
|
+
...sharedMenuProps,
|
|
5224
|
+
buttonCss: [variableBindButton],
|
|
5225
|
+
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5226
|
+
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5227
|
+
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5228
|
+
}
|
|
5229
|
+
)
|
|
5230
|
+
] })
|
|
5195
5231
|
]
|
|
5196
5232
|
}
|
|
5197
5233
|
);
|
|
@@ -5199,7 +5235,7 @@ function ParameterVariables(props) {
|
|
|
5199
5235
|
|
|
5200
5236
|
// src/components/Variables/util/convertConnectedDataToVariable.ts
|
|
5201
5237
|
function convertConnectedDataToVariable(bindExpression, value) {
|
|
5202
|
-
const isValuePrimitive = typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
5238
|
+
const isValuePrimitive = typeof value === "string" && value.length > 0 || typeof value === "number" || typeof value === "boolean";
|
|
5203
5239
|
return {
|
|
5204
5240
|
ephemeral: true,
|
|
5205
5241
|
displayName: isValuePrimitive ? value.toString() : prettifyBindExpression(bindExpression),
|
|
@@ -5396,7 +5432,7 @@ function DataResourceDynamicInputProviderRenderer({
|
|
|
5396
5432
|
}
|
|
5397
5433
|
|
|
5398
5434
|
// src/components/DataResourceVariablesList.tsx
|
|
5399
|
-
import { Callout as Callout4, VerticalRhythm } from "@uniformdev/design-system";
|
|
5435
|
+
import { Callout as Callout4, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
5400
5436
|
import { jsx as jsx46 } from "@emotion/react/jsx-runtime";
|
|
5401
5437
|
function DataResourceVariablesList(props) {
|
|
5402
5438
|
const {
|
|
@@ -5428,7 +5464,7 @@ function DataResourceVariablesListExplicit({
|
|
|
5428
5464
|
}
|
|
5429
5465
|
return /* @__PURE__ */ jsx46(Callout4, { type: "note", children: "No settings are required." });
|
|
5430
5466
|
}
|
|
5431
|
-
return /* @__PURE__ */ jsx46(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx46(
|
|
5467
|
+
return /* @__PURE__ */ jsx46(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx46(VerticalRhythm2, { children: variableDefinitions.map((variableDefinition) => {
|
|
5432
5468
|
var _a, _b, _c;
|
|
5433
5469
|
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
5434
5470
|
return /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46(
|
|
@@ -6173,12 +6209,12 @@ import { LoadingIndicator as LoadingIndicator3, Theme as Theme2 } from "@uniform
|
|
|
6173
6209
|
|
|
6174
6210
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
6175
6211
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
6176
|
-
import { useEffect as
|
|
6212
|
+
import { useEffect as useEffect16, useRef as useRef14, useState as useState15 } from "react";
|
|
6177
6213
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
6178
6214
|
const [error, setError] = useState15();
|
|
6179
6215
|
const [sdk, setSdk] = useState15();
|
|
6180
6216
|
const initializationInProgress = useRef14(false);
|
|
6181
|
-
|
|
6217
|
+
useEffect16(
|
|
6182
6218
|
() => {
|
|
6183
6219
|
if (typeof window === "undefined" || sdk) {
|
|
6184
6220
|
return;
|
|
@@ -6261,7 +6297,7 @@ var DataRefreshButton = ({
|
|
|
6261
6297
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6262
6298
|
import { css as css33 } from "@emotion/react";
|
|
6263
6299
|
import { bindVariables } from "@uniformdev/canvas";
|
|
6264
|
-
import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as
|
|
6300
|
+
import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
|
|
6265
6301
|
|
|
6266
6302
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6267
6303
|
import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
|
|
@@ -6549,7 +6585,7 @@ var ObjectSearchContainer = ({
|
|
|
6549
6585
|
children: /* @__PURE__ */ jsx61(DefaultResultList, {})
|
|
6550
6586
|
}
|
|
6551
6587
|
);
|
|
6552
|
-
const body = /* @__PURE__ */ jsxs35(
|
|
6588
|
+
const body = /* @__PURE__ */ jsxs35(VerticalRhythm3, { children: [
|
|
6553
6589
|
searchFilters,
|
|
6554
6590
|
listItems
|
|
6555
6591
|
] });
|
|
@@ -6580,7 +6616,7 @@ var ObjectSearchContainer = ({
|
|
|
6580
6616
|
}
|
|
6581
6617
|
]);
|
|
6582
6618
|
};
|
|
6583
|
-
return /* @__PURE__ */ jsx61(IconsProvider, { children: /* @__PURE__ */ jsxs35(
|
|
6619
|
+
return /* @__PURE__ */ jsx61(IconsProvider, { children: /* @__PURE__ */ jsxs35(VerticalRhythm3, { children: [
|
|
6584
6620
|
/* @__PURE__ */ jsx61(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx61(
|
|
6585
6621
|
InputVariables,
|
|
6586
6622
|
{
|
|
@@ -7018,8 +7054,8 @@ function ObjectSearchResultList({
|
|
|
7018
7054
|
}
|
|
7019
7055
|
|
|
7020
7056
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7021
|
-
import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as
|
|
7022
|
-
import { useEffect as
|
|
7057
|
+
import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm4 } from "@uniformdev/design-system";
|
|
7058
|
+
import { useEffect as useEffect17, useState as useState18 } from "react";
|
|
7023
7059
|
import { jsx as jsx67, jsxs as jsxs41 } from "@emotion/react/jsx-runtime";
|
|
7024
7060
|
var QueryFilter = ({
|
|
7025
7061
|
requireContentType,
|
|
@@ -7060,12 +7096,12 @@ var QueryFilter = ({
|
|
|
7060
7096
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7061
7097
|
onSetQuery({ ...query, ...value });
|
|
7062
7098
|
};
|
|
7063
|
-
|
|
7099
|
+
useEffect17(() => {
|
|
7064
7100
|
onSetQuery(queryState);
|
|
7065
7101
|
}, []);
|
|
7066
7102
|
return /* @__PURE__ */ jsxs41("fieldset", { children: [
|
|
7067
7103
|
/* @__PURE__ */ jsx67("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
7068
|
-
/* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(
|
|
7104
|
+
/* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(VerticalRhythm4, { children: [
|
|
7069
7105
|
/* @__PURE__ */ jsx67(
|
|
7070
7106
|
InputVariables,
|
|
7071
7107
|
{
|
|
@@ -7186,7 +7222,7 @@ var QueryFilter = ({
|
|
|
7186
7222
|
};
|
|
7187
7223
|
|
|
7188
7224
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
7189
|
-
import { useEffect as
|
|
7225
|
+
import { useEffect as useEffect18, useMemo as useMemo16, useRef as useRef15 } from "react";
|
|
7190
7226
|
import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
|
|
7191
7227
|
function ParamTypeDynamicDataProvider(props) {
|
|
7192
7228
|
const { children } = props;
|
|
@@ -7210,7 +7246,7 @@ var JsonMeshVariableEditor = ({
|
|
|
7210
7246
|
}) => {
|
|
7211
7247
|
const sillyRef = useRef15(false);
|
|
7212
7248
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
7213
|
-
|
|
7249
|
+
useEffect18(() => {
|
|
7214
7250
|
if (sillyRef.current) {
|
|
7215
7251
|
return;
|
|
7216
7252
|
}
|
|
@@ -7238,100 +7274,1647 @@ var JsonMeshVariableEditor = ({
|
|
|
7238
7274
|
return null;
|
|
7239
7275
|
};
|
|
7240
7276
|
|
|
7241
|
-
// src/components/SearchAndFilter/
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7277
|
+
// src/components/SearchAndFilter/constants.ts
|
|
7278
|
+
var NUMBER_OPERATORS = [
|
|
7279
|
+
{
|
|
7280
|
+
label: "equals...",
|
|
7281
|
+
symbol: "=",
|
|
7282
|
+
value: "eq",
|
|
7283
|
+
editorType: "number"
|
|
7284
|
+
},
|
|
7285
|
+
{
|
|
7286
|
+
label: "does not equal...",
|
|
7287
|
+
symbol: "\u2260",
|
|
7288
|
+
value: "neq",
|
|
7289
|
+
editorType: "number"
|
|
7290
|
+
},
|
|
7291
|
+
{
|
|
7292
|
+
label: "greater than...",
|
|
7293
|
+
symbol: ">",
|
|
7294
|
+
value: "gt",
|
|
7295
|
+
editorType: "number"
|
|
7296
|
+
},
|
|
7297
|
+
{
|
|
7298
|
+
label: "greater than or equal to...",
|
|
7299
|
+
symbol: "\u2265",
|
|
7300
|
+
value: "gte",
|
|
7301
|
+
editorType: "number"
|
|
7302
|
+
},
|
|
7303
|
+
{
|
|
7304
|
+
label: "less than...",
|
|
7305
|
+
symbol: "<",
|
|
7306
|
+
value: "lt",
|
|
7307
|
+
editorType: "number"
|
|
7308
|
+
},
|
|
7309
|
+
{
|
|
7310
|
+
label: "less than or equal to...",
|
|
7311
|
+
symbol: "\u2264",
|
|
7312
|
+
value: "lte",
|
|
7313
|
+
editorType: "number"
|
|
7314
|
+
},
|
|
7315
|
+
{
|
|
7316
|
+
label: "is empty",
|
|
7317
|
+
value: "ndef",
|
|
7318
|
+
editorType: "empty"
|
|
7319
|
+
},
|
|
7320
|
+
{
|
|
7321
|
+
label: "is between...",
|
|
7322
|
+
value: "between",
|
|
7323
|
+
editorType: "numberRange"
|
|
7324
|
+
},
|
|
7325
|
+
{
|
|
7326
|
+
label: "is not empty",
|
|
7327
|
+
value: "def",
|
|
7328
|
+
editorType: "empty"
|
|
7329
|
+
}
|
|
7330
|
+
];
|
|
7331
|
+
var DATE_OPERATORS = [
|
|
7332
|
+
{
|
|
7333
|
+
label: "is...",
|
|
7334
|
+
value: "eq",
|
|
7335
|
+
editorType: "date"
|
|
7336
|
+
},
|
|
7337
|
+
{
|
|
7338
|
+
label: "is between...",
|
|
7339
|
+
value: "between",
|
|
7340
|
+
editorType: "dateRange"
|
|
7341
|
+
},
|
|
7342
|
+
{
|
|
7343
|
+
label: "is before...",
|
|
7344
|
+
value: "lt",
|
|
7345
|
+
editorType: "date"
|
|
7346
|
+
},
|
|
7347
|
+
{
|
|
7348
|
+
label: "is after...",
|
|
7349
|
+
value: "gt",
|
|
7350
|
+
editorType: "date"
|
|
7351
|
+
},
|
|
7352
|
+
{
|
|
7353
|
+
label: "is on or before...",
|
|
7354
|
+
value: "lte",
|
|
7355
|
+
editorType: "date"
|
|
7356
|
+
},
|
|
7357
|
+
{
|
|
7358
|
+
label: "is on or after...",
|
|
7359
|
+
value: "gte",
|
|
7360
|
+
editorType: "date"
|
|
7361
|
+
},
|
|
7362
|
+
{
|
|
7363
|
+
label: "is empty",
|
|
7364
|
+
value: "ndef",
|
|
7365
|
+
editorType: "empty"
|
|
7366
|
+
},
|
|
7367
|
+
{
|
|
7368
|
+
label: "is not...",
|
|
7369
|
+
value: "neq",
|
|
7370
|
+
editorType: "date"
|
|
7371
|
+
},
|
|
7372
|
+
{
|
|
7373
|
+
label: "is not empty",
|
|
7374
|
+
value: "def",
|
|
7375
|
+
editorType: "empty"
|
|
7376
|
+
}
|
|
7377
|
+
];
|
|
7378
|
+
var TEXTBOX_OPERATORS = [
|
|
7379
|
+
{
|
|
7380
|
+
label: "is...",
|
|
7381
|
+
value: "eq",
|
|
7382
|
+
editorType: "text"
|
|
7383
|
+
},
|
|
7384
|
+
{
|
|
7385
|
+
label: "is empty",
|
|
7386
|
+
value: "ndef",
|
|
7387
|
+
editorType: "empty"
|
|
7388
|
+
},
|
|
7389
|
+
{
|
|
7390
|
+
label: "contains...",
|
|
7391
|
+
value: "match",
|
|
7392
|
+
editorType: "text"
|
|
7393
|
+
},
|
|
7394
|
+
{
|
|
7395
|
+
label: "starts with...",
|
|
7396
|
+
value: "starts",
|
|
7397
|
+
editorType: "text"
|
|
7398
|
+
},
|
|
7399
|
+
{
|
|
7400
|
+
label: "is not...",
|
|
7401
|
+
value: "neq",
|
|
7402
|
+
editorType: "text"
|
|
7403
|
+
},
|
|
7404
|
+
{
|
|
7405
|
+
label: "is not empty",
|
|
7406
|
+
value: "def",
|
|
7407
|
+
editorType: "empty"
|
|
7408
|
+
}
|
|
7409
|
+
];
|
|
7410
|
+
var USER_OPERATORS = [
|
|
7411
|
+
{
|
|
7412
|
+
label: "is...",
|
|
7413
|
+
value: "eq",
|
|
7414
|
+
editorType: "text"
|
|
7415
|
+
},
|
|
7416
|
+
{
|
|
7417
|
+
label: "contains...",
|
|
7418
|
+
value: "match",
|
|
7419
|
+
editorType: "text"
|
|
7420
|
+
},
|
|
7421
|
+
{
|
|
7422
|
+
label: "starts with...",
|
|
7423
|
+
value: "starts",
|
|
7424
|
+
editorType: "text"
|
|
7425
|
+
},
|
|
7426
|
+
{
|
|
7427
|
+
label: "is not...",
|
|
7428
|
+
value: "neq",
|
|
7429
|
+
editorType: "text"
|
|
7430
|
+
}
|
|
7431
|
+
];
|
|
7432
|
+
var SYSTEM_DATE_OPERATORS = [
|
|
7433
|
+
{
|
|
7434
|
+
label: "is...",
|
|
7435
|
+
value: "sys-date-eq",
|
|
7436
|
+
editorType: "date"
|
|
7437
|
+
},
|
|
7438
|
+
{
|
|
7439
|
+
label: "is between...",
|
|
7440
|
+
value: "sys-date-between",
|
|
7441
|
+
editorType: "dateRange"
|
|
7442
|
+
},
|
|
7443
|
+
{
|
|
7444
|
+
label: "is before...",
|
|
7445
|
+
value: "sys-date-lt",
|
|
7446
|
+
editorType: "date"
|
|
7447
|
+
},
|
|
7448
|
+
{
|
|
7449
|
+
label: "is after...",
|
|
7450
|
+
value: "sys-date-gt",
|
|
7451
|
+
editorType: "date"
|
|
7452
|
+
},
|
|
7453
|
+
{
|
|
7454
|
+
label: "is on or before...",
|
|
7455
|
+
value: "sys-date-lte",
|
|
7456
|
+
editorType: "date"
|
|
7457
|
+
},
|
|
7458
|
+
{
|
|
7459
|
+
label: "is on or after...",
|
|
7460
|
+
value: "sys-date-gte",
|
|
7461
|
+
editorType: "date"
|
|
7462
|
+
},
|
|
7463
|
+
{
|
|
7464
|
+
label: "is not...",
|
|
7465
|
+
value: "sys-date-neq",
|
|
7466
|
+
editorType: "date"
|
|
7467
|
+
}
|
|
7468
|
+
];
|
|
7469
|
+
var RICHTEXT_OPERATORS = [
|
|
7470
|
+
{
|
|
7471
|
+
label: "is empty",
|
|
7472
|
+
value: "ndef",
|
|
7473
|
+
editorType: "empty"
|
|
7474
|
+
},
|
|
7475
|
+
{
|
|
7476
|
+
label: "contains...",
|
|
7477
|
+
value: "match",
|
|
7478
|
+
editorType: "text"
|
|
7479
|
+
},
|
|
7480
|
+
{
|
|
7481
|
+
label: "starts with...",
|
|
7482
|
+
value: "starts",
|
|
7483
|
+
editorType: "text"
|
|
7484
|
+
},
|
|
7485
|
+
{
|
|
7486
|
+
label: "is not empty",
|
|
7487
|
+
value: "def",
|
|
7488
|
+
editorType: "empty"
|
|
7489
|
+
}
|
|
7490
|
+
];
|
|
7491
|
+
var CHECKBOX_OPERATORS = [
|
|
7492
|
+
{
|
|
7493
|
+
label: "is checked...",
|
|
7494
|
+
value: "def",
|
|
7495
|
+
editorType: "empty"
|
|
7496
|
+
},
|
|
7497
|
+
{
|
|
7498
|
+
label: "is not checked...",
|
|
7499
|
+
value: "ndef",
|
|
7500
|
+
editorType: "empty"
|
|
7501
|
+
}
|
|
7502
|
+
];
|
|
7503
|
+
var SYSTEM_FIELD_OPERATORS = [
|
|
7504
|
+
{
|
|
7505
|
+
label: "is...",
|
|
7506
|
+
value: "eq",
|
|
7507
|
+
editorType: "singleChoice"
|
|
7508
|
+
},
|
|
7509
|
+
{
|
|
7510
|
+
label: "is any of...",
|
|
7511
|
+
value: "in",
|
|
7512
|
+
editorType: "multiChoice"
|
|
7513
|
+
},
|
|
7514
|
+
{
|
|
7515
|
+
label: "is not...",
|
|
7516
|
+
value: "neq",
|
|
7517
|
+
editorType: "singleChoice"
|
|
7518
|
+
},
|
|
7519
|
+
{
|
|
7520
|
+
label: "is none of...",
|
|
7521
|
+
value: "nin",
|
|
7522
|
+
editorType: "multiChoice"
|
|
7523
|
+
}
|
|
7524
|
+
];
|
|
7525
|
+
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
7526
|
+
{
|
|
7527
|
+
label: "is...",
|
|
7528
|
+
value: "eq",
|
|
7529
|
+
editorType: "statusSingleChoice"
|
|
7530
|
+
},
|
|
7531
|
+
{
|
|
7532
|
+
label: "is any of...",
|
|
7533
|
+
value: "in",
|
|
7534
|
+
editorType: "statusMultiChoice"
|
|
7535
|
+
},
|
|
7536
|
+
{
|
|
7537
|
+
label: "is not...",
|
|
7538
|
+
value: "neq",
|
|
7539
|
+
editorType: "statusSingleChoice"
|
|
7540
|
+
},
|
|
7541
|
+
{
|
|
7542
|
+
label: "is none of...",
|
|
7543
|
+
value: "nin",
|
|
7544
|
+
editorType: "statusMultiChoice"
|
|
7545
|
+
}
|
|
7546
|
+
];
|
|
7547
|
+
|
|
7548
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7549
|
+
import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
|
|
7550
|
+
|
|
7551
|
+
// src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
|
|
7552
|
+
import { css as css38 } from "@emotion/react";
|
|
7553
|
+
import { cq, fadeInLtr } from "@uniformdev/design-system";
|
|
7554
|
+
var SearchAndFilterControlsWrapper = (gridColumns) => css38`
|
|
7555
|
+
align-items: stretch;
|
|
7556
|
+
display: grid;
|
|
7557
|
+
grid-template-columns: ${gridColumns};
|
|
7558
|
+
gap: var(--spacing-sm);
|
|
7559
|
+
`;
|
|
7560
|
+
var SearchAndFilterOutterControlWrapper = (gridColumns) => css38`
|
|
7561
|
+
align-items: stretch;
|
|
7562
|
+
display: grid;
|
|
7563
|
+
grid-template-columns: ${gridColumns};
|
|
7564
|
+
gap: var(--spacing-sm);
|
|
7565
|
+
`;
|
|
7566
|
+
var ConditionalFilterRow = css38`
|
|
7567
|
+
display: grid;
|
|
7568
|
+
grid-template-columns: 35px 1fr;
|
|
7569
|
+
gap: var(--spacing-sm);
|
|
7570
|
+
margin-left: var(--spacing-base);
|
|
7571
|
+
|
|
7572
|
+
${cq("380px")} {
|
|
7573
|
+
align-items: center;
|
|
7574
|
+
|
|
7575
|
+
&:after {
|
|
7576
|
+
content: '';
|
|
7577
|
+
display: block;
|
|
7578
|
+
height: 1px;
|
|
7579
|
+
background: var(--gray-300);
|
|
7580
|
+
width: calc(100% - var(--spacing-base));
|
|
7581
|
+
margin-left: var(--spacing-base);
|
|
7252
7582
|
}
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
{
|
|
7256
|
-
disableInlineMenu: true,
|
|
7257
|
-
showMenuPosition: "inline-right",
|
|
7258
|
-
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
7259
|
-
value: props.value,
|
|
7260
|
-
disabled: props.disabled,
|
|
7261
|
-
inputWhenNoVariables: /* @__PURE__ */ jsx69(WrappedComponent, { ...props })
|
|
7262
|
-
}
|
|
7263
|
-
);
|
|
7264
|
-
};
|
|
7265
|
-
return WithInputVariables;
|
|
7266
|
-
}
|
|
7267
|
-
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
7268
|
-
const WithInputVariables = (props) => {
|
|
7269
|
-
var _a;
|
|
7270
|
-
if (!props.bindable || props.disabled || props.readOnly) {
|
|
7271
|
-
return /* @__PURE__ */ jsx69(WrappedComponent, { ...props });
|
|
7583
|
+
&:last-of-type:after {
|
|
7584
|
+
display: none;
|
|
7272
7585
|
}
|
|
7273
|
-
|
|
7274
|
-
InputVariables,
|
|
7275
|
-
{
|
|
7276
|
-
disableInlineMenu: true,
|
|
7277
|
-
showMenuPosition: "inline-right",
|
|
7278
|
-
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
7279
|
-
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
7280
|
-
inputWhenNoVariables: /* @__PURE__ */ jsx69(WrappedComponent, { ...props })
|
|
7281
|
-
}
|
|
7282
|
-
);
|
|
7283
|
-
};
|
|
7284
|
-
return WithInputVariables;
|
|
7285
|
-
}
|
|
7286
|
-
var bindableFiltersMapper = {
|
|
7287
|
-
...filterMapper,
|
|
7288
|
-
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
7289
|
-
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
7290
|
-
date: withInputVariables(DateEditor),
|
|
7291
|
-
text: withInputVariables(TextEditor),
|
|
7292
|
-
number: withInputVariables(NumberEditor)
|
|
7293
|
-
};
|
|
7586
|
+
}
|
|
7294
7587
|
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
return { newValue, options: validate(newValue, options) };
|
|
7300
|
-
});
|
|
7301
|
-
}
|
|
7588
|
+
&:nth-of-type(2) {
|
|
7589
|
+
margin-left: 0;
|
|
7590
|
+
grid-template-columns: 50px 1fr;
|
|
7591
|
+
}
|
|
7302
7592
|
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
function useContentDataResourceLocaleInfo({
|
|
7307
|
-
locale,
|
|
7308
|
-
setLocale,
|
|
7309
|
-
dynamicInputs
|
|
7310
|
-
}) {
|
|
7311
|
-
var _a;
|
|
7312
|
-
const setLocaleRef = useRef16(setLocale);
|
|
7313
|
-
setLocaleRef.current = setLocale;
|
|
7314
|
-
const { flatVariables } = useVariables();
|
|
7315
|
-
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
|
|
7316
|
-
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7317
|
-
useEffect18(() => {
|
|
7318
|
-
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7319
|
-
setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
|
|
7593
|
+
${cq("580px")} {
|
|
7594
|
+
&:after {
|
|
7595
|
+
display: none;
|
|
7320
7596
|
}
|
|
7321
|
-
}
|
|
7322
|
-
|
|
7597
|
+
}
|
|
7598
|
+
|
|
7599
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
7600
|
+
animation: ${fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
7601
|
+
}
|
|
7602
|
+
`;
|
|
7603
|
+
var ConditionalInputRow = css38`
|
|
7604
|
+
display: flex;
|
|
7605
|
+
gap: var(--spacing-sm);
|
|
7606
|
+
flex-wrap: wrap;
|
|
7607
|
+
|
|
7608
|
+
${cq("380px")} {
|
|
7609
|
+
& > div:nth-child(-n + 2) {
|
|
7610
|
+
width: calc(50% - var(--spacing-sm));
|
|
7611
|
+
}
|
|
7612
|
+
|
|
7613
|
+
& > div:nth-child(n + 3) {
|
|
7614
|
+
width: calc(100% - 48px);
|
|
7615
|
+
}
|
|
7616
|
+
}
|
|
7617
|
+
${cq("764px")} {
|
|
7618
|
+
display: grid;
|
|
7619
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
7620
|
+
|
|
7621
|
+
& > div:nth-child(n) {
|
|
7622
|
+
width: auto;
|
|
7623
|
+
}
|
|
7624
|
+
}
|
|
7625
|
+
`;
|
|
7626
|
+
var SearchInput = css38`
|
|
7627
|
+
max-height: 40px;
|
|
7628
|
+
min-height: unset;
|
|
7629
|
+
`;
|
|
7630
|
+
var FilterButton = css38`
|
|
7631
|
+
align-items: center;
|
|
7632
|
+
background: var(--white);
|
|
7633
|
+
border: 1px solid var(--gray-300);
|
|
7634
|
+
border-radius: var(--rounded-full);
|
|
7635
|
+
color: var(--typography-base);
|
|
7636
|
+
display: flex;
|
|
7637
|
+
font-size: var(--fs-sm);
|
|
7638
|
+
gap: var(--spacing-sm);
|
|
7639
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
7640
|
+
max-height: 40px;
|
|
7641
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
7642
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
7643
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
7644
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
7645
|
+
|
|
7646
|
+
svg {
|
|
7647
|
+
color: var(--gray-300);
|
|
7648
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7649
|
+
}
|
|
7650
|
+
|
|
7651
|
+
&:hover,
|
|
7652
|
+
:where([aria-expanded='true']) {
|
|
7653
|
+
outline: none;
|
|
7654
|
+
background: var(--gray-200);
|
|
7655
|
+
border-color: var(--gray-300);
|
|
7656
|
+
|
|
7657
|
+
svg {
|
|
7658
|
+
color: var(--typography-base);
|
|
7659
|
+
}
|
|
7660
|
+
}
|
|
7661
|
+
|
|
7662
|
+
&:disabled {
|
|
7663
|
+
opacity: var(--opacity-50);
|
|
7664
|
+
}
|
|
7665
|
+
`;
|
|
7666
|
+
var FilterButtonText = css38`
|
|
7667
|
+
overflow: hidden;
|
|
7668
|
+
text-overflow: ellipsis;
|
|
7669
|
+
white-space: nowrap;
|
|
7670
|
+
max-width: 14ch;
|
|
7671
|
+
`;
|
|
7672
|
+
var FilterButtonSelected = css38`
|
|
7673
|
+
background: var(--gray-100);
|
|
7674
|
+
border-color: var(--gray-300);
|
|
7675
|
+
|
|
7676
|
+
svg {
|
|
7677
|
+
color: var(--accent-dark);
|
|
7678
|
+
}
|
|
7679
|
+
`;
|
|
7680
|
+
var FilterButtonWithOptions = css38`
|
|
7681
|
+
:where([aria-expanded='true']) {
|
|
7682
|
+
background: var(--purple-rain-100);
|
|
7683
|
+
border-color: var(--accent-light);
|
|
7684
|
+
color: var(--typography-base);
|
|
7685
|
+
box-shadow: var(--elevation-100);
|
|
7686
|
+
|
|
7687
|
+
svg {
|
|
7688
|
+
color: var(--accent-dark);
|
|
7689
|
+
}
|
|
7690
|
+
}
|
|
7691
|
+
`;
|
|
7692
|
+
var SearchIcon = css38`
|
|
7693
|
+
color: var(--icon-color);
|
|
7694
|
+
position: absolute;
|
|
7695
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
7696
|
+
margin: auto;
|
|
7697
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7698
|
+
`;
|
|
7699
|
+
var AddConditionalBtn = css38`
|
|
7700
|
+
align-items: center;
|
|
7701
|
+
background: transparent;
|
|
7702
|
+
border: none;
|
|
7703
|
+
color: var(--primary-action-default);
|
|
7704
|
+
display: flex;
|
|
7705
|
+
gap: var(--spacing-sm);
|
|
7706
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7707
|
+
padding: 0;
|
|
7708
|
+
|
|
7709
|
+
&:hover,
|
|
7710
|
+
&:focus {
|
|
7711
|
+
color: var(--primary-action-hover);
|
|
7712
|
+
}
|
|
7713
|
+
|
|
7714
|
+
&:disabled {
|
|
7715
|
+
color: var(--gray-400);
|
|
7716
|
+
}
|
|
7717
|
+
`;
|
|
7718
|
+
var Title = css38`
|
|
7719
|
+
color: var(--typography-light);
|
|
7720
|
+
|
|
7721
|
+
&:focus {
|
|
7722
|
+
outline: none;
|
|
7723
|
+
}
|
|
7724
|
+
`;
|
|
7725
|
+
var ResetConditionsBtn = css38`
|
|
7726
|
+
background: transparent;
|
|
7727
|
+
border: none;
|
|
7728
|
+
color: var(--action-destructive-default);
|
|
7729
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7730
|
+
padding: 0;
|
|
7731
|
+
|
|
7732
|
+
&:hover,
|
|
7733
|
+
&:focus {
|
|
7734
|
+
color: var(--action-destructive-hover);
|
|
7735
|
+
}
|
|
7736
|
+
`;
|
|
7737
|
+
var IconBtn = css38`
|
|
7738
|
+
background: transparent;
|
|
7739
|
+
border: none;
|
|
7740
|
+
padding: var(--spacing-sm);
|
|
7741
|
+
`;
|
|
7742
|
+
var SearchAndFilterOptionsContainer = css38`
|
|
7743
|
+
background: var(--gray-50);
|
|
7744
|
+
border: 1px solid var(--gray-300);
|
|
7745
|
+
border-radius: var(--rounded-base);
|
|
7746
|
+
container-type: inline-size;
|
|
7747
|
+
display: flex;
|
|
7748
|
+
flex-direction: column;
|
|
7749
|
+
gap: var(--spacing-sm);
|
|
7750
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
7751
|
+
will-change: height;
|
|
7752
|
+
position: relative;
|
|
7753
|
+
z-index: 1;
|
|
7754
|
+
`;
|
|
7755
|
+
var SearchAndFilterOptionsInnerContainer = css38`
|
|
7756
|
+
display: flex;
|
|
7757
|
+
flex-direction: column;
|
|
7758
|
+
gap: var(--spacing-sm);
|
|
7759
|
+
padding-inline: var(--spacing-md);
|
|
7760
|
+
`;
|
|
7761
|
+
var SearchAndFilterButtonGroup = css38`
|
|
7762
|
+
margin-top: var(--spacing-xs);
|
|
7763
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
7764
|
+
`;
|
|
7765
|
+
|
|
7766
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7767
|
+
import { jsx as jsx69, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
|
|
7768
|
+
var FilterButton2 = ({
|
|
7769
|
+
text = "Filters",
|
|
7770
|
+
icon = "filter-add",
|
|
7771
|
+
filterCount,
|
|
7772
|
+
hasSelectedValue,
|
|
7773
|
+
dataTestId,
|
|
7774
|
+
...props
|
|
7775
|
+
}) => {
|
|
7776
|
+
return /* @__PURE__ */ jsxs42(
|
|
7777
|
+
"button",
|
|
7778
|
+
{
|
|
7779
|
+
type: "button",
|
|
7780
|
+
css: [
|
|
7781
|
+
FilterButton,
|
|
7782
|
+
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
7783
|
+
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
7784
|
+
],
|
|
7785
|
+
...props,
|
|
7786
|
+
"data-testid": dataTestId,
|
|
7787
|
+
children: [
|
|
7788
|
+
/* @__PURE__ */ jsx69(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
7789
|
+
/* @__PURE__ */ jsx69("span", { css: FilterButtonText, children: text }),
|
|
7790
|
+
filterCount ? /* @__PURE__ */ jsx69(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
7791
|
+
]
|
|
7792
|
+
}
|
|
7793
|
+
);
|
|
7794
|
+
};
|
|
7795
|
+
|
|
7796
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
7797
|
+
import { InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
7798
|
+
import { useEffect as useEffect21, useState as useState21 } from "react";
|
|
7799
|
+
import { useDebounce as useDebounce5 } from "react-use";
|
|
7800
|
+
|
|
7801
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
7802
|
+
import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
|
|
7803
|
+
import {
|
|
7804
|
+
createContext as createContext6,
|
|
7805
|
+
useCallback as useCallback6,
|
|
7806
|
+
useContext as useContext8,
|
|
7807
|
+
useDeferredValue as useDeferredValue2,
|
|
7808
|
+
useEffect as useEffect20,
|
|
7809
|
+
useMemo as useMemo17,
|
|
7810
|
+
useState as useState20
|
|
7811
|
+
} from "react";
|
|
7812
|
+
|
|
7813
|
+
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
7814
|
+
import { FieldMessage, Input as Input6, InputComboBox, StatusBullet } from "@uniformdev/design-system";
|
|
7815
|
+
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
7816
|
+
import { useDebounce as useDebounce4 } from "react-use";
|
|
7817
|
+
import { Fragment as Fragment14, jsx as jsx70, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
|
|
7818
|
+
var readOnlyAttributes = {
|
|
7819
|
+
isSearchable: false,
|
|
7820
|
+
menuIsOpen: false,
|
|
7821
|
+
isClearable: false
|
|
7822
|
+
};
|
|
7823
|
+
var FilterMultiChoiceEditor = ({
|
|
7824
|
+
value,
|
|
7825
|
+
options,
|
|
7826
|
+
disabled,
|
|
7827
|
+
readOnly,
|
|
7828
|
+
valueTestId,
|
|
7829
|
+
...props
|
|
7830
|
+
}) => {
|
|
7831
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
7832
|
+
const isClearable = !readOnly || !disabled;
|
|
7833
|
+
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
7834
|
+
InputComboBox,
|
|
7835
|
+
{
|
|
7836
|
+
...props,
|
|
7837
|
+
placeholder: "Type to search...",
|
|
7838
|
+
options,
|
|
7839
|
+
isMulti: true,
|
|
7840
|
+
isClearable,
|
|
7841
|
+
isDisabled: disabled,
|
|
7842
|
+
onChange: (e) => {
|
|
7843
|
+
var _a;
|
|
7844
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
7845
|
+
},
|
|
7846
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
7847
|
+
"aria-readonly": readOnly,
|
|
7848
|
+
styles: {
|
|
7849
|
+
menu(base) {
|
|
7850
|
+
return {
|
|
7851
|
+
...base,
|
|
7852
|
+
minWidth: "max-content"
|
|
7853
|
+
};
|
|
7854
|
+
}
|
|
7855
|
+
},
|
|
7856
|
+
...readOnlyProps
|
|
7857
|
+
}
|
|
7858
|
+
) });
|
|
7859
|
+
};
|
|
7860
|
+
var FilterSingleChoiceEditor = ({
|
|
7861
|
+
options,
|
|
7862
|
+
value,
|
|
7863
|
+
disabled,
|
|
7864
|
+
readOnly,
|
|
7865
|
+
onChange,
|
|
7866
|
+
valueTestId
|
|
7867
|
+
}) => {
|
|
7868
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
7869
|
+
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
7870
|
+
InputComboBox,
|
|
7871
|
+
{
|
|
7872
|
+
placeholder: "Type to search...",
|
|
7873
|
+
options,
|
|
7874
|
+
isClearable: true,
|
|
7875
|
+
onChange: (e) => {
|
|
7876
|
+
var _a;
|
|
7877
|
+
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
7878
|
+
},
|
|
7879
|
+
isDisabled: disabled,
|
|
7880
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
7881
|
+
"aria-readonly": readOnly,
|
|
7882
|
+
styles: {
|
|
7883
|
+
menu(base) {
|
|
7884
|
+
return {
|
|
7885
|
+
...base,
|
|
7886
|
+
minWidth: "max-content"
|
|
7887
|
+
};
|
|
7888
|
+
}
|
|
7889
|
+
},
|
|
7890
|
+
...readOnlyProps
|
|
7891
|
+
}
|
|
7892
|
+
) });
|
|
7893
|
+
};
|
|
7894
|
+
var CustomOptions = ({ label, value }) => {
|
|
7895
|
+
return /* @__PURE__ */ jsx70(StatusBullet, { status: label, message: value });
|
|
7896
|
+
};
|
|
7897
|
+
var StatusMultiEditor = ({
|
|
7898
|
+
options,
|
|
7899
|
+
value,
|
|
7900
|
+
disabled,
|
|
7901
|
+
readOnly,
|
|
7902
|
+
onChange,
|
|
7903
|
+
valueTestId
|
|
7904
|
+
}) => {
|
|
7905
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
7906
|
+
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
7907
|
+
InputComboBox,
|
|
7908
|
+
{
|
|
7909
|
+
options,
|
|
7910
|
+
isMulti: true,
|
|
7911
|
+
onChange: (e) => {
|
|
7912
|
+
var _a;
|
|
7913
|
+
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
7914
|
+
},
|
|
7915
|
+
formatOptionLabel: CustomOptions,
|
|
7916
|
+
"aria-readonly": readOnly,
|
|
7917
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
7918
|
+
isDisabled: disabled,
|
|
7919
|
+
styles: {
|
|
7920
|
+
menu(base) {
|
|
7921
|
+
return {
|
|
7922
|
+
...base,
|
|
7923
|
+
minWidth: "max-content"
|
|
7924
|
+
};
|
|
7925
|
+
}
|
|
7926
|
+
},
|
|
7927
|
+
...readOnlyProps
|
|
7928
|
+
}
|
|
7929
|
+
) });
|
|
7930
|
+
};
|
|
7931
|
+
var StatusSingleEditor = ({
|
|
7932
|
+
options,
|
|
7933
|
+
value,
|
|
7934
|
+
disabled,
|
|
7935
|
+
readOnly,
|
|
7936
|
+
onChange,
|
|
7937
|
+
valueTestId
|
|
7938
|
+
}) => {
|
|
7939
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
7940
|
+
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
7941
|
+
InputComboBox,
|
|
7942
|
+
{
|
|
7943
|
+
options,
|
|
7944
|
+
onChange: (e) => {
|
|
7945
|
+
var _a;
|
|
7946
|
+
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
7947
|
+
},
|
|
7948
|
+
formatOptionLabel: CustomOptions,
|
|
7949
|
+
"aria-readonly": readOnly,
|
|
7950
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
7951
|
+
isDisabled: disabled,
|
|
7952
|
+
styles: {
|
|
7953
|
+
menu(base) {
|
|
7954
|
+
return {
|
|
7955
|
+
...base,
|
|
7956
|
+
minWidth: "max-content"
|
|
7957
|
+
};
|
|
7958
|
+
}
|
|
7959
|
+
},
|
|
7960
|
+
...readOnlyProps
|
|
7961
|
+
}
|
|
7962
|
+
) });
|
|
7963
|
+
};
|
|
7964
|
+
var TextEditor = ({
|
|
7965
|
+
onChange,
|
|
7966
|
+
ariaLabel,
|
|
7967
|
+
value,
|
|
7968
|
+
readOnly,
|
|
7969
|
+
valueTestId
|
|
7970
|
+
}) => {
|
|
7971
|
+
const [innerValue, setInnerValue] = useState19(value != null ? value : "");
|
|
7972
|
+
useDebounce4(() => onChange(innerValue), 500, [innerValue]);
|
|
7973
|
+
return /* @__PURE__ */ jsx70(
|
|
7974
|
+
Input6,
|
|
7975
|
+
{
|
|
7976
|
+
showLabel: false,
|
|
7977
|
+
label: ariaLabel,
|
|
7978
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
7979
|
+
placeholder: "Enter phrase to search\u2026",
|
|
7980
|
+
value: innerValue,
|
|
7981
|
+
readOnly,
|
|
7982
|
+
"data-testid": valueTestId
|
|
7983
|
+
}
|
|
7984
|
+
);
|
|
7985
|
+
};
|
|
7986
|
+
var NumberRangeEditor = ({
|
|
7987
|
+
onChange,
|
|
7988
|
+
disabled,
|
|
7989
|
+
ariaLabel,
|
|
7990
|
+
value,
|
|
7991
|
+
readOnly,
|
|
7992
|
+
valueTestId
|
|
7993
|
+
}) => {
|
|
7994
|
+
const [minValue, setMinValue] = useState19("");
|
|
7995
|
+
const [maxValue, setMaxValue] = useState19("");
|
|
7996
|
+
const [error, setError] = useState19("");
|
|
7997
|
+
useDebounce4(
|
|
7998
|
+
() => {
|
|
7999
|
+
if (minValue && maxValue && !error) {
|
|
8000
|
+
onChange([minValue, maxValue]);
|
|
8001
|
+
} else {
|
|
8002
|
+
onChange([]);
|
|
8003
|
+
}
|
|
8004
|
+
},
|
|
8005
|
+
500,
|
|
8006
|
+
[minValue, maxValue]
|
|
8007
|
+
);
|
|
8008
|
+
useEffect19(() => {
|
|
8009
|
+
if (!maxValue && !minValue) {
|
|
8010
|
+
return;
|
|
8011
|
+
}
|
|
8012
|
+
const max = Number(maxValue);
|
|
8013
|
+
const min = Number(minValue);
|
|
8014
|
+
if (max < min || min > max) {
|
|
8015
|
+
setError("Please enter a valid numeric range");
|
|
8016
|
+
return;
|
|
8017
|
+
}
|
|
8018
|
+
if (maxValue && !minValue || minValue && !maxValue) {
|
|
8019
|
+
setError("Please enter both a low and high number");
|
|
8020
|
+
return;
|
|
8021
|
+
}
|
|
8022
|
+
if (error) {
|
|
8023
|
+
setError("");
|
|
8024
|
+
}
|
|
8025
|
+
if (min && max) {
|
|
8026
|
+
setMinValue(minValue);
|
|
8027
|
+
setMaxValue(maxValue);
|
|
8028
|
+
}
|
|
8029
|
+
}, [maxValue, minValue, setError]);
|
|
8030
|
+
return /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
8031
|
+
/* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8032
|
+
/* @__PURE__ */ jsx70(
|
|
8033
|
+
Input6,
|
|
8034
|
+
{
|
|
8035
|
+
label: `${ariaLabel}-min`,
|
|
8036
|
+
type: "number",
|
|
8037
|
+
showLabel: false,
|
|
8038
|
+
min: 0,
|
|
8039
|
+
placeholder: "Low",
|
|
8040
|
+
onChange: (e) => setMinValue(e.currentTarget.value),
|
|
8041
|
+
"aria-invalid": !error ? false : true,
|
|
8042
|
+
disabled,
|
|
8043
|
+
value: value ? value[0] : "",
|
|
8044
|
+
readOnly,
|
|
8045
|
+
"data-testid": "value-low"
|
|
8046
|
+
}
|
|
8047
|
+
),
|
|
8048
|
+
/* @__PURE__ */ jsx70(
|
|
8049
|
+
Input6,
|
|
8050
|
+
{
|
|
8051
|
+
type: "number",
|
|
8052
|
+
label: `${ariaLabel}-max`,
|
|
8053
|
+
showLabel: false,
|
|
8054
|
+
min: 0,
|
|
8055
|
+
placeholder: "High",
|
|
8056
|
+
onChange: (e) => setMaxValue(e.currentTarget.value),
|
|
8057
|
+
"aria-invalid": !error ? false : true,
|
|
8058
|
+
disabled,
|
|
8059
|
+
value: value ? value[1] : "",
|
|
8060
|
+
readOnly,
|
|
8061
|
+
"data-testid": "value-high"
|
|
8062
|
+
}
|
|
8063
|
+
)
|
|
8064
|
+
] }),
|
|
8065
|
+
/* @__PURE__ */ jsx70(ErrorContainer, { errorMessage: error })
|
|
8066
|
+
] });
|
|
8067
|
+
};
|
|
8068
|
+
var NumberEditor = ({
|
|
8069
|
+
ariaLabel,
|
|
8070
|
+
onChange,
|
|
8071
|
+
disabled,
|
|
8072
|
+
value,
|
|
8073
|
+
readOnly,
|
|
8074
|
+
valueTestId
|
|
8075
|
+
}) => {
|
|
8076
|
+
const [innerValue, setInnerValue] = useState19(value != null ? value : "");
|
|
8077
|
+
useDebounce4(() => onChange(innerValue), 500, [innerValue]);
|
|
8078
|
+
return /* @__PURE__ */ jsx70(
|
|
8079
|
+
Input6,
|
|
8080
|
+
{
|
|
8081
|
+
label: ariaLabel,
|
|
8082
|
+
type: "number",
|
|
8083
|
+
showLabel: false,
|
|
8084
|
+
min: 0,
|
|
8085
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8086
|
+
disabled,
|
|
8087
|
+
value: innerValue,
|
|
8088
|
+
readOnly,
|
|
8089
|
+
"data-testid": valueTestId
|
|
8090
|
+
}
|
|
8091
|
+
);
|
|
8092
|
+
};
|
|
8093
|
+
var DateEditor = ({
|
|
8094
|
+
onChange,
|
|
8095
|
+
ariaLabel,
|
|
8096
|
+
disabled,
|
|
8097
|
+
value,
|
|
8098
|
+
readOnly,
|
|
8099
|
+
valueTestId
|
|
8100
|
+
}) => {
|
|
8101
|
+
const [innerValue, setInnerValue] = useState19(value != null ? value : "");
|
|
8102
|
+
useDebounce4(() => onChange(innerValue), 500, [innerValue]);
|
|
8103
|
+
return /* @__PURE__ */ jsx70(
|
|
8104
|
+
Input6,
|
|
8105
|
+
{
|
|
8106
|
+
type: "date",
|
|
8107
|
+
label: ariaLabel,
|
|
8108
|
+
showLabel: false,
|
|
8109
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8110
|
+
disabled,
|
|
8111
|
+
value: innerValue,
|
|
8112
|
+
readOnly,
|
|
8113
|
+
"data-testid": valueTestId
|
|
8114
|
+
}
|
|
8115
|
+
);
|
|
8116
|
+
};
|
|
8117
|
+
var DateRangeEditor = ({
|
|
8118
|
+
ariaLabel,
|
|
8119
|
+
onChange,
|
|
8120
|
+
disabled,
|
|
8121
|
+
value,
|
|
8122
|
+
readOnly,
|
|
8123
|
+
valueTestId
|
|
8124
|
+
}) => {
|
|
8125
|
+
const [minDateValue, setMinDateValue] = useState19(value ? value[0] : "");
|
|
8126
|
+
const [maxDateValue, setMaxDateValue] = useState19(value ? value[1] : "");
|
|
8127
|
+
const [error, setError] = useState19("");
|
|
8128
|
+
useDebounce4(
|
|
8129
|
+
() => {
|
|
8130
|
+
if (minDateValue && maxDateValue && !error) {
|
|
8131
|
+
onChange([minDateValue, maxDateValue]);
|
|
8132
|
+
} else {
|
|
8133
|
+
onChange([]);
|
|
8134
|
+
}
|
|
8135
|
+
},
|
|
8136
|
+
500,
|
|
8137
|
+
[minDateValue, maxDateValue]
|
|
8138
|
+
);
|
|
8139
|
+
useEffect19(() => {
|
|
8140
|
+
if (!minDateValue || !maxDateValue) {
|
|
8141
|
+
return;
|
|
8142
|
+
}
|
|
8143
|
+
const minDate = new Date(minDateValue);
|
|
8144
|
+
const maxDate = new Date(maxDateValue);
|
|
8145
|
+
if (maxDate < minDate) {
|
|
8146
|
+
setError("The max date cannot be lower than the min date");
|
|
8147
|
+
return;
|
|
8148
|
+
}
|
|
8149
|
+
if (maxDate && !minDate) {
|
|
8150
|
+
setError("Please enter both a low and high date");
|
|
8151
|
+
return;
|
|
8152
|
+
}
|
|
8153
|
+
const minDateString = minDate.toDateString();
|
|
8154
|
+
const maxDateString = maxDate.toDateString();
|
|
8155
|
+
if (minDateString === maxDateString || maxDateString === minDateString) {
|
|
8156
|
+
setError("The min and max date cannot be the same");
|
|
8157
|
+
return;
|
|
8158
|
+
}
|
|
8159
|
+
if (minDate > maxDate) {
|
|
8160
|
+
setError("The min date cannot be higher than the max date");
|
|
8161
|
+
return;
|
|
8162
|
+
}
|
|
8163
|
+
if (error) {
|
|
8164
|
+
setError("");
|
|
8165
|
+
}
|
|
8166
|
+
if (minDate && maxDate) {
|
|
8167
|
+
setMinDateValue(minDateValue);
|
|
8168
|
+
setMaxDateValue(maxDateValue);
|
|
8169
|
+
} else {
|
|
8170
|
+
setMinDateValue("");
|
|
8171
|
+
setMaxDateValue("");
|
|
8172
|
+
}
|
|
8173
|
+
}, [minDateValue, maxDateValue, setError]);
|
|
8174
|
+
return /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
8175
|
+
/* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8176
|
+
/* @__PURE__ */ jsx70(
|
|
8177
|
+
Input6,
|
|
8178
|
+
{
|
|
8179
|
+
label: `${ariaLabel}-min-date`,
|
|
8180
|
+
type: "date",
|
|
8181
|
+
showLabel: false,
|
|
8182
|
+
value: minDateValue,
|
|
8183
|
+
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
8184
|
+
"aria-invalid": !error ? false : true,
|
|
8185
|
+
disabled,
|
|
8186
|
+
readOnly
|
|
8187
|
+
}
|
|
8188
|
+
),
|
|
8189
|
+
/* @__PURE__ */ jsx70(
|
|
8190
|
+
Input6,
|
|
8191
|
+
{
|
|
8192
|
+
label: `${ariaLabel}-max-date`,
|
|
8193
|
+
type: "date",
|
|
8194
|
+
showLabel: false,
|
|
8195
|
+
value: maxDateValue,
|
|
8196
|
+
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
8197
|
+
"aria-invalid": !error ? false : true,
|
|
8198
|
+
disabled,
|
|
8199
|
+
readOnly
|
|
8200
|
+
}
|
|
8201
|
+
)
|
|
8202
|
+
] }),
|
|
8203
|
+
/* @__PURE__ */ jsx70(ErrorContainer, { errorMessage: error })
|
|
8204
|
+
] });
|
|
8205
|
+
};
|
|
8206
|
+
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
8207
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
8208
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
8209
|
+
if (!Editor) {
|
|
8210
|
+
return null;
|
|
8211
|
+
}
|
|
8212
|
+
if (editorType === "empty") {
|
|
8213
|
+
return null;
|
|
8214
|
+
}
|
|
8215
|
+
return /* @__PURE__ */ jsx70(Editor, { ...props });
|
|
8216
|
+
};
|
|
8217
|
+
var filterMapper = {
|
|
8218
|
+
multiChoice: FilterMultiChoiceEditor,
|
|
8219
|
+
singleChoice: FilterSingleChoiceEditor,
|
|
8220
|
+
date: DateEditor,
|
|
8221
|
+
dateRange: DateRangeEditor,
|
|
8222
|
+
text: TextEditor,
|
|
8223
|
+
numberRange: NumberRangeEditor,
|
|
8224
|
+
number: NumberEditor,
|
|
8225
|
+
statusMultiChoice: StatusMultiEditor,
|
|
8226
|
+
statusSingleChoice: StatusSingleEditor,
|
|
8227
|
+
empty: null
|
|
8228
|
+
};
|
|
8229
|
+
var ErrorContainer = ({ errorMessage }) => {
|
|
8230
|
+
return /* @__PURE__ */ jsx70(
|
|
8231
|
+
"div",
|
|
8232
|
+
{
|
|
8233
|
+
css: {
|
|
8234
|
+
gridColumn: "span 6",
|
|
8235
|
+
order: 6
|
|
8236
|
+
},
|
|
8237
|
+
children: /* @__PURE__ */ jsx70(FieldMessage, { errorMessage })
|
|
8238
|
+
}
|
|
8239
|
+
);
|
|
8240
|
+
};
|
|
8241
|
+
var twoColumnGrid = {
|
|
8242
|
+
display: "grid",
|
|
8243
|
+
gridTemplateColumns: "1fr 1fr",
|
|
8244
|
+
gap: "var(--spacing-sm);"
|
|
8245
|
+
};
|
|
8246
|
+
|
|
8247
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8248
|
+
import { jsx as jsx71 } from "@emotion/react/jsx-runtime";
|
|
8249
|
+
var SearchAndFilterContext = createContext6({
|
|
8250
|
+
searchTerm: "",
|
|
8251
|
+
setSearchTerm: () => {
|
|
8252
|
+
},
|
|
8253
|
+
filterVisibility: void 0,
|
|
8254
|
+
setFilterVisibility: () => {
|
|
8255
|
+
},
|
|
8256
|
+
filters: [],
|
|
8257
|
+
setFilters: () => {
|
|
8258
|
+
},
|
|
8259
|
+
handleAddFilter: () => {
|
|
8260
|
+
},
|
|
8261
|
+
handleResetFilters: () => {
|
|
8262
|
+
},
|
|
8263
|
+
handleDeleteFilter: () => {
|
|
8264
|
+
},
|
|
8265
|
+
filterOptions: [],
|
|
8266
|
+
validFilterQuery: [],
|
|
8267
|
+
filterMapper: {},
|
|
8268
|
+
totalResults: 0
|
|
8269
|
+
});
|
|
8270
|
+
var SearchAndFilterProvider = ({
|
|
8271
|
+
filters,
|
|
8272
|
+
filterOptions,
|
|
8273
|
+
filterVisible = false,
|
|
8274
|
+
defaultSearchTerm = "",
|
|
8275
|
+
onSearchChange,
|
|
8276
|
+
onChange,
|
|
8277
|
+
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
8278
|
+
totalResults,
|
|
8279
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
8280
|
+
children
|
|
8281
|
+
}) => {
|
|
8282
|
+
const [searchTerm, setSearchTerm] = useState20(defaultSearchTerm);
|
|
8283
|
+
const deferredSearchTerm = useDeferredValue2(searchTerm);
|
|
8284
|
+
const [filterVisibility, setFilterVisibility] = useState20(filterVisible);
|
|
8285
|
+
const handleSearchTerm = useCallback6(
|
|
8286
|
+
(term) => {
|
|
8287
|
+
setSearchTerm(term);
|
|
8288
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
8289
|
+
},
|
|
8290
|
+
[setSearchTerm, onSearchChange]
|
|
8291
|
+
);
|
|
8292
|
+
const handleToggleFilterVisibility = useCallback6(
|
|
8293
|
+
(visible) => setFilterVisibility(visible),
|
|
8294
|
+
[setFilterVisibility]
|
|
8295
|
+
);
|
|
8296
|
+
const handleAddFilter = useCallback6(() => {
|
|
8297
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
8298
|
+
}, [filters, onChange]);
|
|
8299
|
+
const handleResetFilters = useCallback6(() => {
|
|
8300
|
+
onChange(resetFilterValues);
|
|
8301
|
+
}, [onChange, resetFilterValues]);
|
|
8302
|
+
const handleDeleteFilter = useCallback6(
|
|
8303
|
+
(index) => {
|
|
8304
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
8305
|
+
onChange(remainingFilters);
|
|
8306
|
+
},
|
|
8307
|
+
[filters, onChange]
|
|
8308
|
+
);
|
|
8309
|
+
const validFilterQuery = useMemo17(() => {
|
|
8310
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
8311
|
+
if (hasValidFilters) {
|
|
8312
|
+
return filters;
|
|
8313
|
+
}
|
|
8314
|
+
}, [filters]);
|
|
8315
|
+
useEffect20(() => {
|
|
8316
|
+
if (filterVisibility) {
|
|
8317
|
+
const handleEscKeyFilterClose = (e) => {
|
|
8318
|
+
if (e.key === "Escape") {
|
|
8319
|
+
setFilterVisibility(false);
|
|
8320
|
+
}
|
|
8321
|
+
};
|
|
8322
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8323
|
+
return () => {
|
|
8324
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8325
|
+
};
|
|
8326
|
+
}
|
|
8327
|
+
}, [filterVisibility]);
|
|
8328
|
+
return /* @__PURE__ */ jsx71(
|
|
8329
|
+
SearchAndFilterContext.Provider,
|
|
8330
|
+
{
|
|
8331
|
+
value: {
|
|
8332
|
+
searchTerm: deferredSearchTerm,
|
|
8333
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
8334
|
+
filterVisibility,
|
|
8335
|
+
setFilterVisibility: (e) => handleToggleFilterVisibility(e),
|
|
8336
|
+
filters,
|
|
8337
|
+
setFilters: (e) => onChange(e),
|
|
8338
|
+
handleAddFilter,
|
|
8339
|
+
handleResetFilters,
|
|
8340
|
+
handleDeleteFilter,
|
|
8341
|
+
filterOptions,
|
|
8342
|
+
validFilterQuery,
|
|
8343
|
+
totalResults,
|
|
8344
|
+
filterMapper: filterMapper2
|
|
8345
|
+
},
|
|
8346
|
+
children: /* @__PURE__ */ jsx71(VerticalRhythm5, { children })
|
|
8347
|
+
}
|
|
8348
|
+
);
|
|
8349
|
+
};
|
|
8350
|
+
var useSearchAndFilter = () => {
|
|
8351
|
+
const value = useContext8(SearchAndFilterContext);
|
|
8352
|
+
return { ...value };
|
|
8353
|
+
};
|
|
8354
|
+
|
|
8355
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8356
|
+
import { Fragment as Fragment15, jsx as jsx72, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
|
|
8357
|
+
var FilterControls = ({
|
|
8358
|
+
children,
|
|
8359
|
+
hideSearchInput
|
|
8360
|
+
}) => {
|
|
8361
|
+
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
8362
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState21("");
|
|
8363
|
+
useDebounce5(
|
|
8364
|
+
() => {
|
|
8365
|
+
setSearchTerm(localeSearchTerm);
|
|
8366
|
+
},
|
|
8367
|
+
300,
|
|
8368
|
+
[localeSearchTerm, searchTerm]
|
|
8369
|
+
);
|
|
8370
|
+
useEffect21(() => {
|
|
8371
|
+
if (searchTerm === "") {
|
|
8372
|
+
setLocaleSearchTerm("");
|
|
8373
|
+
}
|
|
8374
|
+
}, [searchTerm]);
|
|
8375
|
+
return /* @__PURE__ */ jsxs44(Fragment15, { children: [
|
|
8376
|
+
/* @__PURE__ */ jsx72(
|
|
8377
|
+
FilterButton2,
|
|
8378
|
+
{
|
|
8379
|
+
"aria-controls": "search-and-filter-options",
|
|
8380
|
+
"aria-label": "filter options",
|
|
8381
|
+
"aria-haspopup": "true",
|
|
8382
|
+
text: "Filter/Sort",
|
|
8383
|
+
"aria-expanded": filterVisibility === true,
|
|
8384
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
8385
|
+
onClick: () => setFilterVisibility(!filterVisibility),
|
|
8386
|
+
dataTestId: "filters-button"
|
|
8387
|
+
}
|
|
8388
|
+
),
|
|
8389
|
+
hideSearchInput ? null : /* @__PURE__ */ jsx72(
|
|
8390
|
+
InputKeywordSearch2,
|
|
8391
|
+
{
|
|
8392
|
+
placeholder: "Search...",
|
|
8393
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
8394
|
+
value: localeSearchTerm,
|
|
8395
|
+
compact: true,
|
|
8396
|
+
rounded: true,
|
|
8397
|
+
css: SearchInput
|
|
8398
|
+
}
|
|
8399
|
+
),
|
|
8400
|
+
children
|
|
8401
|
+
] });
|
|
8402
|
+
};
|
|
8403
|
+
|
|
8404
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8405
|
+
import { Icon as Icon7, InputComboBox as InputComboBox2 } from "@uniformdev/design-system";
|
|
8406
|
+
import { useMemo as useMemo18 } from "react";
|
|
8407
|
+
|
|
8408
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8409
|
+
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
8410
|
+
import React12, { useEffect as useEffect22 } from "react";
|
|
8411
|
+
import { jsx as jsx73, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
|
|
8412
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
8413
|
+
buttonRow,
|
|
8414
|
+
additionalFiltersContainer,
|
|
8415
|
+
children
|
|
8416
|
+
}) => {
|
|
8417
|
+
return /* @__PURE__ */ jsxs45("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8418
|
+
/* @__PURE__ */ jsx73("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8419
|
+
buttonRow ? /* @__PURE__ */ jsx73(
|
|
8420
|
+
HorizontalRhythm8,
|
|
8421
|
+
{
|
|
8422
|
+
css: SearchAndFilterButtonGroup,
|
|
8423
|
+
gap: "sm",
|
|
8424
|
+
align: "center",
|
|
8425
|
+
justify: "space-between",
|
|
8426
|
+
children: buttonRow
|
|
8427
|
+
}
|
|
8428
|
+
) : null,
|
|
8429
|
+
additionalFiltersContainer ? /* @__PURE__ */ jsx73("div", { children: additionalFiltersContainer }) : null
|
|
8430
|
+
] });
|
|
8431
|
+
};
|
|
8432
|
+
var FilterMenu = ({
|
|
8433
|
+
id,
|
|
8434
|
+
filterTitle = "Show results",
|
|
8435
|
+
menuControls,
|
|
8436
|
+
additionalFiltersContainer,
|
|
8437
|
+
children,
|
|
8438
|
+
dataTestId,
|
|
8439
|
+
resetButtonText = "reset"
|
|
8440
|
+
}) => {
|
|
8441
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8442
|
+
const innerMenuRef = React12.useRef(null);
|
|
8443
|
+
useEffect22(() => {
|
|
8444
|
+
var _a;
|
|
8445
|
+
if (filterVisibility) {
|
|
8446
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
8447
|
+
}
|
|
8448
|
+
}, [filterVisibility]);
|
|
8449
|
+
return /* @__PURE__ */ jsx73(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs45(
|
|
8450
|
+
SearchAndFilterOptionsContainer2,
|
|
8451
|
+
{
|
|
8452
|
+
buttonRow: menuControls,
|
|
8453
|
+
additionalFiltersContainer,
|
|
8454
|
+
children: [
|
|
8455
|
+
/* @__PURE__ */ jsxs45(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
8456
|
+
/* @__PURE__ */ jsx73("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
8457
|
+
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx73(
|
|
8458
|
+
"button",
|
|
8459
|
+
{
|
|
8460
|
+
type: "button",
|
|
8461
|
+
css: ResetConditionsBtn,
|
|
8462
|
+
onClick: () => {
|
|
8463
|
+
handleResetFilters();
|
|
8464
|
+
setFilterVisibility(false);
|
|
8465
|
+
},
|
|
8466
|
+
"data-testid": "reset-filters",
|
|
8467
|
+
children: resetButtonText
|
|
8468
|
+
}
|
|
8469
|
+
) : null
|
|
8470
|
+
] }),
|
|
8471
|
+
children
|
|
8472
|
+
]
|
|
8473
|
+
}
|
|
8474
|
+
) : null });
|
|
8475
|
+
};
|
|
8476
|
+
|
|
8477
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8478
|
+
import { jsx as jsx74, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
|
|
8479
|
+
var FilterItem = ({
|
|
8480
|
+
index,
|
|
8481
|
+
paramOptions,
|
|
8482
|
+
operatorOptions,
|
|
8483
|
+
valueOptions,
|
|
8484
|
+
onParamChange,
|
|
8485
|
+
onOperatorChange,
|
|
8486
|
+
onValueChange
|
|
8487
|
+
}) => {
|
|
8488
|
+
var _a, _b;
|
|
8489
|
+
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
8490
|
+
const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
|
|
8491
|
+
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
8492
|
+
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
8493
|
+
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
8494
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo18(() => {
|
|
8495
|
+
var _a2;
|
|
8496
|
+
const currentSelectedFilter = filterOptions.find((item) => {
|
|
8497
|
+
var _a3;
|
|
8498
|
+
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
8499
|
+
});
|
|
8500
|
+
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
8501
|
+
return filters[index].field === item.value;
|
|
8502
|
+
});
|
|
8503
|
+
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
8504
|
+
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
8505
|
+
return filters[index].operator === item.value;
|
|
8506
|
+
});
|
|
8507
|
+
return {
|
|
8508
|
+
selectedFieldValue: selectedFieldValue2,
|
|
8509
|
+
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
8510
|
+
selectedMetaValue: filters[index].value,
|
|
8511
|
+
readOnly: isCurrentFieldReadOnly,
|
|
8512
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
8513
|
+
};
|
|
8514
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
8515
|
+
const readOnlyProps = readOnly ? {
|
|
8516
|
+
"aria-readonly": true,
|
|
8517
|
+
isSearchable: false,
|
|
8518
|
+
menuIsOpen: false,
|
|
8519
|
+
isClearable: false
|
|
8520
|
+
} : {};
|
|
8521
|
+
return /* @__PURE__ */ jsxs46("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
8522
|
+
/* @__PURE__ */ jsx74("span", { children: index === 0 ? "Where" : "and" }),
|
|
8523
|
+
/* @__PURE__ */ jsxs46("div", { css: ConditionalInputRow, children: [
|
|
8524
|
+
/* @__PURE__ */ jsx74(
|
|
8525
|
+
InputComboBox2,
|
|
8526
|
+
{
|
|
8527
|
+
"aria-label": label,
|
|
8528
|
+
options: paramOptions,
|
|
8529
|
+
onChange: (e) => {
|
|
8530
|
+
var _a2;
|
|
8531
|
+
onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8532
|
+
},
|
|
8533
|
+
isOptionDisabled: (option) => {
|
|
8534
|
+
var _a2;
|
|
8535
|
+
return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
|
|
8536
|
+
},
|
|
8537
|
+
styles: {
|
|
8538
|
+
menu(base) {
|
|
8539
|
+
return {
|
|
8540
|
+
...base,
|
|
8541
|
+
minWidth: "max-content"
|
|
8542
|
+
};
|
|
8543
|
+
}
|
|
8544
|
+
},
|
|
8545
|
+
value: selectedFieldValue,
|
|
8546
|
+
...readOnlyProps,
|
|
8547
|
+
id: "filter-field",
|
|
8548
|
+
name: `filter-field-${index}`
|
|
8549
|
+
}
|
|
8550
|
+
),
|
|
8551
|
+
/* @__PURE__ */ jsx74(
|
|
8552
|
+
InputComboBox2,
|
|
8553
|
+
{
|
|
8554
|
+
"aria-label": operatorLabel,
|
|
8555
|
+
options: operatorOptions,
|
|
8556
|
+
onChange: (e) => {
|
|
8557
|
+
var _a2;
|
|
8558
|
+
return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8559
|
+
},
|
|
8560
|
+
isDisabled: !filters[index].field,
|
|
8561
|
+
value: selectedOperatorValue,
|
|
8562
|
+
styles: {
|
|
8563
|
+
menu(base) {
|
|
8564
|
+
return {
|
|
8565
|
+
...base,
|
|
8566
|
+
minWidth: "max-content"
|
|
8567
|
+
};
|
|
8568
|
+
}
|
|
8569
|
+
},
|
|
8570
|
+
...readOnlyProps,
|
|
8571
|
+
id: "filter-operator",
|
|
8572
|
+
name: `filter-operator-${index}`
|
|
8573
|
+
}
|
|
8574
|
+
),
|
|
8575
|
+
/* @__PURE__ */ jsx74(
|
|
8576
|
+
FilterEditorRenderer,
|
|
8577
|
+
{
|
|
8578
|
+
"aria-label": metaDataLabel,
|
|
8579
|
+
editorType: metaDataPossibleOptions,
|
|
8580
|
+
options: valueOptions,
|
|
8581
|
+
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
8582
|
+
readOnly,
|
|
8583
|
+
bindable,
|
|
8584
|
+
disabled: !filters[index].operator,
|
|
8585
|
+
value: selectedMetaValue,
|
|
8586
|
+
valueTestId: "filter-value"
|
|
8587
|
+
}
|
|
8588
|
+
),
|
|
8589
|
+
readOnly || index === 0 ? null : /* @__PURE__ */ jsx74(
|
|
8590
|
+
"button",
|
|
8591
|
+
{
|
|
8592
|
+
type: "button",
|
|
8593
|
+
onClick: () => handleDeleteFilter(index),
|
|
8594
|
+
"aria-label": "delete filter",
|
|
8595
|
+
css: IconBtn,
|
|
8596
|
+
"data-testid": "delete-filter",
|
|
8597
|
+
children: /* @__PURE__ */ jsx74(Icon7, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
8598
|
+
}
|
|
8599
|
+
)
|
|
8600
|
+
] })
|
|
8601
|
+
] });
|
|
8602
|
+
};
|
|
8603
|
+
var FilterItems = ({
|
|
8604
|
+
addButtonText = "add condition",
|
|
8605
|
+
additionalFiltersContainer
|
|
8606
|
+
}) => {
|
|
8607
|
+
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
8608
|
+
const handleUpdateFilter = (index, prop, value) => {
|
|
8609
|
+
var _a, _b, _c, _d, _e;
|
|
8610
|
+
const next = [...filters];
|
|
8611
|
+
next[index] = { ...next[index], [prop]: value };
|
|
8612
|
+
if (prop === "operator") {
|
|
8613
|
+
if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
|
|
8614
|
+
next[index].value = next[index].value[0];
|
|
8615
|
+
}
|
|
8616
|
+
if (filters[index].operator === "ndef" || filters[index].operator === "def") {
|
|
8617
|
+
next[index].value = "";
|
|
8618
|
+
}
|
|
8619
|
+
if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
8620
|
+
next[index].value = [next[index].value, ""];
|
|
8621
|
+
}
|
|
8622
|
+
if (value === "def" || value === "true") {
|
|
8623
|
+
next[index].value = "true";
|
|
8624
|
+
}
|
|
8625
|
+
if (value === "ndef" || value === "false") {
|
|
8626
|
+
next[index].value = "false";
|
|
8627
|
+
}
|
|
8628
|
+
}
|
|
8629
|
+
if (prop === "field") {
|
|
8630
|
+
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
8631
|
+
var _a2;
|
|
8632
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
|
|
8633
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
|
|
8634
|
+
next[index].operator = firstOperatorInAvailableOperators;
|
|
8635
|
+
next[index].value = "";
|
|
8636
|
+
}
|
|
8637
|
+
setFilters(next);
|
|
8638
|
+
};
|
|
8639
|
+
return /* @__PURE__ */ jsx74(
|
|
8640
|
+
FilterMenu,
|
|
8641
|
+
{
|
|
8642
|
+
id: "search-and-filter-options",
|
|
8643
|
+
dataTestId: "search-and-filter-options",
|
|
8644
|
+
menuControls: /* @__PURE__ */ jsxs46(
|
|
8645
|
+
"button",
|
|
8646
|
+
{
|
|
8647
|
+
type: "button",
|
|
8648
|
+
css: AddConditionalBtn,
|
|
8649
|
+
onClick: handleAddFilter,
|
|
8650
|
+
"data-testid": "add-filter",
|
|
8651
|
+
children: [
|
|
8652
|
+
/* @__PURE__ */ jsx74(Icon7, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
8653
|
+
addButtonText
|
|
8654
|
+
]
|
|
8655
|
+
}
|
|
8656
|
+
),
|
|
8657
|
+
additionalFiltersContainer,
|
|
8658
|
+
children: filters.map((item, i) => {
|
|
8659
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8660
|
+
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
8661
|
+
var _a2;
|
|
8662
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
|
|
8663
|
+
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
8664
|
+
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
8665
|
+
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
8666
|
+
return /* @__PURE__ */ jsx74(
|
|
8667
|
+
FilterItem,
|
|
8668
|
+
{
|
|
8669
|
+
index: i,
|
|
8670
|
+
paramOptions: filterOptions,
|
|
8671
|
+
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
8672
|
+
operatorOptions: possibleOperators,
|
|
8673
|
+
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
8674
|
+
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
8675
|
+
valueOptions: possibleValueOptions
|
|
8676
|
+
},
|
|
8677
|
+
i
|
|
8678
|
+
);
|
|
8679
|
+
})
|
|
8680
|
+
}
|
|
8681
|
+
);
|
|
8682
|
+
};
|
|
8683
|
+
|
|
8684
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
8685
|
+
import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
|
|
8686
|
+
|
|
8687
|
+
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
8688
|
+
import { Button as Button6, Callout as Callout6, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
|
|
8689
|
+
import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
|
|
8690
|
+
var SearchAndFilterResultContainer = ({
|
|
8691
|
+
buttonText,
|
|
8692
|
+
clearButtonLabel = "clear",
|
|
8693
|
+
calloutTitle,
|
|
8694
|
+
calloutText,
|
|
8695
|
+
onHandleClear,
|
|
8696
|
+
hideClearButton
|
|
8697
|
+
}) => {
|
|
8698
|
+
const { searchTerm, setSearchTerm, totalResults, setFilters, filters } = useSearchAndFilter();
|
|
8699
|
+
const automateCalloutTitle = () => {
|
|
8700
|
+
if (searchTerm && !filters.length) {
|
|
8701
|
+
return "No search results found";
|
|
8702
|
+
}
|
|
8703
|
+
if (filters.length && !searchTerm) {
|
|
8704
|
+
return "No results match the selected filters";
|
|
8705
|
+
}
|
|
8706
|
+
return "No matching results found";
|
|
8707
|
+
};
|
|
8708
|
+
const handleResetFilters = () => {
|
|
8709
|
+
if (searchTerm && !filters.length) {
|
|
8710
|
+
setSearchTerm("");
|
|
8711
|
+
return;
|
|
8712
|
+
} else if (!searchTerm && filters.length) {
|
|
8713
|
+
setFilters([{ field: "", operator: "", value: "" }]);
|
|
8714
|
+
return;
|
|
8715
|
+
} else {
|
|
8716
|
+
setSearchTerm("");
|
|
8717
|
+
setFilters([{ field: "", operator: "", value: "" }]);
|
|
8718
|
+
return;
|
|
8719
|
+
}
|
|
8720
|
+
};
|
|
8721
|
+
if (totalResults && totalResults > 0) {
|
|
8722
|
+
return null;
|
|
8723
|
+
}
|
|
8724
|
+
return /* @__PURE__ */ jsxs47(Fragment16, { children: [
|
|
8725
|
+
/* @__PURE__ */ jsxs47(HorizontalRhythm9, { children: [
|
|
8726
|
+
/* @__PURE__ */ jsxs47("span", { children: [
|
|
8727
|
+
totalResults,
|
|
8728
|
+
" results ",
|
|
8729
|
+
searchTerm ? `for "${searchTerm}"` : null
|
|
8730
|
+
] }),
|
|
8731
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx75(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
|
|
8732
|
+
] }),
|
|
8733
|
+
totalResults === 0 ? /* @__PURE__ */ jsxs47(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
8734
|
+
calloutText ? /* @__PURE__ */ jsx75(Paragraph, { children: calloutText }) : null,
|
|
8735
|
+
hideClearButton ? null : /* @__PURE__ */ jsx75(Button6, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
|
|
8736
|
+
] }) : null
|
|
8737
|
+
] });
|
|
8738
|
+
};
|
|
8739
|
+
|
|
8740
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
8741
|
+
import { jsx as jsx76, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
|
|
8742
|
+
var SearchAndFilter = ({
|
|
8743
|
+
filters,
|
|
8744
|
+
filterOptions,
|
|
8745
|
+
filterVisible,
|
|
8746
|
+
filterControls,
|
|
8747
|
+
viewSwitchControls,
|
|
8748
|
+
resultsContainerView = /* @__PURE__ */ jsx76(SearchAndFilterResultContainer, {}),
|
|
8749
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
8750
|
+
additionalFiltersContainer,
|
|
8751
|
+
onChange,
|
|
8752
|
+
defaultSearchTerm,
|
|
8753
|
+
onSearchChange,
|
|
8754
|
+
totalResults,
|
|
8755
|
+
resetFilterValues = []
|
|
8756
|
+
}) => {
|
|
8757
|
+
return /* @__PURE__ */ jsx76(
|
|
8758
|
+
SearchAndFilterProvider,
|
|
8759
|
+
{
|
|
8760
|
+
filters,
|
|
8761
|
+
filterOptions,
|
|
8762
|
+
filterVisible,
|
|
8763
|
+
onChange,
|
|
8764
|
+
defaultSearchTerm,
|
|
8765
|
+
onSearchChange,
|
|
8766
|
+
totalResults,
|
|
8767
|
+
resetFilterValues,
|
|
8768
|
+
filterMapper: filterMapper2,
|
|
8769
|
+
children: /* @__PURE__ */ jsxs48(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
|
|
8770
|
+
/* @__PURE__ */ jsxs48("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
8771
|
+
/* @__PURE__ */ jsx76(
|
|
8772
|
+
"div",
|
|
8773
|
+
{
|
|
8774
|
+
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
8775
|
+
children: !filterControls ? /* @__PURE__ */ jsx76(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
8776
|
+
}
|
|
8777
|
+
),
|
|
8778
|
+
viewSwitchControls
|
|
8779
|
+
] }),
|
|
8780
|
+
/* @__PURE__ */ jsx76(FilterItems, { additionalFiltersContainer }),
|
|
8781
|
+
resultsContainerView
|
|
8782
|
+
] })
|
|
8783
|
+
}
|
|
8784
|
+
);
|
|
8785
|
+
};
|
|
8786
|
+
|
|
8787
|
+
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
8788
|
+
import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
|
|
8789
|
+
import { createContext as createContext7, useState as useState22 } from "react";
|
|
8790
|
+
import { useDebounce as useDebounce6 } from "react-use";
|
|
8791
|
+
import { jsx as jsx77 } from "@emotion/react/jsx-runtime";
|
|
8792
|
+
var SearchOnlyContext = createContext7({
|
|
8793
|
+
searchTerm: "",
|
|
8794
|
+
setSearchTerm: () => {
|
|
8795
|
+
}
|
|
8796
|
+
});
|
|
8797
|
+
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
8798
|
+
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
8799
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState22("");
|
|
8800
|
+
useDebounce6(
|
|
8801
|
+
() => {
|
|
8802
|
+
setSearchTerm(localeSearchTerm);
|
|
8803
|
+
onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
|
|
8804
|
+
},
|
|
8805
|
+
300,
|
|
8806
|
+
[localeSearchTerm]
|
|
8807
|
+
);
|
|
8808
|
+
return /* @__PURE__ */ jsx77(
|
|
8809
|
+
SearchOnlyContext.Provider,
|
|
8810
|
+
{
|
|
8811
|
+
value: {
|
|
8812
|
+
searchTerm,
|
|
8813
|
+
setSearchTerm: setLocaleSearchTerm
|
|
8814
|
+
},
|
|
8815
|
+
children: /* @__PURE__ */ jsx77("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx77(
|
|
8816
|
+
InputKeywordSearch3,
|
|
8817
|
+
{
|
|
8818
|
+
placeholder: "Search...",
|
|
8819
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
8820
|
+
value: localeSearchTerm,
|
|
8821
|
+
compact: true,
|
|
8822
|
+
rounded: true
|
|
8823
|
+
}
|
|
8824
|
+
) })
|
|
8825
|
+
}
|
|
8826
|
+
);
|
|
8827
|
+
};
|
|
8828
|
+
|
|
8829
|
+
// src/components/SearchAndFilter2/filtersMapper.tsx
|
|
8830
|
+
import { jsx as jsx78 } from "@emotion/react/jsx-runtime";
|
|
8831
|
+
function withInputVariables(WrappedComponent) {
|
|
8832
|
+
const WithInputVariables = (props) => {
|
|
8833
|
+
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8834
|
+
return /* @__PURE__ */ jsx78(WrappedComponent, { ...props });
|
|
8835
|
+
}
|
|
8836
|
+
return /* @__PURE__ */ jsx78(
|
|
8837
|
+
InputVariables,
|
|
8838
|
+
{
|
|
8839
|
+
disableInlineMenu: true,
|
|
8840
|
+
showMenuPosition: "inline-right",
|
|
8841
|
+
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8842
|
+
value: props.value,
|
|
8843
|
+
disabled: props.disabled,
|
|
8844
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx78(WrappedComponent, { ...props })
|
|
8845
|
+
}
|
|
8846
|
+
);
|
|
8847
|
+
};
|
|
8848
|
+
return WithInputVariables;
|
|
8849
|
+
}
|
|
8850
|
+
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
8851
|
+
const WithInputVariables = (props) => {
|
|
8852
|
+
var _a;
|
|
8853
|
+
if (!props.bindable || props.disabled || props.readOnly) {
|
|
8854
|
+
return /* @__PURE__ */ jsx78(WrappedComponent, { ...props });
|
|
8855
|
+
}
|
|
8856
|
+
return /* @__PURE__ */ jsx78(
|
|
8857
|
+
InputVariables,
|
|
8858
|
+
{
|
|
8859
|
+
disableInlineMenu: true,
|
|
8860
|
+
showMenuPosition: "inline-right",
|
|
8861
|
+
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
8862
|
+
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
8863
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx78(WrappedComponent, { ...props })
|
|
8864
|
+
}
|
|
8865
|
+
);
|
|
8866
|
+
};
|
|
8867
|
+
return WithInputVariables;
|
|
8868
|
+
}
|
|
8869
|
+
var bindableFiltersMapper = {
|
|
8870
|
+
...filterMapper,
|
|
8871
|
+
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8872
|
+
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8873
|
+
date: withInputVariables(DateEditor),
|
|
8874
|
+
text: withInputVariables(TextEditor),
|
|
8875
|
+
number: withInputVariables(NumberEditor)
|
|
8876
|
+
};
|
|
8877
|
+
|
|
8878
|
+
// src/utils/createLocationValidator.ts
|
|
8879
|
+
function createLocationValidator(setValue, validate) {
|
|
8880
|
+
return (dispatch) => setValue((previous) => {
|
|
8881
|
+
const { newValue, options } = dispatch(previous);
|
|
8882
|
+
return { newValue, options: validate(newValue, options) };
|
|
8883
|
+
});
|
|
8884
|
+
}
|
|
8885
|
+
|
|
8886
|
+
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
8887
|
+
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
8888
|
+
import { useEffect as useEffect23, useRef as useRef16 } from "react";
|
|
8889
|
+
function useContentDataResourceLocaleInfo({
|
|
8890
|
+
locale,
|
|
8891
|
+
setLocale,
|
|
8892
|
+
dynamicInputs
|
|
8893
|
+
}) {
|
|
8894
|
+
var _a;
|
|
8895
|
+
const setLocaleRef = useRef16(setLocale);
|
|
8896
|
+
setLocaleRef.current = setLocale;
|
|
8897
|
+
const { flatVariables } = useVariables();
|
|
8898
|
+
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
|
|
8899
|
+
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
8900
|
+
useEffect23(() => {
|
|
8901
|
+
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
8902
|
+
setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
|
|
8903
|
+
}
|
|
8904
|
+
}, [locale, effectiveLocale]);
|
|
8905
|
+
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
7323
8906
|
}
|
|
7324
8907
|
|
|
7325
8908
|
// src/index.ts
|
|
7326
8909
|
import {
|
|
7327
8910
|
AddListButton as AddListButton2,
|
|
7328
|
-
Button as
|
|
7329
|
-
Callout as
|
|
8911
|
+
Button as Button7,
|
|
8912
|
+
Callout as Callout7,
|
|
7330
8913
|
DrawerContent,
|
|
7331
8914
|
Heading,
|
|
7332
|
-
Input as
|
|
7333
|
-
InputComboBox,
|
|
7334
|
-
InputKeywordSearch as
|
|
8915
|
+
Input as Input7,
|
|
8916
|
+
InputComboBox as InputComboBox3,
|
|
8917
|
+
InputKeywordSearch as InputKeywordSearch4,
|
|
7335
8918
|
InputSelect as InputSelect8,
|
|
7336
8919
|
InputToggle,
|
|
7337
8920
|
Label,
|
|
@@ -7364,9 +8947,11 @@ export {
|
|
|
7364
8947
|
$createVariableNode,
|
|
7365
8948
|
$isVariableNode,
|
|
7366
8949
|
AddListButton2 as AddListButton,
|
|
7367
|
-
|
|
7368
|
-
|
|
8950
|
+
Button7 as Button,
|
|
8951
|
+
CHECKBOX_OPERATORS,
|
|
8952
|
+
Callout7 as Callout,
|
|
7369
8953
|
ControlledValuePlugin,
|
|
8954
|
+
DATE_OPERATORS,
|
|
7370
8955
|
DISCONNECT_VARIABLE_COMMAND,
|
|
7371
8956
|
DamSelectedItem,
|
|
7372
8957
|
DataRefreshButton,
|
|
@@ -7375,17 +8960,27 @@ export {
|
|
|
7375
8960
|
DataResourceVariablesListExplicit,
|
|
7376
8961
|
DataSourceEditor,
|
|
7377
8962
|
DataTypeEditor,
|
|
8963
|
+
DateEditor,
|
|
8964
|
+
DateRangeEditor,
|
|
7378
8965
|
DefaultSearchRow,
|
|
7379
8966
|
DefaultSelectedItem,
|
|
7380
8967
|
DrawerContent,
|
|
7381
8968
|
EDIT_VARIABLE_COMMAND,
|
|
7382
8969
|
EntrySearch,
|
|
8970
|
+
FilterButton2 as FilterButton,
|
|
8971
|
+
FilterControls,
|
|
8972
|
+
FilterEditorRenderer,
|
|
8973
|
+
FilterItem,
|
|
8974
|
+
FilterItems,
|
|
8975
|
+
FilterMenu,
|
|
8976
|
+
FilterMultiChoiceEditor,
|
|
8977
|
+
FilterSingleChoiceEditor,
|
|
7383
8978
|
Heading,
|
|
7384
8979
|
INSERT_VARIABLE_COMMAND,
|
|
7385
8980
|
icons_exports as Icons,
|
|
7386
|
-
|
|
7387
|
-
InputComboBox,
|
|
7388
|
-
|
|
8981
|
+
Input7 as Input,
|
|
8982
|
+
InputComboBox3 as InputComboBox,
|
|
8983
|
+
InputKeywordSearch4 as InputKeywordSearch,
|
|
7389
8984
|
InputSelect8 as InputSelect,
|
|
7390
8985
|
InputToggle,
|
|
7391
8986
|
InputVariables,
|
|
@@ -7396,6 +8991,9 @@ export {
|
|
|
7396
8991
|
Menu4 as Menu,
|
|
7397
8992
|
MenuItem3 as MenuItem,
|
|
7398
8993
|
MeshApp,
|
|
8994
|
+
NUMBER_OPERATORS,
|
|
8995
|
+
NumberEditor,
|
|
8996
|
+
NumberRangeEditor,
|
|
7399
8997
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
7400
8998
|
ObjectSearchContainer,
|
|
7401
8999
|
ObjectSearchFilter,
|
|
@@ -7406,6 +9004,7 @@ export {
|
|
|
7406
9004
|
ObjectSearchResultItem,
|
|
7407
9005
|
ObjectSearchResultItemButton,
|
|
7408
9006
|
ObjectSearchResultList,
|
|
9007
|
+
PUBLISH_STATUS_FIELD_OPERATORS,
|
|
7409
9008
|
ParamTypeDynamicDataProvider,
|
|
7410
9009
|
ParameterConnectionIndicator,
|
|
7411
9010
|
ParameterGroup,
|
|
@@ -7433,6 +9032,7 @@ export {
|
|
|
7433
9032
|
ProductSearchRow,
|
|
7434
9033
|
ProductSelectedItem,
|
|
7435
9034
|
QueryFilter,
|
|
9035
|
+
RICHTEXT_OPERATORS,
|
|
7436
9036
|
RequestBody,
|
|
7437
9037
|
RequestHeaders,
|
|
7438
9038
|
RequestMethodSelect,
|
|
@@ -7442,13 +9042,27 @@ export {
|
|
|
7442
9042
|
RequestUrl,
|
|
7443
9043
|
RequestUrlInput,
|
|
7444
9044
|
ResolvableLoadingValue,
|
|
9045
|
+
SYSTEM_DATE_OPERATORS,
|
|
9046
|
+
SYSTEM_FIELD_OPERATORS,
|
|
7445
9047
|
ScrollableList2 as ScrollableList,
|
|
7446
9048
|
ScrollableListItem,
|
|
9049
|
+
SearchAndFilter,
|
|
9050
|
+
SearchAndFilterContext,
|
|
9051
|
+
SearchAndFilterOptionsContainer2 as SearchAndFilterOptionsContainer,
|
|
9052
|
+
SearchAndFilterProvider,
|
|
9053
|
+
SearchAndFilterResultContainer,
|
|
9054
|
+
SearchOnlyContext,
|
|
9055
|
+
SearchOnlyFilter,
|
|
7447
9056
|
SelectionField,
|
|
9057
|
+
StatusMultiEditor,
|
|
9058
|
+
StatusSingleEditor,
|
|
7448
9059
|
Switch,
|
|
9060
|
+
TEXTBOX_OPERATORS,
|
|
9061
|
+
TextEditor,
|
|
7449
9062
|
TextVariableRenderer,
|
|
7450
9063
|
Textarea,
|
|
7451
9064
|
Theme3 as Theme,
|
|
9065
|
+
USER_OPERATORS,
|
|
7452
9066
|
VariableEditor,
|
|
7453
9067
|
VariableNode,
|
|
7454
9068
|
VariablesList,
|
|
@@ -7486,6 +9100,7 @@ export {
|
|
|
7486
9100
|
entrySearchSelectInput,
|
|
7487
9101
|
entrySearchSelectOption,
|
|
7488
9102
|
entrySearchWrapper,
|
|
9103
|
+
filterMapper,
|
|
7489
9104
|
hasReferencedVariables,
|
|
7490
9105
|
prettifyBindExpression,
|
|
7491
9106
|
productSearchRowActiveIcon,
|
|
@@ -7536,6 +9151,7 @@ export {
|
|
|
7536
9151
|
useRequest,
|
|
7537
9152
|
useRequestHeader,
|
|
7538
9153
|
useRequestParameter,
|
|
9154
|
+
useSearchAndFilter,
|
|
7539
9155
|
useUniformMeshSdk,
|
|
7540
9156
|
useVariableEditor,
|
|
7541
9157
|
useVariables,
|