@uniformdev/mesh-sdk-react 19.135.1-alpha.10 → 19.135.1-alpha.11
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 +472 -406
- package/dist/index.d.ts +472 -406
- package/dist/index.esm.js +1388 -963
- package/dist/index.js +1535 -1129
- package/dist/index.mjs +1388 -963
- package/package.json +18 -17
package/dist/index.esm.js
CHANGED
|
@@ -966,7 +966,8 @@ var searchRowContainer = css6`
|
|
|
966
966
|
cursor: pointer;
|
|
967
967
|
padding: var(--spacing-sm);
|
|
968
968
|
position: relative;
|
|
969
|
-
transition:
|
|
969
|
+
transition:
|
|
970
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
970
971
|
color var(--duration-fast) var(--timing-ease-out);
|
|
971
972
|
`;
|
|
972
973
|
var searchRowContainerWithPopover = css6`
|
|
@@ -1651,8 +1652,7 @@ var EntrySearch = ({
|
|
|
1651
1652
|
const handleCancelClick = (e) => {
|
|
1652
1653
|
e.preventDefault();
|
|
1653
1654
|
setListOpen(false);
|
|
1654
|
-
if (onCancel)
|
|
1655
|
-
onCancel();
|
|
1655
|
+
if (onCancel) onCancel();
|
|
1656
1656
|
};
|
|
1657
1657
|
const handleLoadMoreClick = () => {
|
|
1658
1658
|
search(textInput, {
|
|
@@ -1957,7 +1957,8 @@ var productSearchRowContainer = css12`
|
|
|
1957
1957
|
padding: var(--spacing-sm) 0;
|
|
1958
1958
|
margin-right: var(--spacing-sm);
|
|
1959
1959
|
position: relative;
|
|
1960
|
-
transition:
|
|
1960
|
+
transition:
|
|
1961
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
1961
1962
|
color var(--duration-fast) var(--timing-ease-out);
|
|
1962
1963
|
`;
|
|
1963
1964
|
var productSearchRowContent = css12`
|
|
@@ -2796,18 +2797,58 @@ import { ParameterShellContext, useParameterShell } from "@uniformdev/design-sys
|
|
|
2796
2797
|
|
|
2797
2798
|
// src/components/Variables/composer/ControlledValuePlugin.tsx
|
|
2798
2799
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
2799
|
-
import {
|
|
2800
|
-
|
|
2800
|
+
import { useEffect as useEffect5 } from "react";
|
|
2801
|
+
|
|
2802
|
+
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
2803
|
+
import { createVariableReference } from "@uniformdev/canvas";
|
|
2804
|
+
import {
|
|
2805
|
+
LineBreakNode,
|
|
2806
|
+
TextNode
|
|
2807
|
+
} from "lexical";
|
|
2808
|
+
|
|
2809
|
+
// src/components/Variables/util/variableExpression.ts
|
|
2810
|
+
var variablePrefix = "${";
|
|
2811
|
+
var variableSuffix = "}";
|
|
2812
|
+
|
|
2813
|
+
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
2814
|
+
function serializeVariablesEditorState(editorState) {
|
|
2815
|
+
return serializeVariablesEditorSerializedState(editorState.toJSON().root);
|
|
2816
|
+
}
|
|
2817
|
+
function serializeVariablesEditorSerializedState(serializedEditorState) {
|
|
2818
|
+
const buf = [];
|
|
2819
|
+
serializeRecursive(serializedEditorState, buf);
|
|
2820
|
+
const result = buf.join("");
|
|
2821
|
+
return result.length > 0 ? result : void 0;
|
|
2822
|
+
}
|
|
2823
|
+
function serializeRecursive(node, buffer) {
|
|
2824
|
+
if (node.type === TextNode.getType()) {
|
|
2825
|
+
buffer.push(node.text.replace(variablePrefix, "\\${"));
|
|
2826
|
+
}
|
|
2827
|
+
if (node.type === VariableNode.getType()) {
|
|
2828
|
+
buffer.push(createVariableReference(node.reference));
|
|
2829
|
+
}
|
|
2830
|
+
if (node.type === LineBreakNode.getType()) {
|
|
2831
|
+
buffer.push("\n");
|
|
2832
|
+
}
|
|
2833
|
+
if ("children" in node && node.children) {
|
|
2834
|
+
for (const child of node.children) {
|
|
2835
|
+
serializeRecursive(child, buffer);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
// src/components/Variables/util/setVariablesEditorValue.ts
|
|
2841
|
+
import { emptyRichTextValue } from "@uniformdev/richtext";
|
|
2801
2842
|
|
|
2802
2843
|
// src/components/Variables/util/deserializeVariablesEditorState.ts
|
|
2803
2844
|
import { parseVariableExpression } from "@uniformdev/canvas";
|
|
2804
|
-
import { TextNode } from "lexical";
|
|
2845
|
+
import { TextNode as TextNode2 } from "lexical";
|
|
2805
2846
|
function deserializeVariablesEditorState(serialized) {
|
|
2806
2847
|
const result = [];
|
|
2807
2848
|
parseVariableExpression(serialized != null ? serialized : "", (token, type) => {
|
|
2808
2849
|
if (type === "text") {
|
|
2809
2850
|
const node = {
|
|
2810
|
-
type:
|
|
2851
|
+
type: TextNode2.getType(),
|
|
2811
2852
|
text: token,
|
|
2812
2853
|
mode: "normal",
|
|
2813
2854
|
version: 1,
|
|
@@ -2861,14 +2902,18 @@ function refreshVariableNodeMetadata(editor) {
|
|
|
2861
2902
|
}
|
|
2862
2903
|
|
|
2863
2904
|
// src/components/Variables/util/setVariablesEditorValue.ts
|
|
2864
|
-
function setVariablesEditorValue(editor, newValue) {
|
|
2905
|
+
function setVariablesEditorValue(editor, newValue, tag) {
|
|
2865
2906
|
if (typeof newValue === "undefined" || typeof newValue === "string") {
|
|
2866
2907
|
const parsedState = editor.parseEditorState(deserializeVariablesEditorState(newValue));
|
|
2867
|
-
editor.setEditorState(parsedState)
|
|
2908
|
+
editor.setEditorState(parsedState.clone(null), {
|
|
2909
|
+
tag
|
|
2910
|
+
});
|
|
2868
2911
|
} else {
|
|
2869
2912
|
try {
|
|
2870
2913
|
const parsedState = editor.parseEditorState(newValue);
|
|
2871
|
-
editor.setEditorState(parsedState)
|
|
2914
|
+
editor.setEditorState(parsedState.clone(null), {
|
|
2915
|
+
tag
|
|
2916
|
+
});
|
|
2872
2917
|
} catch (e) {
|
|
2873
2918
|
console.warn(
|
|
2874
2919
|
"Tried to set invalid Lexical state, probably invalidly formatted state object - falling back to empty state. Invalid state attempted:",
|
|
@@ -2876,26 +2921,10 @@ function setVariablesEditorValue(editor, newValue) {
|
|
|
2876
2921
|
"Error:",
|
|
2877
2922
|
e
|
|
2878
2923
|
);
|
|
2879
|
-
const parsedState = editor.parseEditorState(
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
version: 1,
|
|
2883
|
-
direction: null,
|
|
2884
|
-
format: "",
|
|
2885
|
-
indent: 0,
|
|
2886
|
-
children: [
|
|
2887
|
-
{
|
|
2888
|
-
type: "paragraph",
|
|
2889
|
-
version: 1,
|
|
2890
|
-
format: "start",
|
|
2891
|
-
indent: 0,
|
|
2892
|
-
direction: null,
|
|
2893
|
-
children: []
|
|
2894
|
-
}
|
|
2895
|
-
]
|
|
2896
|
-
}
|
|
2924
|
+
const parsedState = editor.parseEditorState(emptyRichTextValue);
|
|
2925
|
+
editor.setEditorState(parsedState.clone(null), {
|
|
2926
|
+
tag
|
|
2897
2927
|
});
|
|
2898
|
-
editor.setEditorState(parsedState);
|
|
2899
2928
|
}
|
|
2900
2929
|
}
|
|
2901
2930
|
refreshVariableNodeMetadata(editor);
|
|
@@ -2908,17 +2937,18 @@ function ControlledValuePlugin({
|
|
|
2908
2937
|
extraDependencies
|
|
2909
2938
|
}) {
|
|
2910
2939
|
const [editor] = useLexicalComposerContext();
|
|
2911
|
-
const lastValueRef = useRef8(value);
|
|
2912
2940
|
useEffect5(() => {
|
|
2941
|
+
var _a, _b;
|
|
2913
2942
|
if (!enabled) {
|
|
2914
2943
|
return;
|
|
2915
2944
|
}
|
|
2916
|
-
|
|
2945
|
+
const currentValue = (_a = serializeVariablesEditorState(editor.getEditorState())) != null ? _a : "";
|
|
2946
|
+
const newValue = (_b = value !== void 0 && typeof value !== "string" ? serializeVariablesEditorSerializedState(value.root) : value) != null ? _b : "";
|
|
2947
|
+
if (currentValue === newValue) {
|
|
2917
2948
|
return;
|
|
2918
2949
|
}
|
|
2919
2950
|
setTimeout(() => {
|
|
2920
2951
|
if (editor) {
|
|
2921
|
-
lastValueRef.current = value;
|
|
2922
2952
|
setVariablesEditorValue(editor, value);
|
|
2923
2953
|
}
|
|
2924
2954
|
});
|
|
@@ -2926,36 +2956,6 @@ function ControlledValuePlugin({
|
|
|
2926
2956
|
return null;
|
|
2927
2957
|
}
|
|
2928
2958
|
|
|
2929
|
-
// src/components/Variables/composer/VariableNode.tsx
|
|
2930
|
-
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
2931
|
-
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
2932
|
-
import { $moveCharacter, $shouldOverrideDefaultCharacterSelection } from "@lexical/selection";
|
|
2933
|
-
import { mergeRegister as mergeRegister2 } from "@lexical/utils";
|
|
2934
|
-
import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
|
|
2935
|
-
import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
|
|
2936
|
-
import {
|
|
2937
|
-
$getNearestNodeFromDOMNode,
|
|
2938
|
-
$getNodeByKey as $getNodeByKey2,
|
|
2939
|
-
$getSelection as $getSelection2,
|
|
2940
|
-
$isDecoratorNode,
|
|
2941
|
-
$isNodeSelection as $isNodeSelection2,
|
|
2942
|
-
$isRangeSelection,
|
|
2943
|
-
COMMAND_PRIORITY_EDITOR,
|
|
2944
|
-
COMMAND_PRIORITY_LOW,
|
|
2945
|
-
DecoratorNode,
|
|
2946
|
-
KEY_ARROW_LEFT_COMMAND,
|
|
2947
|
-
KEY_ARROW_RIGHT_COMMAND,
|
|
2948
|
-
KEY_BACKSPACE_COMMAND,
|
|
2949
|
-
KEY_DELETE_COMMAND
|
|
2950
|
-
} from "lexical";
|
|
2951
|
-
import { useCallback as useCallback3, useEffect as useEffect9 } from "react";
|
|
2952
|
-
|
|
2953
|
-
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
2954
|
-
function prettifyBindExpression(bindExpression) {
|
|
2955
|
-
const [, expression] = bindExpression.split(":");
|
|
2956
|
-
return expression;
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
2959
|
// src/components/Variables/composer/VariableChip.tsx
|
|
2960
2960
|
import { MultilineChip, Tooltip, VerticalRhythm } from "@uniformdev/design-system";
|
|
2961
2961
|
import { Fragment as Fragment5 } from "react";
|
|
@@ -2969,12 +2969,13 @@ function VariableChip({
|
|
|
2969
2969
|
clickToEdit,
|
|
2970
2970
|
isFresh,
|
|
2971
2971
|
selected,
|
|
2972
|
-
disabled
|
|
2972
|
+
disabled,
|
|
2973
|
+
errorMessage = `${reference} is not defined.`
|
|
2973
2974
|
}) {
|
|
2974
2975
|
const hasClickEvent = !!onClick;
|
|
2975
2976
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
2976
2977
|
const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
|
|
2977
|
-
const extraTitle = !referenceIsValidFr ?
|
|
2978
|
+
const extraTitle = !referenceIsValidFr ? errorMessage : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
2978
2979
|
const chippy = /* @__PURE__ */ jsx30(MultilineChip, { onClick, "aria-selected": selected ? true : void 0, "aria-disabled": disabled, children: /* @__PURE__ */ jsx30(Wrapper, { children: displayName || reference }) });
|
|
2979
2980
|
if (tooltip) {
|
|
2980
2981
|
const tip = tooltip ? `${tooltip}${extraTitle ? `
|
|
@@ -3031,6 +3032,36 @@ function WarningVariableReference({ children }) {
|
|
|
3031
3032
|
);
|
|
3032
3033
|
}
|
|
3033
3034
|
|
|
3035
|
+
// src/components/Variables/composer/VariableNode.tsx
|
|
3036
|
+
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
3037
|
+
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
3038
|
+
import { $moveCharacter, $shouldOverrideDefaultCharacterSelection } from "@lexical/selection";
|
|
3039
|
+
import { mergeRegister as mergeRegister2 } from "@lexical/utils";
|
|
3040
|
+
import { createVariableReference as createVariableReference3 } from "@uniformdev/canvas";
|
|
3041
|
+
import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
|
|
3042
|
+
import {
|
|
3043
|
+
$getNearestNodeFromDOMNode,
|
|
3044
|
+
$getNodeByKey as $getNodeByKey2,
|
|
3045
|
+
$getSelection as $getSelection2,
|
|
3046
|
+
$isDecoratorNode,
|
|
3047
|
+
$isNodeSelection as $isNodeSelection2,
|
|
3048
|
+
$isRangeSelection,
|
|
3049
|
+
COMMAND_PRIORITY_EDITOR,
|
|
3050
|
+
COMMAND_PRIORITY_LOW,
|
|
3051
|
+
DecoratorNode,
|
|
3052
|
+
KEY_ARROW_LEFT_COMMAND,
|
|
3053
|
+
KEY_ARROW_RIGHT_COMMAND,
|
|
3054
|
+
KEY_BACKSPACE_COMMAND,
|
|
3055
|
+
KEY_DELETE_COMMAND
|
|
3056
|
+
} from "lexical";
|
|
3057
|
+
import { useCallback as useCallback3, useEffect as useEffect9 } from "react";
|
|
3058
|
+
|
|
3059
|
+
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
3060
|
+
function prettifyBindExpression(bindExpression) {
|
|
3061
|
+
const [, expression] = bindExpression.split(":");
|
|
3062
|
+
return expression;
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3034
3065
|
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3035
3066
|
import { css as css20 } from "@emotion/react";
|
|
3036
3067
|
import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -3040,12 +3071,14 @@ import {
|
|
|
3040
3071
|
} from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
3041
3072
|
import { mergeRegister } from "@lexical/utils";
|
|
3042
3073
|
import { AiFillPlusCircle } from "@react-icons/all-files/ai/AiFillPlusCircle";
|
|
3043
|
-
import { createVariableReference } from "@uniformdev/canvas";
|
|
3074
|
+
import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
|
|
3044
3075
|
import { HorizontalRhythm as HorizontalRhythm2, MenuGroup, MenuItemInner, MenuItemSeparator } from "@uniformdev/design-system";
|
|
3045
|
-
import { dequal
|
|
3076
|
+
import { dequal } from "dequal/lite";
|
|
3046
3077
|
import {
|
|
3078
|
+
$createParagraphNode,
|
|
3047
3079
|
$createTextNode,
|
|
3048
3080
|
$getNodeByKey,
|
|
3081
|
+
$getRoot,
|
|
3049
3082
|
$getSelection,
|
|
3050
3083
|
$insertNodes,
|
|
3051
3084
|
$isNodeSelection,
|
|
@@ -3054,7 +3087,7 @@ import {
|
|
|
3054
3087
|
COMMAND_PRIORITY_NORMAL,
|
|
3055
3088
|
createCommand
|
|
3056
3089
|
} from "lexical";
|
|
3057
|
-
import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as
|
|
3090
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef9, useState as useState10 } from "react";
|
|
3058
3091
|
import { createPortal } from "react-dom";
|
|
3059
3092
|
|
|
3060
3093
|
// src/components/Variables/toolbox/SelectVariableMenu.styles.ts
|
|
@@ -3140,7 +3173,7 @@ function useVariableEditTransaction({
|
|
|
3140
3173
|
// src/components/Variables/VariableEditor.tsx
|
|
3141
3174
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
3142
3175
|
import { Button as Button2, Callout as Callout3, HorizontalRhythm, Input as Input2, useShortcut } from "@uniformdev/design-system";
|
|
3143
|
-
import { useLayoutEffect, useRef as
|
|
3176
|
+
import { useLayoutEffect, useRef as useRef8 } from "react";
|
|
3144
3177
|
import { useForm } from "react-hook-form";
|
|
3145
3178
|
import { z } from "zod";
|
|
3146
3179
|
|
|
@@ -3199,7 +3232,7 @@ function VariableEditor({
|
|
|
3199
3232
|
},
|
|
3200
3233
|
activeWhenEditing: true
|
|
3201
3234
|
});
|
|
3202
|
-
const nameRef =
|
|
3235
|
+
const nameRef = useRef8(null);
|
|
3203
3236
|
const { ref, ...nameRegister } = register("name");
|
|
3204
3237
|
useLayoutEffect(() => {
|
|
3205
3238
|
if (nameRef.current && !nameRef.current.value) {
|
|
@@ -3583,7 +3616,7 @@ function useVariablesMenu({
|
|
|
3583
3616
|
var _a;
|
|
3584
3617
|
const targetVariable = variables[value];
|
|
3585
3618
|
if (overwriteExistingValue) {
|
|
3586
|
-
setVariablesEditorValue(editor,
|
|
3619
|
+
setVariablesEditorValue(editor, createVariableReference2(value));
|
|
3587
3620
|
return true;
|
|
3588
3621
|
}
|
|
3589
3622
|
const variableNode = $createVariableNode(value, {
|
|
@@ -3616,7 +3649,7 @@ function VariablesPlugin({
|
|
|
3616
3649
|
}) {
|
|
3617
3650
|
const [editor] = useLexicalComposerContext2();
|
|
3618
3651
|
const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
|
|
3619
|
-
const variablesRef =
|
|
3652
|
+
const variablesRef = useRef9({ variables, knownUndefinedValues, isLoading });
|
|
3620
3653
|
variablesRef.current = { variables, knownUndefinedValues, isLoading };
|
|
3621
3654
|
const canEditVariable = useCallback2(
|
|
3622
3655
|
(name, variable) => (
|
|
@@ -3761,18 +3794,24 @@ function VariablesPlugin({
|
|
|
3761
3794
|
var _a, _b;
|
|
3762
3795
|
if (!disableVariables) {
|
|
3763
3796
|
const targetVariable = variablesRef.current.variables[reference];
|
|
3764
|
-
if (overwriteExistingValue) {
|
|
3765
|
-
setVariablesEditorValue(editor, createVariableReference(reference));
|
|
3766
|
-
return true;
|
|
3767
|
-
}
|
|
3768
3797
|
const variableNode = $createVariableNode(reference, {
|
|
3769
|
-
displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
|
|
3798
|
+
displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
|
|
3770
3799
|
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
3771
3800
|
referenceIsValid: true,
|
|
3772
3801
|
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
3773
3802
|
isFresh: true,
|
|
3774
3803
|
isLoading: false
|
|
3775
3804
|
});
|
|
3805
|
+
if (overwriteExistingValue) {
|
|
3806
|
+
const pNode = $createParagraphNode();
|
|
3807
|
+
pNode.append(variableNode);
|
|
3808
|
+
editor.update(() => {
|
|
3809
|
+
const root = $getRoot();
|
|
3810
|
+
root.clear();
|
|
3811
|
+
root.append(pNode);
|
|
3812
|
+
});
|
|
3813
|
+
return true;
|
|
3814
|
+
}
|
|
3776
3815
|
if (targetKey) {
|
|
3777
3816
|
(_b = $getNodeByKey(targetKey)) == null ? void 0 : _b.replace(variableNode);
|
|
3778
3817
|
} else {
|
|
@@ -3808,14 +3847,14 @@ function VariablesPlugin({
|
|
|
3808
3847
|
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;
|
|
3809
3848
|
const newState = {
|
|
3810
3849
|
...currentState,
|
|
3811
|
-
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
|
|
3850
|
+
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
|
|
3812
3851
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
3813
3852
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
3814
3853
|
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),
|
|
3815
3854
|
tooltip,
|
|
3816
3855
|
isFresh: false
|
|
3817
3856
|
};
|
|
3818
|
-
if (!
|
|
3857
|
+
if (!dequal(currentState, newState)) {
|
|
3819
3858
|
variableNode.setState(newState);
|
|
3820
3859
|
}
|
|
3821
3860
|
},
|
|
@@ -3962,7 +4001,7 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
3962
4001
|
* (albeit it won't get the fancy chip-node)
|
|
3963
4002
|
*/
|
|
3964
4003
|
getTextContent() {
|
|
3965
|
-
return
|
|
4004
|
+
return createVariableReference3(this.reference);
|
|
3966
4005
|
}
|
|
3967
4006
|
/** Creates the DOM wrapper that hosts the node */
|
|
3968
4007
|
createDOM() {
|
|
@@ -4173,9 +4212,11 @@ var input = css21`
|
|
|
4173
4212
|
min-height: 50px;
|
|
4174
4213
|
width: 100%;
|
|
4175
4214
|
position: relative;
|
|
4176
|
-
transition:
|
|
4215
|
+
transition:
|
|
4216
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4177
4217
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
4178
|
-
color var(--duration-fast) var(--timing-ease-out),
|
|
4218
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
4219
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
4179
4220
|
|
|
4180
4221
|
&::placeholder {
|
|
4181
4222
|
color: var(--gray-400);
|
|
@@ -4239,7 +4280,8 @@ var variableBindButton = css22`
|
|
|
4239
4280
|
display: flex;
|
|
4240
4281
|
height: 1.2rem;
|
|
4241
4282
|
padding: var(--spacing-2xs);
|
|
4242
|
-
transition:
|
|
4283
|
+
transition:
|
|
4284
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4243
4285
|
color var(--duration-fast) var(--timing-ease-out);
|
|
4244
4286
|
width: 1.2rem;
|
|
4245
4287
|
|
|
@@ -4322,23 +4364,9 @@ var inputMultiLine = (lines) => css22`
|
|
|
4322
4364
|
`;
|
|
4323
4365
|
|
|
4324
4366
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4367
|
+
import { hasReferencedVariables } from "@uniformdev/canvas";
|
|
4325
4368
|
import * as React10 from "react";
|
|
4326
4369
|
import { useMemo as useMemo9 } from "react";
|
|
4327
|
-
|
|
4328
|
-
// src/components/Variables/util/hasReferencedVariables.ts
|
|
4329
|
-
import { parseVariableExpression as parseVariableExpression2 } from "@uniformdev/canvas";
|
|
4330
|
-
function hasReferencedVariables(value) {
|
|
4331
|
-
let result = false;
|
|
4332
|
-
parseVariableExpression2(value, (token, type) => {
|
|
4333
|
-
if (type === "variable") {
|
|
4334
|
-
result = true;
|
|
4335
|
-
return false;
|
|
4336
|
-
}
|
|
4337
|
-
});
|
|
4338
|
-
return result;
|
|
4339
|
-
}
|
|
4340
|
-
|
|
4341
|
-
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4342
4370
|
function useInputVariablesState({
|
|
4343
4371
|
value,
|
|
4344
4372
|
onChange,
|
|
@@ -4349,23 +4377,24 @@ function useInputVariablesState({
|
|
|
4349
4377
|
valueToResetTo = void 0,
|
|
4350
4378
|
menuTooltip,
|
|
4351
4379
|
id,
|
|
4352
|
-
filterVariable
|
|
4380
|
+
filterVariable,
|
|
4381
|
+
renderMenuInPortal
|
|
4353
4382
|
}) {
|
|
4354
4383
|
const { variables } = useVariables(true);
|
|
4355
|
-
const
|
|
4384
|
+
const variableReferenceCountInValue = hasReferencedVariables(value != null ? value : "");
|
|
4356
4385
|
const [lastKnownId] = React10.useState(id);
|
|
4357
|
-
const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(
|
|
4386
|
+
const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
|
|
4358
4387
|
React10.useEffect(() => {
|
|
4359
|
-
if (
|
|
4388
|
+
if (variableReferenceCountInValue) {
|
|
4360
4389
|
setHadVariablesInValue(true);
|
|
4361
4390
|
}
|
|
4362
|
-
}, [
|
|
4391
|
+
}, [variableReferenceCountInValue]);
|
|
4363
4392
|
React10.useEffect(() => {
|
|
4364
4393
|
if (id !== lastKnownId) {
|
|
4365
|
-
setHadVariablesInValue(
|
|
4394
|
+
setHadVariablesInValue(variableReferenceCountInValue > 0);
|
|
4366
4395
|
}
|
|
4367
|
-
}, [
|
|
4368
|
-
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue :
|
|
4396
|
+
}, [variableReferenceCountInValue, id, lastKnownId]);
|
|
4397
|
+
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
|
|
4369
4398
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4370
4399
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
4371
4400
|
const sharedMenuProps = useMemo9(
|
|
@@ -4377,7 +4406,8 @@ function useInputVariablesState({
|
|
|
4377
4406
|
onChange(valueToResetTo);
|
|
4378
4407
|
},
|
|
4379
4408
|
getEditorContext,
|
|
4380
|
-
filterVariable
|
|
4409
|
+
filterVariable,
|
|
4410
|
+
portal: renderMenuInPortal
|
|
4381
4411
|
}),
|
|
4382
4412
|
[
|
|
4383
4413
|
disableResetForReals,
|
|
@@ -4386,13 +4416,14 @@ function useInputVariablesState({
|
|
|
4386
4416
|
menuTooltip,
|
|
4387
4417
|
onChange,
|
|
4388
4418
|
showAddVariableMenuOption,
|
|
4389
|
-
valueToResetTo
|
|
4419
|
+
valueToResetTo,
|
|
4420
|
+
renderMenuInPortal
|
|
4390
4421
|
]
|
|
4391
4422
|
);
|
|
4392
4423
|
return {
|
|
4393
4424
|
sharedMenuProps,
|
|
4394
4425
|
disableVariablesForReals,
|
|
4395
|
-
hasVariablesInValue,
|
|
4426
|
+
hasVariablesInValue: variableReferenceCountInValue > 0,
|
|
4396
4427
|
hadVariablesInValue: hadVariablesInValueForReals,
|
|
4397
4428
|
setHadVariablesInValue
|
|
4398
4429
|
};
|
|
@@ -4415,7 +4446,8 @@ var variableBindButton2 = css23`
|
|
|
4415
4446
|
display: flex;
|
|
4416
4447
|
height: 1.2rem;
|
|
4417
4448
|
padding: var(--spacing-2xs);
|
|
4418
|
-
transition:
|
|
4449
|
+
transition:
|
|
4450
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4419
4451
|
color var(--duration-fast) var(--timing-ease-out);
|
|
4420
4452
|
width: 1.2rem;
|
|
4421
4453
|
|
|
@@ -4439,7 +4471,7 @@ import { CLEAR_EDITOR_COMMAND } from "lexical";
|
|
|
4439
4471
|
import { BsFillPlusCircleFill } from "@react-icons/all-files/bs/BsFillPlusCircleFill";
|
|
4440
4472
|
import { CgUsbC } from "@react-icons/all-files/cg/CgUsbC";
|
|
4441
4473
|
import { HorizontalRhythm as HorizontalRhythm3, Menu as Menu2, MenuGroup as MenuGroup2, MenuItem as MenuItem2, MenuItemSeparator as MenuItemSeparator2 } from "@uniformdev/design-system";
|
|
4442
|
-
import { useRef as
|
|
4474
|
+
import { useRef as useRef10 } from "react";
|
|
4443
4475
|
import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
|
|
4444
4476
|
function SelectVariableMenu({
|
|
4445
4477
|
onSelectVariable,
|
|
@@ -4454,7 +4486,7 @@ function SelectVariableMenu({
|
|
|
4454
4486
|
filterVariable
|
|
4455
4487
|
}) {
|
|
4456
4488
|
const { variables, canDispatch, readOnly } = useVariables(true);
|
|
4457
|
-
const btnRef =
|
|
4489
|
+
const btnRef = useRef10(null);
|
|
4458
4490
|
const { editVariable } = useVariableEditor();
|
|
4459
4491
|
const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
4460
4492
|
const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
|
|
@@ -4588,7 +4620,7 @@ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
|
4588
4620
|
import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
|
|
4589
4621
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
4590
4622
|
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
4591
|
-
import { useMemo as useMemo10, useRef as
|
|
4623
|
+
import { useMemo as useMemo10, useRef as useRef11, useState as useState12 } from "react";
|
|
4592
4624
|
|
|
4593
4625
|
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4594
4626
|
import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -4603,50 +4635,18 @@ function DisablePlugin({ disabled }) {
|
|
|
4603
4635
|
|
|
4604
4636
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4605
4637
|
import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
|
|
4606
|
-
import { LineBreakNode } from "lexical";
|
|
4638
|
+
import { LineBreakNode as LineBreakNode2 } from "lexical";
|
|
4607
4639
|
import { useEffect as useEffect13 } from "react";
|
|
4608
4640
|
function SingleLineTextPlugin() {
|
|
4609
4641
|
const [editor] = useLexicalComposerContext8();
|
|
4610
4642
|
useEffect13(() => {
|
|
4611
|
-
editor.registerNodeTransform(
|
|
4643
|
+
editor.registerNodeTransform(LineBreakNode2, (node) => {
|
|
4612
4644
|
node.remove();
|
|
4613
4645
|
});
|
|
4614
4646
|
}, [editor]);
|
|
4615
4647
|
return null;
|
|
4616
4648
|
}
|
|
4617
4649
|
|
|
4618
|
-
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
4619
|
-
import { createVariableReference as createVariableReference3 } from "@uniformdev/canvas";
|
|
4620
|
-
import { LineBreakNode as LineBreakNode2, TextNode as TextNode3 } from "lexical";
|
|
4621
|
-
|
|
4622
|
-
// src/components/Variables/util/variableExpression.ts
|
|
4623
|
-
var variablePrefix = "${";
|
|
4624
|
-
var variableSuffix = "}";
|
|
4625
|
-
|
|
4626
|
-
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
4627
|
-
function serializeVariablesEditorState(editorState) {
|
|
4628
|
-
const buf = [];
|
|
4629
|
-
serializeRecursive(editorState.toJSON().root, buf);
|
|
4630
|
-
const result = buf.join("");
|
|
4631
|
-
return result.length > 0 ? result : void 0;
|
|
4632
|
-
}
|
|
4633
|
-
function serializeRecursive(node, buffer) {
|
|
4634
|
-
if (node.type === TextNode3.getType()) {
|
|
4635
|
-
buffer.push(node.text.replace(variablePrefix, "\\${"));
|
|
4636
|
-
}
|
|
4637
|
-
if (node.type === VariableNode.getType()) {
|
|
4638
|
-
buffer.push(createVariableReference3(node.reference));
|
|
4639
|
-
}
|
|
4640
|
-
if (node.type === LineBreakNode2.getType()) {
|
|
4641
|
-
buffer.push("\n");
|
|
4642
|
-
}
|
|
4643
|
-
if ("children" in node && node.children) {
|
|
4644
|
-
for (const child of node.children) {
|
|
4645
|
-
serializeRecursive(child, buffer);
|
|
4646
|
-
}
|
|
4647
|
-
}
|
|
4648
|
-
}
|
|
4649
|
-
|
|
4650
4650
|
// src/components/Variables/toolbox/VariablesComposer.tsx
|
|
4651
4651
|
import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
|
|
4652
4652
|
function VariablesComposer(props) {
|
|
@@ -4673,10 +4673,9 @@ function VariablesComposer(props) {
|
|
|
4673
4673
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4674
4674
|
[]
|
|
4675
4675
|
);
|
|
4676
|
-
const editorState =
|
|
4677
|
-
const updateTimeout =
|
|
4678
|
-
if (typeof document === "undefined")
|
|
4679
|
-
return null;
|
|
4676
|
+
const editorState = useRef11();
|
|
4677
|
+
const updateTimeout = useRef11();
|
|
4678
|
+
if (typeof document === "undefined") return null;
|
|
4680
4679
|
return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
|
|
4681
4680
|
/* @__PURE__ */ jsx38(
|
|
4682
4681
|
OnChangePlugin,
|
|
@@ -4854,7 +4853,8 @@ function InputVariables(props) {
|
|
|
4854
4853
|
filterVariable,
|
|
4855
4854
|
styleVariant = "default",
|
|
4856
4855
|
renderMenuInPortal,
|
|
4857
|
-
disableDismissEditorOnChange
|
|
4856
|
+
disableDismissEditorOnChange,
|
|
4857
|
+
singleTokenMode
|
|
4858
4858
|
} = props;
|
|
4859
4859
|
const [finalId] = useState13(id != null ? id : () => v42());
|
|
4860
4860
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -4919,7 +4919,7 @@ function InputVariables(props) {
|
|
|
4919
4919
|
buttonCss: variableBindButton,
|
|
4920
4920
|
tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
4921
4921
|
buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
4922
|
-
replaceValueOnVariableInsert: useInputWithNoVariables
|
|
4922
|
+
replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
|
|
4923
4923
|
}
|
|
4924
4924
|
)
|
|
4925
4925
|
]
|
|
@@ -4959,13 +4959,13 @@ function InputVariables(props) {
|
|
|
4959
4959
|
showAddVariableMenuOption,
|
|
4960
4960
|
enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
|
|
4961
4961
|
getEditorContext,
|
|
4962
|
-
disabled,
|
|
4962
|
+
disabled: disabled || singleTokenMode,
|
|
4963
4963
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
4964
4964
|
autoFocus,
|
|
4965
4965
|
filterVariable,
|
|
4966
4966
|
children: [
|
|
4967
4967
|
/* @__PURE__ */ jsx40(PasteTransformerPlugin, { transformPaste }),
|
|
4968
|
-
/* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
|
|
4968
|
+
/* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
4969
4969
|
editorRef ? /* @__PURE__ */ jsx40(EditorRefPlugin, { editorRef }) : null,
|
|
4970
4970
|
body
|
|
4971
4971
|
]
|
|
@@ -5008,7 +5008,8 @@ function ParameterConnectionIndicator({
|
|
|
5008
5008
|
menuOptions,
|
|
5009
5009
|
disabled,
|
|
5010
5010
|
menuTooltip = "Insert variable",
|
|
5011
|
-
overrideMenuButtonParentMargin
|
|
5011
|
+
overrideMenuButtonParentMargin,
|
|
5012
|
+
renderMenuInPortal = false
|
|
5012
5013
|
}) {
|
|
5013
5014
|
const hasVariablesInValue = useMemo11(() => {
|
|
5014
5015
|
let result = false;
|
|
@@ -5022,12 +5023,12 @@ function ParameterConnectionIndicator({
|
|
|
5022
5023
|
return result;
|
|
5023
5024
|
}, [value]);
|
|
5024
5025
|
return /* @__PURE__ */ jsxs24(HorizontalRhythm5, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5025
|
-
/* @__PURE__ */ jsx41("div", { css: { flex: 1 }, children }),
|
|
5026
|
+
/* @__PURE__ */ jsx41("div", { css: { flex: 1, maxWidth: "100%" }, children }),
|
|
5026
5027
|
disabled ? null : /* @__PURE__ */ jsx41(
|
|
5027
5028
|
Menu3,
|
|
5028
5029
|
{
|
|
5029
5030
|
placement: "bottom-start",
|
|
5030
|
-
withoutPortal:
|
|
5031
|
+
withoutPortal: !renderMenuInPortal,
|
|
5031
5032
|
menuTrigger: /* @__PURE__ */ jsx41(
|
|
5032
5033
|
"div",
|
|
5033
5034
|
{
|
|
@@ -5061,13 +5062,13 @@ import { useCallback as useCallback4 } from "react";
|
|
|
5061
5062
|
import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
|
|
5062
5063
|
import { mergeRegister as mergeRegister5 } from "@lexical/utils";
|
|
5063
5064
|
import { $getNodeByKey as $getNodeByKey3, COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH3 } from "lexical";
|
|
5064
|
-
import { useEffect as useEffect15, useRef as
|
|
5065
|
+
import { useEffect as useEffect15, useRef as useRef12 } from "react";
|
|
5065
5066
|
function OnDisconnectPlugin({
|
|
5066
5067
|
onDisconnect
|
|
5067
5068
|
}) {
|
|
5068
5069
|
const [editor] = useLexicalComposerContext10();
|
|
5069
5070
|
const { variables } = useVariables(true);
|
|
5070
|
-
const variablesRef =
|
|
5071
|
+
const variablesRef = useRef12(variables);
|
|
5071
5072
|
variablesRef.current = variables;
|
|
5072
5073
|
useEffect15(() => {
|
|
5073
5074
|
return mergeRegister5(
|
|
@@ -5141,7 +5142,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5141
5142
|
editorRef ? /* @__PURE__ */ jsx42(EditorRefPlugin, { editorRef }) : null,
|
|
5142
5143
|
/* @__PURE__ */ jsx42(ControlledValuePlugin, { enabled: true, value }),
|
|
5143
5144
|
/* @__PURE__ */ jsxs25(HorizontalRhythm6, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5144
|
-
/* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
|
|
5145
|
+
/* @__PURE__ */ jsx42("div", { css: { flex: 1, minWidth: "0" }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
|
|
5145
5146
|
VariablesComposerInput,
|
|
5146
5147
|
{
|
|
5147
5148
|
"data-text-value": value,
|
|
@@ -5260,6 +5261,12 @@ ${prettifyBindExpression(bindExpression)}`
|
|
|
5260
5261
|
};
|
|
5261
5262
|
}
|
|
5262
5263
|
|
|
5264
|
+
// src/components/Variables/util/hasReferencedVariables.ts
|
|
5265
|
+
import { hasReferencedVariables as canvasHasReferencedVariables } from "@uniformdev/canvas";
|
|
5266
|
+
function hasReferencedVariables2(value) {
|
|
5267
|
+
return canvasHasReferencedVariables(value) > 0;
|
|
5268
|
+
}
|
|
5269
|
+
|
|
5263
5270
|
// src/components/Variables/VariablesList.tsx
|
|
5264
5271
|
import { css as css27 } from "@emotion/react";
|
|
5265
5272
|
import {
|
|
@@ -6235,11 +6242,11 @@ import { LoadingIndicator as LoadingIndicator3, Theme as Theme2 } from "@uniform
|
|
|
6235
6242
|
|
|
6236
6243
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
6237
6244
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
6238
|
-
import { useEffect as useEffect16, useRef as
|
|
6245
|
+
import { useEffect as useEffect16, useRef as useRef13, useState as useState15 } from "react";
|
|
6239
6246
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
6240
6247
|
const [error, setError] = useState15();
|
|
6241
6248
|
const [sdk, setSdk] = useState15();
|
|
6242
|
-
const initializationInProgress =
|
|
6249
|
+
const initializationInProgress = useRef13(false);
|
|
6243
6250
|
useEffect16(
|
|
6244
6251
|
() => {
|
|
6245
6252
|
if (typeof window === "undefined" || sdk) {
|
|
@@ -6604,7 +6611,8 @@ var ButtonStyles = css33`
|
|
|
6604
6611
|
font-size: var(--fs-sm);
|
|
6605
6612
|
line-height: 1;
|
|
6606
6613
|
gap: var(--spacing-xs);
|
|
6607
|
-
transition:
|
|
6614
|
+
transition:
|
|
6615
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
6608
6616
|
background-color var(--duration-fast) var(--timing-ease-out);
|
|
6609
6617
|
|
|
6610
6618
|
&:hover {
|
|
@@ -6906,7 +6914,7 @@ var ObjectSearchContainer = ({
|
|
|
6906
6914
|
const { flatVariables } = useVariables(true);
|
|
6907
6915
|
const inputValue = (_b = dynamicEntryId != null ? dynamicEntryId : (_a = selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6908
6916
|
const isDynamicEntryIdAvailable = React12.useMemo(
|
|
6909
|
-
() => Boolean(inputValue &&
|
|
6917
|
+
() => Boolean(inputValue && hasReferencedVariables2(inputValue)),
|
|
6910
6918
|
[inputValue]
|
|
6911
6919
|
);
|
|
6912
6920
|
const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx64(
|
|
@@ -6948,7 +6956,7 @@ var ObjectSearchContainer = ({
|
|
|
6948
6956
|
id: selectedValue
|
|
6949
6957
|
}
|
|
6950
6958
|
]);
|
|
6951
|
-
if (
|
|
6959
|
+
if (hasReferencedVariables2(selectedValue)) {
|
|
6952
6960
|
onSetQuery({ ...query, dynamicEntryId: selectedValue });
|
|
6953
6961
|
}
|
|
6954
6962
|
};
|
|
@@ -7003,14 +7011,14 @@ function createLocationValidator(setValue, validate) {
|
|
|
7003
7011
|
|
|
7004
7012
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7005
7013
|
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
7006
|
-
import { useEffect as useEffect17, useRef as
|
|
7014
|
+
import { useEffect as useEffect17, useRef as useRef14 } from "react";
|
|
7007
7015
|
function useContentDataResourceLocaleInfo({
|
|
7008
7016
|
locale,
|
|
7009
7017
|
setLocale,
|
|
7010
7018
|
dynamicInputs
|
|
7011
7019
|
}) {
|
|
7012
7020
|
var _a;
|
|
7013
|
-
const setLocaleRef =
|
|
7021
|
+
const setLocaleRef = useRef14(setLocale);
|
|
7014
7022
|
setLocaleRef.current = setLocale;
|
|
7015
7023
|
const { flatVariables } = useVariables();
|
|
7016
7024
|
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
|
|
@@ -7340,7 +7348,7 @@ function ObjectSearchListOfSearchResults() {
|
|
|
7340
7348
|
}
|
|
7341
7349
|
|
|
7342
7350
|
// src/components/ObjectSearch/hooks/ControlledObjectSearchProvider.tsx
|
|
7343
|
-
import { useCallback as useCallback6, useDeferredValue as useDeferredValue2, useEffect as useEffect19, useMemo as useMemo16, useRef as
|
|
7351
|
+
import { useCallback as useCallback6, useDeferredValue as useDeferredValue2, useEffect as useEffect19, useMemo as useMemo16, useRef as useRef15 } from "react";
|
|
7344
7352
|
import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
|
|
7345
7353
|
var ControlledObjectSearchProvider = ({
|
|
7346
7354
|
selectedItems,
|
|
@@ -7361,7 +7369,7 @@ var ControlledObjectSearchProvider = ({
|
|
|
7361
7369
|
var _a, _b;
|
|
7362
7370
|
const { flatVariables } = useVariables(true);
|
|
7363
7371
|
const querySearchDeferred = useDeferredValue2(query);
|
|
7364
|
-
const innerSelectedItems =
|
|
7372
|
+
const innerSelectedItems = useRef15(selectedItems);
|
|
7365
7373
|
useEffect19(() => {
|
|
7366
7374
|
if (selectedItems !== void 0) {
|
|
7367
7375
|
innerSelectedItems.current = selectedItems;
|
|
@@ -7396,6 +7404,13 @@ var ControlledObjectSearchProvider = ({
|
|
|
7396
7404
|
}, [onSelectItemsChange]);
|
|
7397
7405
|
const list = useMemo16(() => ({ items: searchResultItems }), [searchResultItems]);
|
|
7398
7406
|
const boundQuery = useMemo16(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
7407
|
+
const flatLocaleOptions = useMemo16(
|
|
7408
|
+
() => {
|
|
7409
|
+
var _a2;
|
|
7410
|
+
return (_a2 = localeOptions == null ? void 0 : localeOptions.flatMap((option) => "type" in option && option.type === "group" ? option.options : option).filter((v) => !Array.isArray(v))) != null ? _a2 : [];
|
|
7411
|
+
},
|
|
7412
|
+
[localeOptions]
|
|
7413
|
+
);
|
|
7399
7414
|
const isLoadingInitially = Boolean(
|
|
7400
7415
|
isManualSelection ? !((_a = innerSelectedItems.current) == null ? void 0 : _a.length) && selectedItemsLoading : selectedItemsLoading
|
|
7401
7416
|
);
|
|
@@ -7413,7 +7428,7 @@ var ControlledObjectSearchProvider = ({
|
|
|
7413
7428
|
isSelectedItemsListLoading: isLoadingInitially,
|
|
7414
7429
|
isListLoading: searchResultListLoading,
|
|
7415
7430
|
isMulti,
|
|
7416
|
-
localeOptions,
|
|
7431
|
+
localeOptions: flatLocaleOptions,
|
|
7417
7432
|
enableFilterByLocale,
|
|
7418
7433
|
dynamicEntryId
|
|
7419
7434
|
},
|
|
@@ -7423,7 +7438,7 @@ var ControlledObjectSearchProvider = ({
|
|
|
7423
7438
|
};
|
|
7424
7439
|
|
|
7425
7440
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
7426
|
-
import { useEffect as useEffect20, useMemo as useMemo17, useRef as
|
|
7441
|
+
import { useEffect as useEffect20, useMemo as useMemo17, useRef as useRef16 } from "react";
|
|
7427
7442
|
import { jsx as jsx70 } from "@emotion/react/jsx-runtime";
|
|
7428
7443
|
function ParamTypeDynamicDataProvider(props) {
|
|
7429
7444
|
const { children } = props;
|
|
@@ -7445,7 +7460,7 @@ var JsonMeshVariableEditor = ({
|
|
|
7445
7460
|
variable,
|
|
7446
7461
|
context
|
|
7447
7462
|
}) => {
|
|
7448
|
-
const sillyRef =
|
|
7463
|
+
const sillyRef = useRef16(false);
|
|
7449
7464
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
7450
7465
|
useEffect20(() => {
|
|
7451
7466
|
if (sillyRef.current) {
|
|
@@ -7479,652 +7494,617 @@ var JsonMeshVariableEditor = ({
|
|
|
7479
7494
|
var NUMBER_OPERATORS = [
|
|
7480
7495
|
{
|
|
7481
7496
|
label: "equals...",
|
|
7482
|
-
symbol: "=",
|
|
7483
7497
|
value: "eq",
|
|
7484
|
-
editorType: "number"
|
|
7498
|
+
editorType: "number",
|
|
7499
|
+
expectedValueType: "single"
|
|
7485
7500
|
},
|
|
7486
7501
|
{
|
|
7487
7502
|
label: "does not equal...",
|
|
7488
|
-
symbol: "\u2260",
|
|
7489
7503
|
value: "neq",
|
|
7490
|
-
editorType: "number"
|
|
7504
|
+
editorType: "number",
|
|
7505
|
+
expectedValueType: "single"
|
|
7491
7506
|
},
|
|
7492
7507
|
{
|
|
7493
7508
|
label: "greater than...",
|
|
7494
|
-
symbol: ">",
|
|
7495
7509
|
value: "gt",
|
|
7496
|
-
editorType: "number"
|
|
7510
|
+
editorType: "number",
|
|
7511
|
+
expectedValueType: "single"
|
|
7497
7512
|
},
|
|
7498
7513
|
{
|
|
7499
7514
|
label: "greater than or equal to...",
|
|
7500
|
-
symbol: "\u2265",
|
|
7501
7515
|
value: "gte",
|
|
7502
|
-
editorType: "number"
|
|
7516
|
+
editorType: "number",
|
|
7517
|
+
expectedValueType: "single"
|
|
7503
7518
|
},
|
|
7504
7519
|
{
|
|
7505
7520
|
label: "less than...",
|
|
7506
|
-
symbol: "<",
|
|
7507
7521
|
value: "lt",
|
|
7508
|
-
editorType: "number"
|
|
7522
|
+
editorType: "number",
|
|
7523
|
+
expectedValueType: "single"
|
|
7509
7524
|
},
|
|
7510
7525
|
{
|
|
7511
7526
|
label: "less than or equal to...",
|
|
7512
|
-
symbol: "\u2264",
|
|
7513
7527
|
value: "lte",
|
|
7514
|
-
editorType: "number"
|
|
7528
|
+
editorType: "number",
|
|
7529
|
+
expectedValueType: "single"
|
|
7515
7530
|
},
|
|
7516
7531
|
{
|
|
7517
7532
|
label: "is empty",
|
|
7518
7533
|
value: "ndef",
|
|
7519
|
-
editorType: "empty"
|
|
7534
|
+
editorType: "empty",
|
|
7535
|
+
expectedValueType: "false"
|
|
7520
7536
|
},
|
|
7521
7537
|
{
|
|
7522
7538
|
label: "is between...",
|
|
7523
7539
|
value: "between",
|
|
7524
|
-
editorType: "numberRange"
|
|
7540
|
+
editorType: "numberRange",
|
|
7541
|
+
expectedValueType: "between"
|
|
7525
7542
|
},
|
|
7526
7543
|
{
|
|
7527
7544
|
label: "is not empty",
|
|
7528
7545
|
value: "def",
|
|
7529
|
-
editorType: "empty"
|
|
7546
|
+
editorType: "empty",
|
|
7547
|
+
expectedValueType: "true"
|
|
7530
7548
|
}
|
|
7531
7549
|
];
|
|
7532
7550
|
var DATE_OPERATORS = [
|
|
7533
7551
|
{
|
|
7534
7552
|
label: "is",
|
|
7535
7553
|
value: "eq",
|
|
7536
|
-
editorType: "date"
|
|
7554
|
+
editorType: "date",
|
|
7555
|
+
expectedValueType: "single"
|
|
7537
7556
|
},
|
|
7538
7557
|
{
|
|
7539
7558
|
label: "is between...",
|
|
7540
7559
|
value: "between",
|
|
7541
|
-
editorType: "dateRange"
|
|
7560
|
+
editorType: "dateRange",
|
|
7561
|
+
expectedValueType: "between"
|
|
7542
7562
|
},
|
|
7543
7563
|
{
|
|
7544
7564
|
label: "is before...",
|
|
7545
7565
|
value: "lt",
|
|
7546
|
-
editorType: "date"
|
|
7566
|
+
editorType: "date",
|
|
7567
|
+
expectedValueType: "single"
|
|
7547
7568
|
},
|
|
7548
7569
|
{
|
|
7549
7570
|
label: "is after...",
|
|
7550
7571
|
value: "gt",
|
|
7551
|
-
editorType: "date"
|
|
7572
|
+
editorType: "date",
|
|
7573
|
+
expectedValueType: "single"
|
|
7552
7574
|
},
|
|
7553
7575
|
{
|
|
7554
7576
|
label: "is on or before...",
|
|
7555
7577
|
value: "lte",
|
|
7556
|
-
editorType: "date"
|
|
7578
|
+
editorType: "date",
|
|
7579
|
+
expectedValueType: "single"
|
|
7557
7580
|
},
|
|
7558
7581
|
{
|
|
7559
7582
|
label: "is on or after...",
|
|
7560
7583
|
value: "gte",
|
|
7561
|
-
editorType: "date"
|
|
7584
|
+
editorType: "date",
|
|
7585
|
+
expectedValueType: "single"
|
|
7562
7586
|
},
|
|
7563
7587
|
{
|
|
7564
7588
|
label: "is empty",
|
|
7565
7589
|
value: "ndef",
|
|
7566
|
-
editorType: "empty"
|
|
7590
|
+
editorType: "empty",
|
|
7591
|
+
expectedValueType: "false"
|
|
7567
7592
|
},
|
|
7568
7593
|
{
|
|
7569
7594
|
label: "is not",
|
|
7570
7595
|
value: "neq",
|
|
7571
|
-
editorType: "date"
|
|
7596
|
+
editorType: "date",
|
|
7597
|
+
expectedValueType: "single"
|
|
7572
7598
|
},
|
|
7573
7599
|
{
|
|
7574
7600
|
label: "is not empty",
|
|
7575
7601
|
value: "def",
|
|
7576
|
-
editorType: "empty"
|
|
7602
|
+
editorType: "empty",
|
|
7603
|
+
expectedValueType: "true"
|
|
7577
7604
|
}
|
|
7578
7605
|
];
|
|
7579
7606
|
var TEXTBOX_OPERATORS = [
|
|
7580
7607
|
{
|
|
7581
7608
|
label: "contains...",
|
|
7582
7609
|
value: "match",
|
|
7583
|
-
editorType: "text"
|
|
7610
|
+
editorType: "text",
|
|
7611
|
+
expectedValueType: "single"
|
|
7584
7612
|
},
|
|
7585
7613
|
{
|
|
7586
7614
|
label: "is",
|
|
7587
7615
|
value: "eq",
|
|
7588
|
-
editorType: "text"
|
|
7616
|
+
editorType: "text",
|
|
7617
|
+
expectedValueType: "single"
|
|
7589
7618
|
},
|
|
7590
7619
|
{
|
|
7591
7620
|
label: "is empty",
|
|
7592
7621
|
value: "ndef",
|
|
7593
|
-
editorType: "empty"
|
|
7622
|
+
editorType: "empty",
|
|
7623
|
+
expectedValueType: "false"
|
|
7594
7624
|
},
|
|
7595
7625
|
{
|
|
7596
7626
|
label: "starts with...",
|
|
7597
7627
|
value: "starts",
|
|
7598
|
-
editorType: "text"
|
|
7628
|
+
editorType: "text",
|
|
7629
|
+
expectedValueType: "single"
|
|
7599
7630
|
},
|
|
7600
7631
|
{
|
|
7601
7632
|
label: "is not",
|
|
7602
7633
|
value: "neq",
|
|
7603
|
-
editorType: "text"
|
|
7634
|
+
editorType: "text",
|
|
7635
|
+
expectedValueType: "single"
|
|
7604
7636
|
},
|
|
7605
7637
|
{
|
|
7606
7638
|
label: "is not empty",
|
|
7607
7639
|
value: "def",
|
|
7608
|
-
editorType: "empty"
|
|
7640
|
+
editorType: "empty",
|
|
7641
|
+
expectedValueType: "true"
|
|
7609
7642
|
}
|
|
7610
7643
|
];
|
|
7611
7644
|
var USER_OPERATORS = [
|
|
7612
7645
|
{
|
|
7613
7646
|
label: "contains...",
|
|
7614
7647
|
value: "match",
|
|
7615
|
-
editorType: "text"
|
|
7648
|
+
editorType: "text",
|
|
7649
|
+
expectedValueType: "single"
|
|
7616
7650
|
},
|
|
7617
7651
|
{
|
|
7618
7652
|
label: "is",
|
|
7619
7653
|
value: "eq",
|
|
7620
|
-
editorType: "text"
|
|
7654
|
+
editorType: "text",
|
|
7655
|
+
expectedValueType: "single"
|
|
7621
7656
|
},
|
|
7622
7657
|
{
|
|
7623
7658
|
label: "starts with...",
|
|
7624
7659
|
value: "starts",
|
|
7625
|
-
editorType: "text"
|
|
7660
|
+
editorType: "text",
|
|
7661
|
+
expectedValueType: "single"
|
|
7626
7662
|
},
|
|
7627
7663
|
{
|
|
7628
7664
|
label: "is not",
|
|
7629
7665
|
value: "neq",
|
|
7630
|
-
editorType: "text"
|
|
7666
|
+
editorType: "text",
|
|
7667
|
+
expectedValueType: "single"
|
|
7631
7668
|
}
|
|
7632
7669
|
];
|
|
7633
|
-
var
|
|
7670
|
+
var DATE_TIME_OPERATORS = [
|
|
7634
7671
|
{
|
|
7635
7672
|
label: "is",
|
|
7636
7673
|
value: "sys-date-eq",
|
|
7637
|
-
editorType: "date"
|
|
7674
|
+
editorType: "date",
|
|
7675
|
+
expectedValueType: "single"
|
|
7638
7676
|
},
|
|
7639
7677
|
{
|
|
7640
7678
|
label: "is between...",
|
|
7641
7679
|
value: "sys-date-between",
|
|
7642
|
-
editorType: "dateRange"
|
|
7680
|
+
editorType: "dateRange",
|
|
7681
|
+
expectedValueType: "between"
|
|
7643
7682
|
},
|
|
7644
7683
|
{
|
|
7645
7684
|
label: "is before...",
|
|
7646
7685
|
value: "sys-date-lt",
|
|
7647
|
-
editorType: "date"
|
|
7686
|
+
editorType: "date",
|
|
7687
|
+
expectedValueType: "single"
|
|
7648
7688
|
},
|
|
7649
7689
|
{
|
|
7650
7690
|
label: "is after...",
|
|
7651
7691
|
value: "sys-date-gt",
|
|
7652
|
-
editorType: "date"
|
|
7692
|
+
editorType: "date",
|
|
7693
|
+
expectedValueType: "single"
|
|
7653
7694
|
},
|
|
7654
7695
|
{
|
|
7655
7696
|
label: "is on or before...",
|
|
7656
7697
|
value: "sys-date-lte",
|
|
7657
|
-
editorType: "date"
|
|
7698
|
+
editorType: "date",
|
|
7699
|
+
expectedValueType: "single"
|
|
7658
7700
|
},
|
|
7659
7701
|
{
|
|
7660
7702
|
label: "is on or after...",
|
|
7661
7703
|
value: "sys-date-gte",
|
|
7662
|
-
editorType: "date"
|
|
7704
|
+
editorType: "date",
|
|
7705
|
+
expectedValueType: "single"
|
|
7663
7706
|
},
|
|
7664
7707
|
{
|
|
7665
|
-
label: "is
|
|
7666
|
-
value: "
|
|
7667
|
-
editorType: "
|
|
7708
|
+
label: "is empty",
|
|
7709
|
+
value: "ndef",
|
|
7710
|
+
editorType: "empty",
|
|
7711
|
+
expectedValueType: "false"
|
|
7712
|
+
},
|
|
7713
|
+
{
|
|
7714
|
+
label: "is not empty",
|
|
7715
|
+
value: "def",
|
|
7716
|
+
editorType: "empty",
|
|
7717
|
+
expectedValueType: "true"
|
|
7668
7718
|
}
|
|
7669
7719
|
];
|
|
7670
7720
|
var RICHTEXT_OPERATORS = [
|
|
7671
7721
|
{
|
|
7672
7722
|
label: "contains...",
|
|
7673
7723
|
value: "match",
|
|
7674
|
-
editorType: "text"
|
|
7724
|
+
editorType: "text",
|
|
7725
|
+
expectedValueType: "single"
|
|
7675
7726
|
},
|
|
7676
7727
|
{
|
|
7677
7728
|
label: "is empty",
|
|
7678
7729
|
value: "ndef",
|
|
7679
|
-
editorType: "empty"
|
|
7730
|
+
editorType: "empty",
|
|
7731
|
+
expectedValueType: "false"
|
|
7680
7732
|
},
|
|
7681
7733
|
{
|
|
7682
7734
|
label: "starts with...",
|
|
7683
7735
|
value: "starts",
|
|
7684
|
-
editorType: "text"
|
|
7736
|
+
editorType: "text",
|
|
7737
|
+
expectedValueType: "single"
|
|
7685
7738
|
},
|
|
7686
7739
|
{
|
|
7687
7740
|
label: "is not empty",
|
|
7688
7741
|
value: "def",
|
|
7689
|
-
editorType: "empty"
|
|
7742
|
+
editorType: "empty",
|
|
7743
|
+
expectedValueType: "true"
|
|
7690
7744
|
}
|
|
7691
7745
|
];
|
|
7692
7746
|
var CHECKBOX_OPERATORS = [
|
|
7693
7747
|
{
|
|
7694
7748
|
label: "is checked",
|
|
7695
7749
|
value: "def",
|
|
7696
|
-
editorType: "empty"
|
|
7750
|
+
editorType: "empty",
|
|
7751
|
+
expectedValueType: "true"
|
|
7697
7752
|
},
|
|
7698
7753
|
{
|
|
7699
7754
|
label: "is not checked",
|
|
7700
7755
|
value: "ndef",
|
|
7701
|
-
editorType: "empty"
|
|
7756
|
+
editorType: "empty",
|
|
7757
|
+
expectedValueType: "false"
|
|
7702
7758
|
}
|
|
7703
7759
|
];
|
|
7704
7760
|
var SYSTEM_FIELD_OPERATORS = [
|
|
7705
7761
|
{
|
|
7706
7762
|
label: "is",
|
|
7707
7763
|
value: "eq",
|
|
7708
|
-
editorType: "singleChoice"
|
|
7764
|
+
editorType: "singleChoice",
|
|
7765
|
+
expectedValueType: "single"
|
|
7766
|
+
},
|
|
7767
|
+
{
|
|
7768
|
+
label: "is any of...",
|
|
7769
|
+
value: "in",
|
|
7770
|
+
editorType: "multiChoice",
|
|
7771
|
+
expectedValueType: "array"
|
|
7772
|
+
},
|
|
7773
|
+
{
|
|
7774
|
+
label: "is not",
|
|
7775
|
+
value: "neq",
|
|
7776
|
+
editorType: "singleChoice",
|
|
7777
|
+
expectedValueType: "single"
|
|
7778
|
+
},
|
|
7779
|
+
{
|
|
7780
|
+
label: "is none of...",
|
|
7781
|
+
value: "nin",
|
|
7782
|
+
editorType: "multiChoice",
|
|
7783
|
+
expectedValueType: "array"
|
|
7784
|
+
}
|
|
7785
|
+
];
|
|
7786
|
+
var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
|
|
7787
|
+
{
|
|
7788
|
+
label: "is",
|
|
7789
|
+
value: "eq",
|
|
7790
|
+
editorType: "singleChoice",
|
|
7791
|
+
expectedValueType: "single"
|
|
7709
7792
|
},
|
|
7710
7793
|
{
|
|
7711
7794
|
label: "is any of...",
|
|
7712
7795
|
value: "in",
|
|
7713
|
-
editorType: "multiChoice"
|
|
7796
|
+
editorType: "multiChoice",
|
|
7797
|
+
expectedValueType: "array"
|
|
7798
|
+
},
|
|
7799
|
+
{
|
|
7800
|
+
label: "is empty",
|
|
7801
|
+
value: "ndef",
|
|
7802
|
+
editorType: "empty",
|
|
7803
|
+
expectedValueType: "false"
|
|
7714
7804
|
},
|
|
7715
7805
|
{
|
|
7716
7806
|
label: "is not",
|
|
7717
7807
|
value: "neq",
|
|
7718
|
-
editorType: "singleChoice"
|
|
7808
|
+
editorType: "singleChoice",
|
|
7809
|
+
expectedValueType: "single"
|
|
7719
7810
|
},
|
|
7720
7811
|
{
|
|
7721
7812
|
label: "is none of...",
|
|
7722
7813
|
value: "nin",
|
|
7723
|
-
editorType: "multiChoice"
|
|
7814
|
+
editorType: "multiChoice",
|
|
7815
|
+
expectedValueType: "array"
|
|
7816
|
+
},
|
|
7817
|
+
{
|
|
7818
|
+
label: "is not empty",
|
|
7819
|
+
value: "def",
|
|
7820
|
+
editorType: "empty",
|
|
7821
|
+
expectedValueType: "true"
|
|
7724
7822
|
}
|
|
7725
7823
|
];
|
|
7726
7824
|
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
7727
7825
|
{
|
|
7728
7826
|
label: "is",
|
|
7729
7827
|
value: "eq",
|
|
7730
|
-
editorType: "statusSingleChoice"
|
|
7828
|
+
editorType: "statusSingleChoice",
|
|
7829
|
+
expectedValueType: "single"
|
|
7731
7830
|
},
|
|
7732
7831
|
{
|
|
7733
7832
|
label: "is any of...",
|
|
7734
7833
|
value: "in",
|
|
7735
|
-
editorType: "statusMultiChoice"
|
|
7834
|
+
editorType: "statusMultiChoice",
|
|
7835
|
+
expectedValueType: "array"
|
|
7736
7836
|
},
|
|
7737
7837
|
{
|
|
7738
7838
|
label: "is not",
|
|
7739
7839
|
value: "neq",
|
|
7740
|
-
editorType: "statusSingleChoice"
|
|
7840
|
+
editorType: "statusSingleChoice",
|
|
7841
|
+
expectedValueType: "single"
|
|
7741
7842
|
},
|
|
7742
7843
|
{
|
|
7743
7844
|
label: "is none of...",
|
|
7744
7845
|
value: "nin",
|
|
7745
|
-
editorType: "statusMultiChoice"
|
|
7846
|
+
editorType: "statusMultiChoice",
|
|
7847
|
+
expectedValueType: "array"
|
|
7746
7848
|
}
|
|
7747
7849
|
];
|
|
7748
7850
|
var SELECT_OPERATORS = [
|
|
7749
7851
|
{
|
|
7750
7852
|
label: "is",
|
|
7751
7853
|
value: "eq",
|
|
7752
|
-
editorType: "singleChoice"
|
|
7854
|
+
editorType: "singleChoice",
|
|
7855
|
+
expectedValueType: "single"
|
|
7753
7856
|
},
|
|
7754
7857
|
{
|
|
7755
7858
|
label: "is any of...",
|
|
7756
7859
|
value: "in",
|
|
7757
|
-
editorType: "multiChoice"
|
|
7860
|
+
editorType: "multiChoice",
|
|
7861
|
+
expectedValueType: "array"
|
|
7758
7862
|
},
|
|
7759
7863
|
{
|
|
7760
7864
|
label: "is empty",
|
|
7761
7865
|
value: "ndef",
|
|
7762
|
-
editorType: "empty"
|
|
7866
|
+
editorType: "empty",
|
|
7867
|
+
expectedValueType: "false"
|
|
7763
7868
|
},
|
|
7764
7869
|
{
|
|
7765
7870
|
label: "contains...",
|
|
7766
7871
|
value: "match",
|
|
7767
|
-
editorType: "text"
|
|
7872
|
+
editorType: "text",
|
|
7873
|
+
expectedValueType: "single"
|
|
7768
7874
|
},
|
|
7769
7875
|
{
|
|
7770
7876
|
label: "starts with...",
|
|
7771
7877
|
value: "starts",
|
|
7772
|
-
editorType: "text"
|
|
7878
|
+
editorType: "text",
|
|
7879
|
+
expectedValueType: "single"
|
|
7773
7880
|
},
|
|
7774
7881
|
{
|
|
7775
7882
|
label: "is not",
|
|
7776
7883
|
value: "neq",
|
|
7777
|
-
editorType: "singleChoice"
|
|
7884
|
+
editorType: "singleChoice",
|
|
7885
|
+
expectedValueType: "single"
|
|
7778
7886
|
},
|
|
7779
7887
|
{
|
|
7780
7888
|
label: "is none of...",
|
|
7781
7889
|
value: "nin",
|
|
7782
|
-
editorType: "multiChoice"
|
|
7890
|
+
editorType: "multiChoice",
|
|
7891
|
+
expectedValueType: "array"
|
|
7783
7892
|
},
|
|
7784
7893
|
{
|
|
7785
7894
|
label: "is not empty",
|
|
7786
7895
|
value: "def",
|
|
7787
|
-
editorType: "empty"
|
|
7896
|
+
editorType: "empty",
|
|
7897
|
+
expectedValueType: "true"
|
|
7788
7898
|
}
|
|
7789
7899
|
];
|
|
7790
7900
|
var MULTI_SELECT_OPERATORS = [
|
|
7791
7901
|
{
|
|
7792
7902
|
label: "is",
|
|
7793
7903
|
value: "eq",
|
|
7794
|
-
editorType: "singleChoice"
|
|
7904
|
+
editorType: "singleChoice",
|
|
7905
|
+
expectedValueType: "single"
|
|
7795
7906
|
},
|
|
7796
7907
|
{
|
|
7797
7908
|
label: "is any of...",
|
|
7798
7909
|
value: "in",
|
|
7799
|
-
editorType: "multiChoice"
|
|
7910
|
+
editorType: "multiChoice",
|
|
7911
|
+
expectedValueType: "array"
|
|
7800
7912
|
},
|
|
7801
7913
|
{
|
|
7802
7914
|
label: "is empty",
|
|
7803
7915
|
value: "ndef",
|
|
7804
|
-
editorType: "empty"
|
|
7916
|
+
editorType: "empty",
|
|
7917
|
+
expectedValueType: "false"
|
|
7805
7918
|
},
|
|
7806
7919
|
{
|
|
7807
7920
|
label: "is not",
|
|
7808
7921
|
value: "neq",
|
|
7809
|
-
editorType: "singleChoice"
|
|
7922
|
+
editorType: "singleChoice",
|
|
7923
|
+
expectedValueType: "single"
|
|
7810
7924
|
},
|
|
7811
7925
|
{
|
|
7812
7926
|
label: "is none of...",
|
|
7813
7927
|
value: "nin",
|
|
7814
|
-
editorType: "multiChoice"
|
|
7928
|
+
editorType: "multiChoice",
|
|
7929
|
+
expectedValueType: "array"
|
|
7815
7930
|
},
|
|
7816
7931
|
{
|
|
7817
7932
|
label: "is not empty",
|
|
7818
7933
|
value: "def",
|
|
7819
|
-
editorType: "empty"
|
|
7934
|
+
editorType: "empty",
|
|
7935
|
+
expectedValueType: "true"
|
|
7820
7936
|
}
|
|
7821
7937
|
];
|
|
7822
7938
|
|
|
7823
|
-
// src/components/SearchAndFilter/
|
|
7824
|
-
import {
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
import {
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7939
|
+
// src/components/SearchAndFilter/editors/DateEditor.tsx
|
|
7940
|
+
import { Input as Input6 } from "@uniformdev/design-system";
|
|
7941
|
+
import { useState as useState19 } from "react";
|
|
7942
|
+
import { useDebounce as useDebounce5 } from "react-use";
|
|
7943
|
+
import { jsx as jsx71 } from "@emotion/react/jsx-runtime";
|
|
7944
|
+
var DateEditor = ({
|
|
7945
|
+
onChange,
|
|
7946
|
+
ariaLabel,
|
|
7947
|
+
disabled,
|
|
7948
|
+
value,
|
|
7949
|
+
readOnly,
|
|
7950
|
+
valueTestId
|
|
7951
|
+
}) => {
|
|
7952
|
+
const [innerValue, setInnerValue] = useState19(value != null ? value : "");
|
|
7953
|
+
useDebounce5(() => onChange(innerValue), 500, [innerValue]);
|
|
7954
|
+
return /* @__PURE__ */ jsx71(
|
|
7955
|
+
Input6,
|
|
7956
|
+
{
|
|
7957
|
+
type: "date",
|
|
7958
|
+
label: ariaLabel,
|
|
7959
|
+
showLabel: false,
|
|
7960
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
7961
|
+
disabled,
|
|
7962
|
+
value: innerValue,
|
|
7963
|
+
readOnly,
|
|
7964
|
+
"data-testid": valueTestId
|
|
7965
|
+
}
|
|
7966
|
+
);
|
|
7967
|
+
};
|
|
7846
7968
|
|
|
7847
|
-
|
|
7848
|
-
|
|
7969
|
+
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
7970
|
+
import { Input as Input7 } from "@uniformdev/design-system";
|
|
7971
|
+
import { useEffect as useEffect21, useState as useState20 } from "react";
|
|
7972
|
+
import { useDebounce as useDebounce6 } from "react-use";
|
|
7849
7973
|
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7974
|
+
// src/components/SearchAndFilter/editors/shared/ErrorContainer.tsx
|
|
7975
|
+
import { FieldMessage } from "@uniformdev/design-system";
|
|
7976
|
+
import { jsx as jsx72 } from "@emotion/react/jsx-runtime";
|
|
7977
|
+
var ErrorContainer = ({ errorMessage }) => {
|
|
7978
|
+
return /* @__PURE__ */ jsx72(
|
|
7979
|
+
"div",
|
|
7980
|
+
{
|
|
7981
|
+
css: {
|
|
7982
|
+
gridColumn: "span 6",
|
|
7983
|
+
order: 6
|
|
7984
|
+
},
|
|
7985
|
+
children: /* @__PURE__ */ jsx72(FieldMessage, { errorMessage })
|
|
7860
7986
|
}
|
|
7861
|
-
|
|
7987
|
+
);
|
|
7988
|
+
};
|
|
7862
7989
|
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7990
|
+
// src/components/SearchAndFilter/editors/shared/twoColumnGrid.tsx
|
|
7991
|
+
var twoColumnGrid = {
|
|
7992
|
+
display: "grid",
|
|
7993
|
+
gridTemplateColumns: "1fr 1fr",
|
|
7994
|
+
gap: "var(--spacing-sm);"
|
|
7995
|
+
};
|
|
7867
7996
|
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7997
|
+
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
7998
|
+
import { Fragment as Fragment15, jsx as jsx73, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
|
|
7999
|
+
var DateRangeEditor = ({
|
|
8000
|
+
ariaLabel,
|
|
8001
|
+
onChange,
|
|
8002
|
+
disabled,
|
|
8003
|
+
value,
|
|
8004
|
+
readOnly,
|
|
8005
|
+
valueTestId
|
|
8006
|
+
}) => {
|
|
8007
|
+
const [minDateValue, setMinDateValue] = useState20(value ? value[0] : "");
|
|
8008
|
+
const [maxDateValue, setMaxDateValue] = useState20(value ? value[1] : "");
|
|
8009
|
+
const [error, setError] = useState20("");
|
|
8010
|
+
useDebounce6(
|
|
8011
|
+
() => {
|
|
8012
|
+
if (minDateValue && maxDateValue && !error) {
|
|
8013
|
+
onChange([minDateValue, maxDateValue]);
|
|
8014
|
+
} else {
|
|
8015
|
+
onChange([]);
|
|
8016
|
+
}
|
|
8017
|
+
},
|
|
8018
|
+
500,
|
|
8019
|
+
[minDateValue, maxDateValue]
|
|
8020
|
+
);
|
|
8021
|
+
useEffect21(() => {
|
|
8022
|
+
if (!minDateValue || !maxDateValue) {
|
|
8023
|
+
return;
|
|
7871
8024
|
}
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
`;
|
|
7878
|
-
var ConditionalInputRow = css38`
|
|
7879
|
-
display: flex;
|
|
7880
|
-
gap: var(--spacing-sm);
|
|
7881
|
-
flex-wrap: wrap;
|
|
7882
|
-
|
|
7883
|
-
${cq("380px")} {
|
|
7884
|
-
& > div:nth-child(-n + 2) {
|
|
7885
|
-
width: calc(50% - var(--spacing-sm));
|
|
8025
|
+
const minDate = new Date(minDateValue);
|
|
8026
|
+
const maxDate = new Date(maxDateValue);
|
|
8027
|
+
if (maxDate < minDate) {
|
|
8028
|
+
setError("The max date cannot be lower than the min date");
|
|
8029
|
+
return;
|
|
7886
8030
|
}
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
8031
|
+
if (maxDate && !minDate) {
|
|
8032
|
+
setError("Please enter both a low and high date");
|
|
8033
|
+
return;
|
|
7890
8034
|
}
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
& > div:nth-child(n) {
|
|
7897
|
-
width: auto;
|
|
8035
|
+
const minDateString = minDate.toDateString();
|
|
8036
|
+
const maxDateString = maxDate.toDateString();
|
|
8037
|
+
if (minDateString === maxDateString || maxDateString === minDateString) {
|
|
8038
|
+
setError("The min and max date cannot be the same");
|
|
8039
|
+
return;
|
|
7898
8040
|
}
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
max-height: 40px;
|
|
7903
|
-
min-height: unset;
|
|
7904
|
-
`;
|
|
7905
|
-
var BindableKeywordSearchInputStyles = css38`
|
|
7906
|
-
position: relative;
|
|
7907
|
-
width: 100%;
|
|
7908
|
-
|
|
7909
|
-
& [data-lexical-editor='true'] {
|
|
7910
|
-
padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
7911
|
-
font-size: var(--fs-sm);
|
|
7912
|
-
border-radius: var(--rounded-full);
|
|
7913
|
-
max-height: 40px;
|
|
7914
|
-
min-height: unset;
|
|
7915
|
-
width: 100%;
|
|
7916
|
-
position: relative;
|
|
7917
|
-
white-space: nowrap;
|
|
7918
|
-
}
|
|
7919
|
-
`;
|
|
7920
|
-
var ClearSearchButtonContainer = css38`
|
|
7921
|
-
align-items: center;
|
|
7922
|
-
display: flex;
|
|
7923
|
-
position: absolute;
|
|
7924
|
-
inset: 0 var(--spacing-lg) 0 auto;
|
|
7925
|
-
`;
|
|
7926
|
-
var ClearSearchButtonStyles = css38`
|
|
7927
|
-
background: none;
|
|
7928
|
-
border: none;
|
|
7929
|
-
padding: 0;
|
|
7930
|
-
pointer-events: all;
|
|
7931
|
-
`;
|
|
7932
|
-
var FilterButton = css38`
|
|
7933
|
-
align-items: center;
|
|
7934
|
-
background: var(--white);
|
|
7935
|
-
border: 1px solid var(--gray-300);
|
|
7936
|
-
border-radius: var(--rounded-full);
|
|
7937
|
-
color: var(--typography-base);
|
|
7938
|
-
display: flex;
|
|
7939
|
-
font-size: var(--fs-sm);
|
|
7940
|
-
gap: var(--spacing-sm);
|
|
7941
|
-
padding: var(--spacing-sm) var(--spacing-base);
|
|
7942
|
-
max-height: 40px;
|
|
7943
|
-
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
7944
|
-
background-color var(--duration-fast) var(--timing-ease-out),
|
|
7945
|
-
border-color var(--duration-fast) var(--timing-ease-out),
|
|
7946
|
-
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
7947
|
-
|
|
7948
|
-
svg {
|
|
7949
|
-
color: var(--gray-300);
|
|
7950
|
-
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7951
|
-
}
|
|
7952
|
-
|
|
7953
|
-
&:hover,
|
|
7954
|
-
:where([aria-expanded='true']) {
|
|
7955
|
-
outline: none;
|
|
7956
|
-
background: var(--gray-200);
|
|
7957
|
-
border-color: var(--gray-300);
|
|
7958
|
-
|
|
7959
|
-
svg {
|
|
7960
|
-
color: var(--typography-base);
|
|
8041
|
+
if (minDate > maxDate) {
|
|
8042
|
+
setError("The min date cannot be higher than the max date");
|
|
8043
|
+
return;
|
|
7961
8044
|
}
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
&:disabled {
|
|
7965
|
-
opacity: var(--opacity-50);
|
|
7966
|
-
}
|
|
7967
|
-
`;
|
|
7968
|
-
var FilterButtonText = css38`
|
|
7969
|
-
overflow: hidden;
|
|
7970
|
-
text-overflow: ellipsis;
|
|
7971
|
-
white-space: nowrap;
|
|
7972
|
-
max-width: 14ch;
|
|
7973
|
-
`;
|
|
7974
|
-
var FilterButtonSelected = css38`
|
|
7975
|
-
background: var(--gray-100);
|
|
7976
|
-
border-color: var(--gray-300);
|
|
7977
|
-
|
|
7978
|
-
svg {
|
|
7979
|
-
color: var(--accent-dark);
|
|
7980
|
-
}
|
|
7981
|
-
`;
|
|
7982
|
-
var FilterButtonWithOptions = css38`
|
|
7983
|
-
:where([aria-expanded='true']) {
|
|
7984
|
-
background: var(--purple-rain-100);
|
|
7985
|
-
border-color: var(--accent-light);
|
|
7986
|
-
color: var(--typography-base);
|
|
7987
|
-
box-shadow: var(--elevation-100);
|
|
7988
|
-
|
|
7989
|
-
svg {
|
|
7990
|
-
color: var(--accent-dark);
|
|
8045
|
+
if (error) {
|
|
8046
|
+
setError("");
|
|
7991
8047
|
}
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8048
|
+
if (minDate && maxDate) {
|
|
8049
|
+
setMinDateValue(minDateValue);
|
|
8050
|
+
setMaxDateValue(maxDateValue);
|
|
8051
|
+
} else {
|
|
8052
|
+
setMinDateValue("");
|
|
8053
|
+
setMaxDateValue("");
|
|
8054
|
+
}
|
|
8055
|
+
}, [minDateValue, maxDateValue, setError]);
|
|
8056
|
+
return /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
8057
|
+
/* @__PURE__ */ jsxs42("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8058
|
+
/* @__PURE__ */ jsx73(
|
|
8059
|
+
Input7,
|
|
8060
|
+
{
|
|
8061
|
+
label: `${ariaLabel}-min-date`,
|
|
8062
|
+
type: "date",
|
|
8063
|
+
showLabel: false,
|
|
8064
|
+
value: minDateValue,
|
|
8065
|
+
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
8066
|
+
"aria-invalid": !error ? false : true,
|
|
8067
|
+
disabled,
|
|
8068
|
+
readOnly,
|
|
8069
|
+
"data-testid": "value-low"
|
|
8070
|
+
}
|
|
8071
|
+
),
|
|
8072
|
+
/* @__PURE__ */ jsx73(
|
|
8073
|
+
Input7,
|
|
8074
|
+
{
|
|
8075
|
+
label: `${ariaLabel}-max-date`,
|
|
8076
|
+
type: "date",
|
|
8077
|
+
showLabel: false,
|
|
8078
|
+
value: maxDateValue,
|
|
8079
|
+
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
8080
|
+
"aria-invalid": !error ? false : true,
|
|
8081
|
+
disabled,
|
|
8082
|
+
readOnly,
|
|
8083
|
+
"data-testid": "value-high"
|
|
8084
|
+
}
|
|
8085
|
+
)
|
|
8086
|
+
] }),
|
|
8087
|
+
/* @__PURE__ */ jsx73(ErrorContainer, { errorMessage: error })
|
|
8088
|
+
] });
|
|
8089
|
+
};
|
|
8010
8090
|
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8091
|
+
// src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
|
|
8092
|
+
import {
|
|
8093
|
+
convertComboBoxGroupsToSelectableGroups,
|
|
8094
|
+
getComboBoxSelectedSelectableGroups,
|
|
8095
|
+
InputComboBox
|
|
8096
|
+
} from "@uniformdev/design-system";
|
|
8097
|
+
import { useMemo as useMemo18 } from "react";
|
|
8015
8098
|
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8099
|
+
// src/components/SearchAndFilter/editors/shared/readOnlyAttributes.tsx
|
|
8100
|
+
var readOnlyAttributes = {
|
|
8101
|
+
isSearchable: false,
|
|
8102
|
+
menuIsOpen: false,
|
|
8103
|
+
isClearable: false
|
|
8104
|
+
};
|
|
8022
8105
|
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
}
|
|
8026
|
-
`;
|
|
8027
|
-
var ResetConditionsBtn = css38`
|
|
8028
|
-
background: transparent;
|
|
8029
|
-
border: none;
|
|
8030
|
-
color: var(--action-destructive-default);
|
|
8031
|
-
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8032
|
-
padding: 0;
|
|
8033
|
-
|
|
8034
|
-
&:hover,
|
|
8035
|
-
&:focus {
|
|
8036
|
-
color: var(--action-destructive-hover);
|
|
8037
|
-
}
|
|
8038
|
-
`;
|
|
8039
|
-
var IconBtn = css38`
|
|
8040
|
-
background: transparent;
|
|
8041
|
-
border: none;
|
|
8042
|
-
padding: var(--spacing-sm);
|
|
8043
|
-
`;
|
|
8044
|
-
var SearchAndFilterOptionsContainer = css38`
|
|
8045
|
-
background: var(--gray-50);
|
|
8046
|
-
border: 1px solid var(--gray-300);
|
|
8047
|
-
border-radius: var(--rounded-base);
|
|
8048
|
-
container-type: inline-size;
|
|
8049
|
-
display: flex;
|
|
8050
|
-
flex-direction: column;
|
|
8051
|
-
gap: var(--spacing-sm);
|
|
8052
|
-
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
8053
|
-
will-change: height;
|
|
8054
|
-
position: relative;
|
|
8055
|
-
z-index: 1;
|
|
8056
|
-
`;
|
|
8057
|
-
var SearchAndFilterOptionsInnerContainer = css38`
|
|
8058
|
-
display: flex;
|
|
8059
|
-
flex-direction: column;
|
|
8060
|
-
gap: var(--spacing-sm);
|
|
8061
|
-
padding-inline: var(--spacing-md);
|
|
8062
|
-
`;
|
|
8063
|
-
var SearchAndFilterButtonGroup = css38`
|
|
8064
|
-
margin-top: var(--spacing-xs);
|
|
8065
|
-
margin-left: calc(56px + var(--spacing-md));
|
|
8066
|
-
`;
|
|
8067
|
-
|
|
8068
|
-
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8069
|
-
import { jsx as jsx71, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
|
|
8070
|
-
var FilterButton2 = ({
|
|
8071
|
-
text = "Filters",
|
|
8072
|
-
icon = "filter-add",
|
|
8073
|
-
filterCount,
|
|
8074
|
-
hasSelectedValue,
|
|
8075
|
-
dataTestId,
|
|
8076
|
-
...props
|
|
8077
|
-
}) => {
|
|
8078
|
-
return /* @__PURE__ */ jsxs42(
|
|
8079
|
-
"button",
|
|
8080
|
-
{
|
|
8081
|
-
type: "button",
|
|
8082
|
-
css: [
|
|
8083
|
-
FilterButton,
|
|
8084
|
-
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
8085
|
-
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
8086
|
-
],
|
|
8087
|
-
...props,
|
|
8088
|
-
"data-testid": dataTestId,
|
|
8089
|
-
children: [
|
|
8090
|
-
/* @__PURE__ */ jsx71(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
8091
|
-
/* @__PURE__ */ jsx71("span", { css: FilterButtonText, children: text }),
|
|
8092
|
-
filterCount ? /* @__PURE__ */ jsx71(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
8093
|
-
]
|
|
8094
|
-
}
|
|
8095
|
-
);
|
|
8096
|
-
};
|
|
8097
|
-
|
|
8098
|
-
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8099
|
-
import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
|
|
8100
|
-
import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
8101
|
-
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
8102
|
-
import { useEffect as useEffect23, useRef as useRef18, useState as useState21 } from "react";
|
|
8103
|
-
import { useDebounce as useDebounce6 } from "react-use";
|
|
8104
|
-
import { v4 as v43 } from "uuid";
|
|
8105
|
-
|
|
8106
|
-
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8107
|
-
import { VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
8108
|
-
import {
|
|
8109
|
-
createContext as createContext7,
|
|
8110
|
-
useCallback as useCallback7,
|
|
8111
|
-
useContext as useContext9,
|
|
8112
|
-
useDeferredValue as useDeferredValue3,
|
|
8113
|
-
useEffect as useEffect22,
|
|
8114
|
-
useMemo as useMemo18,
|
|
8115
|
-
useState as useState20
|
|
8116
|
-
} from "react";
|
|
8117
|
-
|
|
8118
|
-
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
8119
|
-
import { FieldMessage, Input as Input6, InputComboBox, StatusBullet } from "@uniformdev/design-system";
|
|
8120
|
-
import { useEffect as useEffect21, useState as useState19 } from "react";
|
|
8121
|
-
import { useDebounce as useDebounce5 } from "react-use";
|
|
8122
|
-
import { Fragment as Fragment15, jsx as jsx72, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
|
|
8123
|
-
var readOnlyAttributes = {
|
|
8124
|
-
isSearchable: false,
|
|
8125
|
-
menuIsOpen: false,
|
|
8126
|
-
isClearable: false
|
|
8127
|
-
};
|
|
8106
|
+
// src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
|
|
8107
|
+
import { jsx as jsx74 } from "@emotion/react/jsx-runtime";
|
|
8128
8108
|
var FilterMultiChoiceEditor = ({
|
|
8129
8109
|
value,
|
|
8130
8110
|
options,
|
|
@@ -8135,20 +8115,24 @@ var FilterMultiChoiceEditor = ({
|
|
|
8135
8115
|
}) => {
|
|
8136
8116
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8137
8117
|
const isClearable = !readOnly || !disabled;
|
|
8138
|
-
|
|
8118
|
+
const { groupedOptions, selectedOptions } = useMemo18(
|
|
8119
|
+
() => convertComboBoxGroupsToSelectableGroups({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
8120
|
+
[options, value]
|
|
8121
|
+
);
|
|
8122
|
+
return /* @__PURE__ */ jsx74("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx74(
|
|
8139
8123
|
InputComboBox,
|
|
8140
8124
|
{
|
|
8141
8125
|
...props,
|
|
8142
8126
|
placeholder: "Type to search...",
|
|
8143
|
-
options,
|
|
8127
|
+
options: groupedOptions,
|
|
8144
8128
|
isMulti: true,
|
|
8145
8129
|
isClearable,
|
|
8146
8130
|
isDisabled: disabled,
|
|
8147
8131
|
onChange: (e) => {
|
|
8148
|
-
|
|
8149
|
-
return props.onChange(
|
|
8132
|
+
const selectedValues = getComboBoxSelectedSelectableGroups(e);
|
|
8133
|
+
return props.onChange([...selectedValues]);
|
|
8150
8134
|
},
|
|
8151
|
-
value:
|
|
8135
|
+
value: selectedOptions,
|
|
8152
8136
|
"aria-readonly": readOnly,
|
|
8153
8137
|
styles: {
|
|
8154
8138
|
menu(base) {
|
|
@@ -8162,6 +8146,14 @@ var FilterMultiChoiceEditor = ({
|
|
|
8162
8146
|
}
|
|
8163
8147
|
) });
|
|
8164
8148
|
};
|
|
8149
|
+
|
|
8150
|
+
// src/components/SearchAndFilter/editors/FilterSingleChoiceEditor.tsx
|
|
8151
|
+
import {
|
|
8152
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups2,
|
|
8153
|
+
InputComboBox as InputComboBox2
|
|
8154
|
+
} from "@uniformdev/design-system";
|
|
8155
|
+
import { useMemo as useMemo19 } from "react";
|
|
8156
|
+
import { jsx as jsx75 } from "@emotion/react/jsx-runtime";
|
|
8165
8157
|
var FilterSingleChoiceEditor = ({
|
|
8166
8158
|
options,
|
|
8167
8159
|
value,
|
|
@@ -8170,91 +8162,30 @@ var FilterSingleChoiceEditor = ({
|
|
|
8170
8162
|
onChange,
|
|
8171
8163
|
valueTestId
|
|
8172
8164
|
}) => {
|
|
8173
|
-
var _a;
|
|
8174
8165
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8175
|
-
|
|
8176
|
-
|
|
8166
|
+
const { groupedOptions, selectedOptions } = useMemo19(
|
|
8167
|
+
() => convertComboBoxGroupsToSelectableGroups2({
|
|
8168
|
+
options: options != null ? options : [],
|
|
8169
|
+
selectedItems: new Set(value ? [value] : void 0),
|
|
8170
|
+
selectionMode: "single"
|
|
8171
|
+
}),
|
|
8172
|
+
[options, value]
|
|
8173
|
+
);
|
|
8174
|
+
return /* @__PURE__ */ jsx75("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx75(
|
|
8175
|
+
InputComboBox2,
|
|
8177
8176
|
{
|
|
8178
8177
|
placeholder: "Type to search...",
|
|
8179
|
-
options,
|
|
8178
|
+
options: groupedOptions,
|
|
8180
8179
|
isClearable: true,
|
|
8181
8180
|
onChange: (e) => {
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
},
|
|
8185
|
-
isDisabled: disabled,
|
|
8186
|
-
value: (_a = options == null ? void 0 : options.find((option) => option.value === value)) != null ? _a : null,
|
|
8187
|
-
"aria-readonly": readOnly,
|
|
8188
|
-
styles: {
|
|
8189
|
-
menu(base) {
|
|
8190
|
-
return {
|
|
8191
|
-
...base,
|
|
8192
|
-
minWidth: "max-content"
|
|
8193
|
-
};
|
|
8181
|
+
if (Array.isArray(e == null ? void 0 : e.value)) {
|
|
8182
|
+
return;
|
|
8194
8183
|
}
|
|
8184
|
+
return onChange(e == null ? void 0 : e.value);
|
|
8195
8185
|
},
|
|
8196
|
-
...readOnlyProps
|
|
8197
|
-
}
|
|
8198
|
-
) });
|
|
8199
|
-
};
|
|
8200
|
-
var CustomOptions = ({ label, value }) => {
|
|
8201
|
-
return /* @__PURE__ */ jsx72(StatusBullet, { status: label, message: value });
|
|
8202
|
-
};
|
|
8203
|
-
var StatusMultiEditor = ({
|
|
8204
|
-
options,
|
|
8205
|
-
value,
|
|
8206
|
-
disabled,
|
|
8207
|
-
readOnly,
|
|
8208
|
-
onChange,
|
|
8209
|
-
valueTestId
|
|
8210
|
-
}) => {
|
|
8211
|
-
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8212
|
-
return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
|
|
8213
|
-
InputComboBox,
|
|
8214
|
-
{
|
|
8215
|
-
options,
|
|
8216
|
-
isMulti: true,
|
|
8217
|
-
onChange: (e) => {
|
|
8218
|
-
var _a;
|
|
8219
|
-
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
8220
|
-
},
|
|
8221
|
-
formatOptionLabel: CustomOptions,
|
|
8222
|
-
"aria-readonly": readOnly,
|
|
8223
|
-
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
8224
8186
|
isDisabled: disabled,
|
|
8225
|
-
|
|
8226
|
-
menu(base) {
|
|
8227
|
-
return {
|
|
8228
|
-
...base,
|
|
8229
|
-
minWidth: "max-content"
|
|
8230
|
-
};
|
|
8231
|
-
}
|
|
8232
|
-
},
|
|
8233
|
-
...readOnlyProps
|
|
8234
|
-
}
|
|
8235
|
-
) });
|
|
8236
|
-
};
|
|
8237
|
-
var StatusSingleEditor = ({
|
|
8238
|
-
options,
|
|
8239
|
-
value,
|
|
8240
|
-
disabled,
|
|
8241
|
-
readOnly,
|
|
8242
|
-
onChange,
|
|
8243
|
-
valueTestId
|
|
8244
|
-
}) => {
|
|
8245
|
-
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8246
|
-
return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
|
|
8247
|
-
InputComboBox,
|
|
8248
|
-
{
|
|
8249
|
-
options,
|
|
8250
|
-
onChange: (e) => {
|
|
8251
|
-
var _a;
|
|
8252
|
-
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
8253
|
-
},
|
|
8254
|
-
formatOptionLabel: CustomOptions,
|
|
8187
|
+
value: selectedOptions,
|
|
8255
8188
|
"aria-readonly": readOnly,
|
|
8256
|
-
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
8257
|
-
isDisabled: disabled,
|
|
8258
8189
|
styles: {
|
|
8259
8190
|
menu(base) {
|
|
8260
8191
|
return {
|
|
@@ -8267,28 +8198,43 @@ var StatusSingleEditor = ({
|
|
|
8267
8198
|
}
|
|
8268
8199
|
) });
|
|
8269
8200
|
};
|
|
8270
|
-
|
|
8271
|
-
|
|
8201
|
+
|
|
8202
|
+
// src/components/SearchAndFilter/editors/NumberEditor.tsx
|
|
8203
|
+
import { Input as Input8 } from "@uniformdev/design-system";
|
|
8204
|
+
import { useState as useState21 } from "react";
|
|
8205
|
+
import { useDebounce as useDebounce7 } from "react-use";
|
|
8206
|
+
import { jsx as jsx76 } from "@emotion/react/jsx-runtime";
|
|
8207
|
+
var NumberEditor = ({
|
|
8272
8208
|
ariaLabel,
|
|
8209
|
+
onChange,
|
|
8210
|
+
disabled,
|
|
8273
8211
|
value,
|
|
8274
8212
|
readOnly,
|
|
8275
8213
|
valueTestId
|
|
8276
8214
|
}) => {
|
|
8277
|
-
const [innerValue, setInnerValue] =
|
|
8278
|
-
|
|
8279
|
-
return /* @__PURE__ */
|
|
8280
|
-
|
|
8215
|
+
const [innerValue, setInnerValue] = useState21(value != null ? value : "");
|
|
8216
|
+
useDebounce7(() => onChange(innerValue), 500, [innerValue]);
|
|
8217
|
+
return /* @__PURE__ */ jsx76(
|
|
8218
|
+
Input8,
|
|
8281
8219
|
{
|
|
8282
|
-
showLabel: false,
|
|
8283
8220
|
label: ariaLabel,
|
|
8221
|
+
type: "number",
|
|
8222
|
+
showLabel: false,
|
|
8223
|
+
min: 0,
|
|
8284
8224
|
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8285
|
-
|
|
8225
|
+
disabled,
|
|
8286
8226
|
value: innerValue,
|
|
8287
8227
|
readOnly,
|
|
8288
8228
|
"data-testid": valueTestId
|
|
8289
8229
|
}
|
|
8290
8230
|
);
|
|
8291
8231
|
};
|
|
8232
|
+
|
|
8233
|
+
// src/components/SearchAndFilter/editors/NumberRangeEditor.tsx
|
|
8234
|
+
import { Input as Input9 } from "@uniformdev/design-system";
|
|
8235
|
+
import { useEffect as useEffect22, useState as useState22 } from "react";
|
|
8236
|
+
import { useDebounce as useDebounce8 } from "react-use";
|
|
8237
|
+
import { Fragment as Fragment16, jsx as jsx77, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
|
|
8292
8238
|
var NumberRangeEditor = ({
|
|
8293
8239
|
onChange,
|
|
8294
8240
|
disabled,
|
|
@@ -8297,10 +8243,10 @@ var NumberRangeEditor = ({
|
|
|
8297
8243
|
readOnly,
|
|
8298
8244
|
valueTestId
|
|
8299
8245
|
}) => {
|
|
8300
|
-
const [minValue, setMinValue] =
|
|
8301
|
-
const [maxValue, setMaxValue] =
|
|
8302
|
-
const [error, setError] =
|
|
8303
|
-
|
|
8246
|
+
const [minValue, setMinValue] = useState22("");
|
|
8247
|
+
const [maxValue, setMaxValue] = useState22("");
|
|
8248
|
+
const [error, setError] = useState22("");
|
|
8249
|
+
useDebounce8(
|
|
8304
8250
|
() => {
|
|
8305
8251
|
if (minValue && maxValue && !error) {
|
|
8306
8252
|
onChange([minValue, maxValue]);
|
|
@@ -8311,7 +8257,7 @@ var NumberRangeEditor = ({
|
|
|
8311
8257
|
500,
|
|
8312
8258
|
[minValue, maxValue]
|
|
8313
8259
|
);
|
|
8314
|
-
|
|
8260
|
+
useEffect22(() => {
|
|
8315
8261
|
if (!maxValue && !minValue) {
|
|
8316
8262
|
return;
|
|
8317
8263
|
}
|
|
@@ -8333,10 +8279,10 @@ var NumberRangeEditor = ({
|
|
|
8333
8279
|
setMaxValue(maxValue);
|
|
8334
8280
|
}
|
|
8335
8281
|
}, [maxValue, minValue, setError]);
|
|
8336
|
-
return /* @__PURE__ */ jsxs43(
|
|
8282
|
+
return /* @__PURE__ */ jsxs43(Fragment16, { children: [
|
|
8337
8283
|
/* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8338
|
-
/* @__PURE__ */
|
|
8339
|
-
|
|
8284
|
+
/* @__PURE__ */ jsx77(
|
|
8285
|
+
Input9,
|
|
8340
8286
|
{
|
|
8341
8287
|
label: `${ariaLabel}-min`,
|
|
8342
8288
|
type: "number",
|
|
@@ -8351,8 +8297,8 @@ var NumberRangeEditor = ({
|
|
|
8351
8297
|
"data-testid": "value-low"
|
|
8352
8298
|
}
|
|
8353
8299
|
),
|
|
8354
|
-
/* @__PURE__ */
|
|
8355
|
-
|
|
8300
|
+
/* @__PURE__ */ jsx77(
|
|
8301
|
+
Input9,
|
|
8356
8302
|
{
|
|
8357
8303
|
type: "number",
|
|
8358
8304
|
label: `${ariaLabel}-max`,
|
|
@@ -8368,159 +8314,513 @@ var NumberRangeEditor = ({
|
|
|
8368
8314
|
}
|
|
8369
8315
|
)
|
|
8370
8316
|
] }),
|
|
8371
|
-
/* @__PURE__ */
|
|
8317
|
+
/* @__PURE__ */ jsx77(ErrorContainer, { errorMessage: error })
|
|
8372
8318
|
] });
|
|
8373
8319
|
};
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
}
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8320
|
+
|
|
8321
|
+
// src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
|
|
8322
|
+
import {
|
|
8323
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups3,
|
|
8324
|
+
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups2,
|
|
8325
|
+
InputComboBox as InputComboBox3
|
|
8326
|
+
} from "@uniformdev/design-system";
|
|
8327
|
+
import { useMemo as useMemo20 } from "react";
|
|
8328
|
+
|
|
8329
|
+
// src/components/SearchAndFilter/editors/shared/CustomOptions.tsx
|
|
8330
|
+
import { StatusBullet } from "@uniformdev/design-system";
|
|
8331
|
+
import { jsx as jsx78 } from "@emotion/react/jsx-runtime";
|
|
8332
|
+
var CustomOptions = ({ label, value }) => {
|
|
8333
|
+
return /* @__PURE__ */ jsx78(
|
|
8334
|
+
StatusBullet,
|
|
8386
8335
|
{
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
showLabel: false,
|
|
8390
|
-
min: 0,
|
|
8391
|
-
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8392
|
-
disabled,
|
|
8393
|
-
value: innerValue,
|
|
8394
|
-
readOnly,
|
|
8395
|
-
"data-testid": valueTestId
|
|
8336
|
+
status: label,
|
|
8337
|
+
message: Array.isArray(value) ? value.join(",") : value
|
|
8396
8338
|
}
|
|
8397
8339
|
);
|
|
8398
8340
|
};
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8341
|
+
|
|
8342
|
+
// src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
|
|
8343
|
+
import { jsx as jsx79 } from "@emotion/react/jsx-runtime";
|
|
8344
|
+
var StatusMultiEditor = ({
|
|
8345
|
+
options,
|
|
8403
8346
|
value,
|
|
8347
|
+
disabled,
|
|
8404
8348
|
readOnly,
|
|
8349
|
+
onChange,
|
|
8405
8350
|
valueTestId
|
|
8406
8351
|
}) => {
|
|
8407
|
-
const
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8352
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8353
|
+
const { groupedOptions, selectedOptions } = useMemo20(
|
|
8354
|
+
() => convertComboBoxGroupsToSelectableGroups3({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
8355
|
+
[options, value]
|
|
8356
|
+
);
|
|
8357
|
+
return /* @__PURE__ */ jsx79("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx79(
|
|
8358
|
+
InputComboBox3,
|
|
8411
8359
|
{
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
"
|
|
8360
|
+
options: groupedOptions != null ? groupedOptions : [],
|
|
8361
|
+
isMulti: true,
|
|
8362
|
+
onChange: (e) => {
|
|
8363
|
+
const selectedValues = getComboBoxSelectedSelectableGroups2(e);
|
|
8364
|
+
return onChange([...selectedValues]);
|
|
8365
|
+
},
|
|
8366
|
+
formatOptionLabel: CustomOptions,
|
|
8367
|
+
"aria-readonly": readOnly,
|
|
8368
|
+
value: selectedOptions,
|
|
8369
|
+
isDisabled: disabled,
|
|
8370
|
+
styles: {
|
|
8371
|
+
menu(base) {
|
|
8372
|
+
return {
|
|
8373
|
+
...base,
|
|
8374
|
+
minWidth: "max-content"
|
|
8375
|
+
};
|
|
8376
|
+
}
|
|
8377
|
+
},
|
|
8378
|
+
...readOnlyProps
|
|
8420
8379
|
}
|
|
8421
|
-
);
|
|
8380
|
+
) });
|
|
8422
8381
|
};
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8382
|
+
|
|
8383
|
+
// src/components/SearchAndFilter/editors/StatusSingleEditor.tsx
|
|
8384
|
+
import {
|
|
8385
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups4,
|
|
8386
|
+
InputComboBox as InputComboBox4
|
|
8387
|
+
} from "@uniformdev/design-system";
|
|
8388
|
+
import { useMemo as useMemo21 } from "react";
|
|
8389
|
+
import { jsx as jsx80 } from "@emotion/react/jsx-runtime";
|
|
8390
|
+
var StatusSingleEditor = ({
|
|
8391
|
+
options,
|
|
8427
8392
|
value,
|
|
8393
|
+
disabled,
|
|
8428
8394
|
readOnly,
|
|
8395
|
+
onChange,
|
|
8429
8396
|
valueTestId
|
|
8430
8397
|
}) => {
|
|
8431
|
-
const
|
|
8432
|
-
const
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
onChange([]);
|
|
8440
|
-
}
|
|
8441
|
-
},
|
|
8442
|
-
500,
|
|
8443
|
-
[minDateValue, maxDateValue]
|
|
8398
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8399
|
+
const { groupedOptions, selectedOptions } = useMemo21(
|
|
8400
|
+
() => convertComboBoxGroupsToSelectableGroups4({
|
|
8401
|
+
options: options != null ? options : [],
|
|
8402
|
+
selectedItems: new Set(value ? [value] : void 0),
|
|
8403
|
+
selectionMode: "single"
|
|
8404
|
+
}),
|
|
8405
|
+
[options, value]
|
|
8444
8406
|
);
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8407
|
+
return /* @__PURE__ */ jsx80("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx80(
|
|
8408
|
+
InputComboBox4,
|
|
8409
|
+
{
|
|
8410
|
+
options: groupedOptions,
|
|
8411
|
+
onChange: (e) => {
|
|
8412
|
+
if (Array.isArray(e == null ? void 0 : e.value)) {
|
|
8413
|
+
return;
|
|
8414
|
+
}
|
|
8415
|
+
return onChange(e == null ? void 0 : e.value);
|
|
8416
|
+
},
|
|
8417
|
+
formatOptionLabel: CustomOptions,
|
|
8418
|
+
"aria-readonly": readOnly,
|
|
8419
|
+
value: selectedOptions,
|
|
8420
|
+
isDisabled: disabled,
|
|
8421
|
+
styles: {
|
|
8422
|
+
menu(base) {
|
|
8423
|
+
return {
|
|
8424
|
+
...base,
|
|
8425
|
+
minWidth: "max-content"
|
|
8426
|
+
};
|
|
8427
|
+
}
|
|
8428
|
+
},
|
|
8429
|
+
...readOnlyProps
|
|
8448
8430
|
}
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8431
|
+
) });
|
|
8432
|
+
};
|
|
8433
|
+
|
|
8434
|
+
// src/components/SearchAndFilter/editors/TextEditor.tsx
|
|
8435
|
+
import { Input as Input10 } from "@uniformdev/design-system";
|
|
8436
|
+
import { useState as useState23 } from "react";
|
|
8437
|
+
import { useDebounce as useDebounce9 } from "react-use";
|
|
8438
|
+
import { jsx as jsx81 } from "@emotion/react/jsx-runtime";
|
|
8439
|
+
var TextEditor = ({
|
|
8440
|
+
onChange,
|
|
8441
|
+
ariaLabel,
|
|
8442
|
+
value,
|
|
8443
|
+
readOnly,
|
|
8444
|
+
valueTestId
|
|
8445
|
+
}) => {
|
|
8446
|
+
const [innerValue, setInnerValue] = useState23(value != null ? value : "");
|
|
8447
|
+
useDebounce9(() => onChange(innerValue), 500, [innerValue]);
|
|
8448
|
+
return /* @__PURE__ */ jsx81(
|
|
8449
|
+
Input10,
|
|
8450
|
+
{
|
|
8451
|
+
showLabel: false,
|
|
8452
|
+
label: ariaLabel,
|
|
8453
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8454
|
+
placeholder: "Enter phrase to search\u2026",
|
|
8455
|
+
value: innerValue,
|
|
8456
|
+
readOnly,
|
|
8457
|
+
"data-testid": valueTestId
|
|
8454
8458
|
}
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8459
|
+
);
|
|
8460
|
+
};
|
|
8461
|
+
|
|
8462
|
+
// src/components/SearchAndFilter/editors/TextMultiChoiceEditor.tsx
|
|
8463
|
+
import {
|
|
8464
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups5,
|
|
8465
|
+
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups3,
|
|
8466
|
+
InputCreatableComboBox
|
|
8467
|
+
} from "@uniformdev/design-system";
|
|
8468
|
+
import { useMemo as useMemo22 } from "react";
|
|
8469
|
+
import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
|
|
8470
|
+
var TextMultiChoiceEditor = ({
|
|
8471
|
+
value,
|
|
8472
|
+
disabled,
|
|
8473
|
+
readOnly,
|
|
8474
|
+
valueTestId,
|
|
8475
|
+
...props
|
|
8476
|
+
}) => {
|
|
8477
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8478
|
+
const isClearable = !readOnly || !disabled;
|
|
8479
|
+
const { groupedOptions, selectedOptions } = useMemo22(() => {
|
|
8480
|
+
var _a;
|
|
8481
|
+
const coercedValue = typeof value === "string" ? [value] : value != null ? value : [];
|
|
8482
|
+
const options = (_a = coercedValue.map((v) => ({ label: v, value: v }))) != null ? _a : [];
|
|
8483
|
+
return convertComboBoxGroupsToSelectableGroups5({ options, selectedItems: new Set(value) });
|
|
8484
|
+
}, [value]);
|
|
8485
|
+
return /* @__PURE__ */ jsx82("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx82(
|
|
8486
|
+
InputCreatableComboBox,
|
|
8487
|
+
{
|
|
8488
|
+
...props,
|
|
8489
|
+
placeholder: "Type a value\u2026",
|
|
8490
|
+
noOptionsMessage: () => "Type to create a new value",
|
|
8491
|
+
options: groupedOptions,
|
|
8492
|
+
isMulti: true,
|
|
8493
|
+
isClearable,
|
|
8494
|
+
isDisabled: disabled,
|
|
8495
|
+
onChange: (e) => {
|
|
8496
|
+
const selectedValues = getComboBoxSelectedSelectableGroups3(e);
|
|
8497
|
+
return props.onChange([...selectedValues]);
|
|
8498
|
+
},
|
|
8499
|
+
value: selectedOptions,
|
|
8500
|
+
"aria-readonly": readOnly,
|
|
8501
|
+
styles: {
|
|
8502
|
+
menu(base) {
|
|
8503
|
+
return {
|
|
8504
|
+
...base,
|
|
8505
|
+
minWidth: "max-content"
|
|
8506
|
+
};
|
|
8507
|
+
}
|
|
8508
|
+
},
|
|
8509
|
+
...readOnlyProps
|
|
8458
8510
|
}
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8511
|
+
) });
|
|
8512
|
+
};
|
|
8513
|
+
|
|
8514
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8515
|
+
import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
|
|
8516
|
+
|
|
8517
|
+
// src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
|
|
8518
|
+
import { css as css38 } from "@emotion/react";
|
|
8519
|
+
import { cq, fadeInLtr } from "@uniformdev/design-system";
|
|
8520
|
+
var SearchAndFilterControlsWrapper = (gridColumns) => css38`
|
|
8521
|
+
align-items: stretch;
|
|
8522
|
+
display: grid;
|
|
8523
|
+
grid-template-columns: ${gridColumns};
|
|
8524
|
+
gap: var(--spacing-sm);
|
|
8525
|
+
`;
|
|
8526
|
+
var SearchAndFilterOutterControlWrapper = (gridColumns) => css38`
|
|
8527
|
+
align-items: stretch;
|
|
8528
|
+
display: grid;
|
|
8529
|
+
grid-template-columns: ${gridColumns};
|
|
8530
|
+
gap: var(--spacing-sm);
|
|
8531
|
+
`;
|
|
8532
|
+
var ConditionalFilterRow = css38`
|
|
8533
|
+
align-items: baseline;
|
|
8534
|
+
display: grid;
|
|
8535
|
+
grid-template-columns: 35px 1fr;
|
|
8536
|
+
gap: var(--spacing-sm);
|
|
8537
|
+
margin-left: var(--spacing-base);
|
|
8538
|
+
|
|
8539
|
+
${cq("380px")} {
|
|
8540
|
+
&:after {
|
|
8541
|
+
content: '';
|
|
8542
|
+
display: block;
|
|
8543
|
+
height: 1px;
|
|
8544
|
+
background: var(--gray-300);
|
|
8545
|
+
width: calc(100% - var(--spacing-base));
|
|
8546
|
+
margin-left: var(--spacing-base);
|
|
8464
8547
|
}
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
return;
|
|
8548
|
+
&:last-of-type:after {
|
|
8549
|
+
display: none;
|
|
8468
8550
|
}
|
|
8469
|
-
|
|
8470
|
-
|
|
8551
|
+
}
|
|
8552
|
+
|
|
8553
|
+
&:nth-of-type(2) {
|
|
8554
|
+
margin-left: 0;
|
|
8555
|
+
grid-template-columns: 50px 1fr;
|
|
8556
|
+
}
|
|
8557
|
+
|
|
8558
|
+
${cq("580px")} {
|
|
8559
|
+
&:after {
|
|
8560
|
+
display: none;
|
|
8471
8561
|
}
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
}
|
|
8476
|
-
|
|
8477
|
-
|
|
8562
|
+
}
|
|
8563
|
+
|
|
8564
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
8565
|
+
animation: ${fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
8566
|
+
}
|
|
8567
|
+
`;
|
|
8568
|
+
var ConditionalInputRow = css38`
|
|
8569
|
+
display: flex;
|
|
8570
|
+
gap: var(--spacing-sm);
|
|
8571
|
+
flex-wrap: wrap;
|
|
8572
|
+
|
|
8573
|
+
${cq("380px")} {
|
|
8574
|
+
& > div:nth-child(-n + 2) {
|
|
8575
|
+
width: calc(50% - var(--spacing-sm));
|
|
8576
|
+
}
|
|
8577
|
+
|
|
8578
|
+
& > div:nth-child(n + 3) {
|
|
8579
|
+
width: calc(100% - 48px);
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8582
|
+
${cq("764px")} {
|
|
8583
|
+
align-items: flex-start;
|
|
8584
|
+
display: grid;
|
|
8585
|
+
grid-template-columns: 250px 160px 1fr 32px;
|
|
8586
|
+
|
|
8587
|
+
& > div:nth-child(n) {
|
|
8588
|
+
width: auto;
|
|
8589
|
+
}
|
|
8590
|
+
}
|
|
8591
|
+
`;
|
|
8592
|
+
var SearchInput = css38`
|
|
8593
|
+
max-height: 40px;
|
|
8594
|
+
min-height: unset;
|
|
8595
|
+
`;
|
|
8596
|
+
var BindableKeywordSearchInputStyles = css38`
|
|
8597
|
+
position: relative;
|
|
8598
|
+
width: 100%;
|
|
8599
|
+
|
|
8600
|
+
& [data-lexical-editor='true'] {
|
|
8601
|
+
padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
8602
|
+
font-size: var(--fs-sm);
|
|
8603
|
+
border-radius: var(--rounded-full);
|
|
8604
|
+
max-height: 40px;
|
|
8605
|
+
min-height: unset;
|
|
8606
|
+
width: 100%;
|
|
8607
|
+
position: relative;
|
|
8608
|
+
white-space: nowrap;
|
|
8609
|
+
}
|
|
8610
|
+
`;
|
|
8611
|
+
var ClearSearchButtonContainer = css38`
|
|
8612
|
+
align-items: center;
|
|
8613
|
+
display: flex;
|
|
8614
|
+
position: absolute;
|
|
8615
|
+
inset: 0 var(--spacing-lg) 0 auto;
|
|
8616
|
+
`;
|
|
8617
|
+
var ClearSearchButtonStyles = css38`
|
|
8618
|
+
background: none;
|
|
8619
|
+
border: none;
|
|
8620
|
+
padding: 0;
|
|
8621
|
+
pointer-events: all;
|
|
8622
|
+
`;
|
|
8623
|
+
var FilterButton = css38`
|
|
8624
|
+
align-items: center;
|
|
8625
|
+
background: var(--white);
|
|
8626
|
+
border: 1px solid var(--gray-300);
|
|
8627
|
+
border-radius: var(--rounded-full);
|
|
8628
|
+
color: var(--typography-base);
|
|
8629
|
+
display: flex;
|
|
8630
|
+
font-size: var(--fs-sm);
|
|
8631
|
+
gap: var(--spacing-sm);
|
|
8632
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
8633
|
+
max-height: 40px;
|
|
8634
|
+
transition:
|
|
8635
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
8636
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
8637
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
8638
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
8639
|
+
|
|
8640
|
+
svg {
|
|
8641
|
+
color: var(--gray-300);
|
|
8642
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8643
|
+
}
|
|
8644
|
+
|
|
8645
|
+
&:hover,
|
|
8646
|
+
:where([aria-expanded='true']) {
|
|
8647
|
+
outline: none;
|
|
8648
|
+
background: var(--gray-200);
|
|
8649
|
+
border-color: var(--gray-300);
|
|
8650
|
+
|
|
8651
|
+
svg {
|
|
8652
|
+
color: var(--typography-base);
|
|
8653
|
+
}
|
|
8654
|
+
}
|
|
8655
|
+
|
|
8656
|
+
&:disabled {
|
|
8657
|
+
opacity: var(--opacity-50);
|
|
8658
|
+
}
|
|
8659
|
+
`;
|
|
8660
|
+
var FilterButtonText = css38`
|
|
8661
|
+
overflow: hidden;
|
|
8662
|
+
text-overflow: ellipsis;
|
|
8663
|
+
white-space: nowrap;
|
|
8664
|
+
max-width: 14ch;
|
|
8665
|
+
`;
|
|
8666
|
+
var FilterButtonSelected = css38`
|
|
8667
|
+
background: var(--gray-100);
|
|
8668
|
+
border-color: var(--gray-300);
|
|
8669
|
+
|
|
8670
|
+
svg {
|
|
8671
|
+
color: var(--accent-dark);
|
|
8672
|
+
}
|
|
8673
|
+
`;
|
|
8674
|
+
var FilterButtonWithOptions = css38`
|
|
8675
|
+
:where([aria-expanded='true']) {
|
|
8676
|
+
background: var(--purple-rain-100);
|
|
8677
|
+
border-color: var(--accent-light);
|
|
8678
|
+
color: var(--typography-base);
|
|
8679
|
+
box-shadow: var(--elevation-100);
|
|
8680
|
+
|
|
8681
|
+
svg {
|
|
8682
|
+
color: var(--accent-dark);
|
|
8683
|
+
}
|
|
8684
|
+
}
|
|
8685
|
+
`;
|
|
8686
|
+
var SearchIcon = css38`
|
|
8687
|
+
color: var(--icon-color);
|
|
8688
|
+
position: absolute;
|
|
8689
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
8690
|
+
margin: auto;
|
|
8691
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8692
|
+
`;
|
|
8693
|
+
var AddConditionalBtn = css38`
|
|
8694
|
+
align-items: center;
|
|
8695
|
+
background: transparent;
|
|
8696
|
+
border: none;
|
|
8697
|
+
color: var(--primary-action-default);
|
|
8698
|
+
display: flex;
|
|
8699
|
+
gap: var(--spacing-sm);
|
|
8700
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8701
|
+
padding: 0;
|
|
8702
|
+
|
|
8703
|
+
&:hover,
|
|
8704
|
+
&:focus {
|
|
8705
|
+
color: var(--primary-action-hover);
|
|
8706
|
+
}
|
|
8707
|
+
|
|
8708
|
+
&:disabled {
|
|
8709
|
+
color: var(--gray-400);
|
|
8710
|
+
}
|
|
8711
|
+
`;
|
|
8712
|
+
var Title = css38`
|
|
8713
|
+
color: var(--typography-light);
|
|
8714
|
+
|
|
8715
|
+
&:focus {
|
|
8716
|
+
outline: none;
|
|
8717
|
+
}
|
|
8718
|
+
`;
|
|
8719
|
+
var ResetConditionsBtn = css38`
|
|
8720
|
+
background: transparent;
|
|
8721
|
+
border: none;
|
|
8722
|
+
color: var(--action-destructive-default);
|
|
8723
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8724
|
+
padding: 0 var(--spacing-sm) 0 0;
|
|
8725
|
+
|
|
8726
|
+
&:hover,
|
|
8727
|
+
&:focus {
|
|
8728
|
+
color: var(--action-destructive-hover);
|
|
8729
|
+
}
|
|
8730
|
+
&:disabled {
|
|
8731
|
+
color: var(--gray-400);
|
|
8732
|
+
}
|
|
8733
|
+
`;
|
|
8734
|
+
var IconBtn = css38`
|
|
8735
|
+
align-self: center;
|
|
8736
|
+
background: transparent;
|
|
8737
|
+
border: none;
|
|
8738
|
+
padding: var(--spacing-sm);
|
|
8739
|
+
`;
|
|
8740
|
+
var SearchAndFilterOptionsContainer = css38`
|
|
8741
|
+
background: var(--gray-50);
|
|
8742
|
+
border: 1px solid var(--gray-300);
|
|
8743
|
+
border-radius: var(--rounded-base);
|
|
8744
|
+
container-type: inline-size;
|
|
8745
|
+
display: flex;
|
|
8746
|
+
flex-direction: column;
|
|
8747
|
+
gap: var(--spacing-sm);
|
|
8748
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
8749
|
+
will-change: height;
|
|
8750
|
+
position: relative;
|
|
8751
|
+
z-index: 2;
|
|
8752
|
+
`;
|
|
8753
|
+
var SearchAndFilterOptionsInnerContainer = css38`
|
|
8754
|
+
display: flex;
|
|
8755
|
+
flex-direction: column;
|
|
8756
|
+
gap: var(--spacing-sm);
|
|
8757
|
+
padding-inline: var(--spacing-md);
|
|
8758
|
+
`;
|
|
8759
|
+
var SearchAndFilterButtonGroup = css38`
|
|
8760
|
+
margin-top: var(--spacing-xs);
|
|
8761
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
8762
|
+
`;
|
|
8763
|
+
|
|
8764
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8765
|
+
import { jsx as jsx83, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
|
|
8766
|
+
var FilterButton2 = ({
|
|
8767
|
+
text = "Filters",
|
|
8768
|
+
icon = "filter-add",
|
|
8769
|
+
filterCount,
|
|
8770
|
+
hasSelectedValue,
|
|
8771
|
+
dataTestId,
|
|
8772
|
+
...props
|
|
8773
|
+
}) => {
|
|
8774
|
+
return /* @__PURE__ */ jsxs44(
|
|
8775
|
+
"button",
|
|
8776
|
+
{
|
|
8777
|
+
type: "button",
|
|
8778
|
+
css: [
|
|
8779
|
+
FilterButton,
|
|
8780
|
+
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
8781
|
+
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
8782
|
+
],
|
|
8783
|
+
...props,
|
|
8784
|
+
"data-testid": dataTestId,
|
|
8785
|
+
children: [
|
|
8786
|
+
/* @__PURE__ */ jsx83(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
8787
|
+
/* @__PURE__ */ jsx83("span", { css: FilterButtonText, children: text }),
|
|
8788
|
+
filterCount ? /* @__PURE__ */ jsx83(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
8789
|
+
]
|
|
8478
8790
|
}
|
|
8479
|
-
|
|
8480
|
-
return /* @__PURE__ */ jsxs43(Fragment15, { children: [
|
|
8481
|
-
/* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8482
|
-
/* @__PURE__ */ jsx72(
|
|
8483
|
-
Input6,
|
|
8484
|
-
{
|
|
8485
|
-
label: `${ariaLabel}-min-date`,
|
|
8486
|
-
type: "date",
|
|
8487
|
-
showLabel: false,
|
|
8488
|
-
value: minDateValue,
|
|
8489
|
-
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
8490
|
-
"aria-invalid": !error ? false : true,
|
|
8491
|
-
disabled,
|
|
8492
|
-
readOnly,
|
|
8493
|
-
"data-testid": "value-low"
|
|
8494
|
-
}
|
|
8495
|
-
),
|
|
8496
|
-
/* @__PURE__ */ jsx72(
|
|
8497
|
-
Input6,
|
|
8498
|
-
{
|
|
8499
|
-
label: `${ariaLabel}-max-date`,
|
|
8500
|
-
type: "date",
|
|
8501
|
-
showLabel: false,
|
|
8502
|
-
value: maxDateValue,
|
|
8503
|
-
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
8504
|
-
"aria-invalid": !error ? false : true,
|
|
8505
|
-
disabled,
|
|
8506
|
-
readOnly,
|
|
8507
|
-
"data-testid": "value-high"
|
|
8508
|
-
}
|
|
8509
|
-
)
|
|
8510
|
-
] }),
|
|
8511
|
-
/* @__PURE__ */ jsx72(ErrorContainer, { errorMessage: error })
|
|
8512
|
-
] });
|
|
8791
|
+
);
|
|
8513
8792
|
};
|
|
8793
|
+
|
|
8794
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8795
|
+
import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
|
|
8796
|
+
import { hasReferencedVariables as hasReferencedVariables3 } from "@uniformdev/canvas";
|
|
8797
|
+
import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
8798
|
+
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
8799
|
+
import { useEffect as useEffect24, useRef as useRef17, useState as useState25 } from "react";
|
|
8800
|
+
import { useDebounce as useDebounce10 } from "react-use";
|
|
8801
|
+
import { v4 as v43 } from "uuid";
|
|
8802
|
+
|
|
8803
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8804
|
+
import { VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
8805
|
+
import {
|
|
8806
|
+
createContext as createContext7,
|
|
8807
|
+
useCallback as useCallback7,
|
|
8808
|
+
useContext as useContext9,
|
|
8809
|
+
useDeferredValue as useDeferredValue3,
|
|
8810
|
+
useEffect as useEffect23,
|
|
8811
|
+
useMemo as useMemo23,
|
|
8812
|
+
useState as useState24
|
|
8813
|
+
} from "react";
|
|
8814
|
+
|
|
8815
|
+
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
8816
|
+
import { jsx as jsx84 } from "@emotion/react/jsx-runtime";
|
|
8514
8817
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
8515
8818
|
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
8516
8819
|
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
8517
|
-
if (!Editor) {
|
|
8518
|
-
return
|
|
8519
|
-
}
|
|
8520
|
-
if (editorType === "empty") {
|
|
8521
|
-
return null;
|
|
8820
|
+
if (!Editor || editorType === "empty") {
|
|
8821
|
+
return /* @__PURE__ */ jsx84("span", {});
|
|
8522
8822
|
}
|
|
8523
|
-
return /* @__PURE__ */
|
|
8823
|
+
return /* @__PURE__ */ jsx84(Editor, { ...props });
|
|
8524
8824
|
};
|
|
8525
8825
|
var filterMapper = {
|
|
8526
8826
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -8528,18 +8828,19 @@ var filterMapper = {
|
|
|
8528
8828
|
date: DateEditor,
|
|
8529
8829
|
dateRange: DateRangeEditor,
|
|
8530
8830
|
text: TextEditor,
|
|
8831
|
+
textMultiChoice: TextMultiChoiceEditor,
|
|
8531
8832
|
numberRange: NumberRangeEditor,
|
|
8532
8833
|
number: NumberEditor,
|
|
8533
8834
|
statusMultiChoice: StatusMultiEditor,
|
|
8534
8835
|
statusSingleChoice: StatusSingleEditor,
|
|
8535
8836
|
empty: null
|
|
8536
8837
|
};
|
|
8537
|
-
function withInputVariables(WrappedComponent) {
|
|
8838
|
+
function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
8538
8839
|
const WithInputVariables = (props) => {
|
|
8539
8840
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8540
|
-
return /* @__PURE__ */
|
|
8841
|
+
return /* @__PURE__ */ jsx84(WrappedComponent, { ...props });
|
|
8541
8842
|
}
|
|
8542
|
-
return /* @__PURE__ */
|
|
8843
|
+
return /* @__PURE__ */ jsx84(
|
|
8543
8844
|
InputVariables,
|
|
8544
8845
|
{
|
|
8545
8846
|
disableInlineMenu: true,
|
|
@@ -8547,7 +8848,7 @@ function withInputVariables(WrappedComponent) {
|
|
|
8547
8848
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8548
8849
|
value: props.value,
|
|
8549
8850
|
disabled: props.disabled,
|
|
8550
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8851
|
+
inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ jsx84(WrappedComponent, { ...props })
|
|
8551
8852
|
}
|
|
8552
8853
|
);
|
|
8553
8854
|
};
|
|
@@ -8557,16 +8858,16 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
8557
8858
|
const WithInputVariables = (props) => {
|
|
8558
8859
|
var _a;
|
|
8559
8860
|
if (!props.bindable || props.disabled || props.readOnly) {
|
|
8560
|
-
return /* @__PURE__ */
|
|
8861
|
+
return /* @__PURE__ */ jsx84(WrappedComponent, { ...props });
|
|
8561
8862
|
}
|
|
8562
|
-
return /* @__PURE__ */
|
|
8863
|
+
return /* @__PURE__ */ jsx84(
|
|
8563
8864
|
InputVariables,
|
|
8564
8865
|
{
|
|
8565
8866
|
disableInlineMenu: true,
|
|
8566
8867
|
showMenuPosition: "inline-right",
|
|
8567
8868
|
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
8568
8869
|
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
8569
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8870
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx84(WrappedComponent, { ...props })
|
|
8570
8871
|
}
|
|
8571
8872
|
);
|
|
8572
8873
|
};
|
|
@@ -8577,29 +8878,12 @@ var bindableFiltersMapper = {
|
|
|
8577
8878
|
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8578
8879
|
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8579
8880
|
date: withInputVariables(DateEditor),
|
|
8580
|
-
text: withInputVariables(TextEditor),
|
|
8881
|
+
text: withInputVariables(TextEditor, true),
|
|
8581
8882
|
number: withInputVariables(NumberEditor)
|
|
8582
8883
|
};
|
|
8583
|
-
var ErrorContainer = ({ errorMessage }) => {
|
|
8584
|
-
return /* @__PURE__ */ jsx72(
|
|
8585
|
-
"div",
|
|
8586
|
-
{
|
|
8587
|
-
css: {
|
|
8588
|
-
gridColumn: "span 6",
|
|
8589
|
-
order: 6
|
|
8590
|
-
},
|
|
8591
|
-
children: /* @__PURE__ */ jsx72(FieldMessage, { errorMessage })
|
|
8592
|
-
}
|
|
8593
|
-
);
|
|
8594
|
-
};
|
|
8595
|
-
var twoColumnGrid = {
|
|
8596
|
-
display: "grid",
|
|
8597
|
-
gridTemplateColumns: "1fr 1fr",
|
|
8598
|
-
gap: "var(--spacing-sm);"
|
|
8599
|
-
};
|
|
8600
8884
|
|
|
8601
8885
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8602
|
-
import { jsx as
|
|
8886
|
+
import { jsx as jsx85 } from "@emotion/react/jsx-runtime";
|
|
8603
8887
|
var SearchAndFilterContext = createContext7({
|
|
8604
8888
|
searchTerm: "",
|
|
8605
8889
|
setSearchTerm: () => {
|
|
@@ -8626,6 +8910,7 @@ var SearchAndFilterProvider = ({
|
|
|
8626
8910
|
filters,
|
|
8627
8911
|
filterOptions,
|
|
8628
8912
|
filterVisible = false,
|
|
8913
|
+
alwaysVisible = false,
|
|
8629
8914
|
defaultSearchTerm = "",
|
|
8630
8915
|
onSearchChange,
|
|
8631
8916
|
onChange,
|
|
@@ -8635,9 +8920,9 @@ var SearchAndFilterProvider = ({
|
|
|
8635
8920
|
children,
|
|
8636
8921
|
allowBindingSearchTerm
|
|
8637
8922
|
}) => {
|
|
8638
|
-
const [searchTerm, setSearchTerm] =
|
|
8923
|
+
const [searchTerm, setSearchTerm] = useState24(defaultSearchTerm);
|
|
8639
8924
|
const deferredSearchTerm = useDeferredValue3(searchTerm);
|
|
8640
|
-
const [filterVisibility, setFilterVisibility] =
|
|
8925
|
+
const [filterVisibility, setFilterVisibility] = useState24(alwaysVisible || filterVisible);
|
|
8641
8926
|
const handleSearchTerm = useCallback7(
|
|
8642
8927
|
(term) => {
|
|
8643
8928
|
setSearchTerm(term);
|
|
@@ -8646,8 +8931,13 @@ var SearchAndFilterProvider = ({
|
|
|
8646
8931
|
[setSearchTerm, onSearchChange]
|
|
8647
8932
|
);
|
|
8648
8933
|
const handleToggleFilterVisibility = useCallback7(
|
|
8649
|
-
(visible) =>
|
|
8650
|
-
|
|
8934
|
+
(visible) => {
|
|
8935
|
+
if (alwaysVisible) {
|
|
8936
|
+
return;
|
|
8937
|
+
}
|
|
8938
|
+
setFilterVisibility(visible);
|
|
8939
|
+
},
|
|
8940
|
+
[alwaysVisible]
|
|
8651
8941
|
);
|
|
8652
8942
|
const handleAddFilter = useCallback7(() => {
|
|
8653
8943
|
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
@@ -8663,17 +8953,17 @@ var SearchAndFilterProvider = ({
|
|
|
8663
8953
|
},
|
|
8664
8954
|
[filters, onChange]
|
|
8665
8955
|
);
|
|
8666
|
-
const validFilterQuery =
|
|
8956
|
+
const validFilterQuery = useMemo23(() => {
|
|
8667
8957
|
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
8668
8958
|
if (hasValidFilters) {
|
|
8669
8959
|
return filters;
|
|
8670
8960
|
}
|
|
8671
8961
|
}, [filters]);
|
|
8672
|
-
|
|
8962
|
+
useEffect23(() => {
|
|
8673
8963
|
if (filterVisibility) {
|
|
8674
8964
|
const handleEscKeyFilterClose = (e) => {
|
|
8675
8965
|
if (e.key === "Escape") {
|
|
8676
|
-
|
|
8966
|
+
handleToggleFilterVisibility(false);
|
|
8677
8967
|
}
|
|
8678
8968
|
};
|
|
8679
8969
|
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
@@ -8681,8 +8971,8 @@ var SearchAndFilterProvider = ({
|
|
|
8681
8971
|
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8682
8972
|
};
|
|
8683
8973
|
}
|
|
8684
|
-
}, [filterVisibility]);
|
|
8685
|
-
return /* @__PURE__ */
|
|
8974
|
+
}, [filterVisibility, handleToggleFilterVisibility]);
|
|
8975
|
+
return /* @__PURE__ */ jsx85(
|
|
8686
8976
|
SearchAndFilterContext.Provider,
|
|
8687
8977
|
{
|
|
8688
8978
|
value: {
|
|
@@ -8701,7 +8991,7 @@ var SearchAndFilterProvider = ({
|
|
|
8701
8991
|
filterMapper: filterMapper2,
|
|
8702
8992
|
allowBindingSearchTerm
|
|
8703
8993
|
},
|
|
8704
|
-
children: /* @__PURE__ */
|
|
8994
|
+
children: /* @__PURE__ */ jsx85(VerticalRhythm6, { children })
|
|
8705
8995
|
}
|
|
8706
8996
|
);
|
|
8707
8997
|
};
|
|
@@ -8711,7 +9001,7 @@ var useSearchAndFilter = () => {
|
|
|
8711
9001
|
};
|
|
8712
9002
|
|
|
8713
9003
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8714
|
-
import { Fragment as
|
|
9004
|
+
import { Fragment as Fragment17, jsx as jsx86, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
|
|
8715
9005
|
var FilterControls = ({
|
|
8716
9006
|
children,
|
|
8717
9007
|
hideSearchInput
|
|
@@ -8724,25 +9014,25 @@ var FilterControls = ({
|
|
|
8724
9014
|
searchTerm,
|
|
8725
9015
|
allowBindingSearchTerm
|
|
8726
9016
|
} = useSearchAndFilter();
|
|
8727
|
-
const editorRef =
|
|
8728
|
-
const
|
|
8729
|
-
const [idToResetInputVariables, setIdToResetInputVariables] =
|
|
8730
|
-
const [localeSearchTerm, setLocaleSearchTerm] =
|
|
8731
|
-
|
|
9017
|
+
const editorRef = useRef17(null);
|
|
9018
|
+
const variableRefernceCountInSearchTerm = hasReferencedVariables3(searchTerm);
|
|
9019
|
+
const [idToResetInputVariables, setIdToResetInputVariables] = useState25("data-resource-search-term-input");
|
|
9020
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState25(searchTerm);
|
|
9021
|
+
useDebounce10(
|
|
8732
9022
|
() => {
|
|
8733
9023
|
setSearchTerm(localeSearchTerm);
|
|
8734
9024
|
},
|
|
8735
9025
|
300,
|
|
8736
9026
|
[localeSearchTerm]
|
|
8737
9027
|
);
|
|
8738
|
-
|
|
9028
|
+
useEffect24(() => {
|
|
8739
9029
|
if (searchTerm === "") {
|
|
8740
9030
|
setLocaleSearchTerm("");
|
|
8741
9031
|
setIdToResetInputVariables(`data-resource-search-term-input-${v43()}`);
|
|
8742
9032
|
}
|
|
8743
9033
|
}, [searchTerm]);
|
|
8744
|
-
return /* @__PURE__ */
|
|
8745
|
-
/* @__PURE__ */
|
|
9034
|
+
return /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
9035
|
+
/* @__PURE__ */ jsx86(
|
|
8746
9036
|
FilterButton2,
|
|
8747
9037
|
{
|
|
8748
9038
|
"aria-controls": "search-and-filter-options",
|
|
@@ -8755,8 +9045,8 @@ var FilterControls = ({
|
|
|
8755
9045
|
dataTestId: "filters-button"
|
|
8756
9046
|
}
|
|
8757
9047
|
),
|
|
8758
|
-
hideSearchInput ? null : /* @__PURE__ */
|
|
8759
|
-
/* @__PURE__ */
|
|
9048
|
+
hideSearchInput ? null : /* @__PURE__ */ jsxs45("div", { css: BindableKeywordSearchInputStyles, children: [
|
|
9049
|
+
/* @__PURE__ */ jsx86(
|
|
8760
9050
|
InputVariables,
|
|
8761
9051
|
{
|
|
8762
9052
|
label: "",
|
|
@@ -8766,7 +9056,7 @@ var FilterControls = ({
|
|
|
8766
9056
|
value: localeSearchTerm,
|
|
8767
9057
|
onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
|
|
8768
9058
|
disableVariables: !allowBindingSearchTerm,
|
|
8769
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9059
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx86(
|
|
8770
9060
|
InputKeywordSearch2,
|
|
8771
9061
|
{
|
|
8772
9062
|
placeholder: "Search...",
|
|
@@ -8779,7 +9069,7 @@ var FilterControls = ({
|
|
|
8779
9069
|
)
|
|
8780
9070
|
}
|
|
8781
9071
|
),
|
|
8782
|
-
|
|
9072
|
+
variableRefernceCountInSearchTerm ? /* @__PURE__ */ jsx86("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx86(
|
|
8783
9073
|
"button",
|
|
8784
9074
|
{
|
|
8785
9075
|
css: ClearSearchButtonStyles,
|
|
@@ -8793,7 +9083,7 @@ var FilterControls = ({
|
|
|
8793
9083
|
},
|
|
8794
9084
|
type: "button",
|
|
8795
9085
|
"data-testid": "keyword-search-clear-button",
|
|
8796
|
-
children: /* @__PURE__ */
|
|
9086
|
+
children: /* @__PURE__ */ jsx86(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
|
|
8797
9087
|
}
|
|
8798
9088
|
) }) : null
|
|
8799
9089
|
] }),
|
|
@@ -8802,88 +9092,27 @@ var FilterControls = ({
|
|
|
8802
9092
|
};
|
|
8803
9093
|
|
|
8804
9094
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8805
|
-
import { Icon as Icon8, InputComboBox as
|
|
8806
|
-
import { useMemo as
|
|
9095
|
+
import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
|
|
9096
|
+
import { useMemo as useMemo24 } from "react";
|
|
8807
9097
|
|
|
8808
|
-
// src/components/SearchAndFilter/
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
buttonRow,
|
|
8814
|
-
additionalFiltersContainer,
|
|
8815
|
-
children
|
|
8816
|
-
}) => {
|
|
8817
|
-
return /* @__PURE__ */ jsxs45("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8818
|
-
/* @__PURE__ */ jsx75("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8819
|
-
buttonRow ? /* @__PURE__ */ jsx75(
|
|
8820
|
-
HorizontalRhythm8,
|
|
8821
|
-
{
|
|
8822
|
-
css: SearchAndFilterButtonGroup,
|
|
8823
|
-
gap: "sm",
|
|
8824
|
-
align: "center",
|
|
8825
|
-
justify: "space-between",
|
|
8826
|
-
children: buttonRow
|
|
8827
|
-
}
|
|
8828
|
-
) : null,
|
|
8829
|
-
additionalFiltersContainer ? /* @__PURE__ */ jsx75("div", { children: additionalFiltersContainer }) : null
|
|
8830
|
-
] });
|
|
8831
|
-
};
|
|
8832
|
-
var FilterMenu = ({
|
|
8833
|
-
id,
|
|
8834
|
-
filterTitle = "Show results",
|
|
8835
|
-
menuControls,
|
|
8836
|
-
additionalFiltersContainer,
|
|
8837
|
-
children,
|
|
8838
|
-
dataTestId,
|
|
8839
|
-
resetButtonText = "reset"
|
|
8840
|
-
}) => {
|
|
8841
|
-
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8842
|
-
const innerMenuRef = React14.useRef(null);
|
|
8843
|
-
useEffect24(() => {
|
|
8844
|
-
var _a;
|
|
8845
|
-
if (filterVisibility) {
|
|
8846
|
-
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
8847
|
-
}
|
|
8848
|
-
}, [filterVisibility]);
|
|
8849
|
-
return /* @__PURE__ */ jsx75(VerticalRhythm7, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs45(
|
|
8850
|
-
SearchAndFilterOptionsContainer2,
|
|
8851
|
-
{
|
|
8852
|
-
buttonRow: menuControls,
|
|
8853
|
-
additionalFiltersContainer,
|
|
8854
|
-
children: [
|
|
8855
|
-
/* @__PURE__ */ jsxs45(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
8856
|
-
/* @__PURE__ */ jsx75("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
8857
|
-
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx75(
|
|
8858
|
-
"button",
|
|
8859
|
-
{
|
|
8860
|
-
type: "button",
|
|
8861
|
-
css: ResetConditionsBtn,
|
|
8862
|
-
onClick: () => {
|
|
8863
|
-
handleResetFilters();
|
|
8864
|
-
setFilterVisibility(false);
|
|
8865
|
-
},
|
|
8866
|
-
"data-testid": "reset-filters",
|
|
8867
|
-
children: resetButtonText
|
|
8868
|
-
}
|
|
8869
|
-
) : null
|
|
8870
|
-
] }),
|
|
8871
|
-
children
|
|
8872
|
-
]
|
|
8873
|
-
}
|
|
8874
|
-
) : null });
|
|
8875
|
-
};
|
|
9098
|
+
// src/components/SearchAndFilter/util/isFilterBindable.ts
|
|
9099
|
+
function isFilterBindable(filter, operator) {
|
|
9100
|
+
var _a, _b;
|
|
9101
|
+
return (_b = (_a = operator == null ? void 0 : operator.bindable) != null ? _a : filter == null ? void 0 : filter.bindable) != null ? _b : false;
|
|
9102
|
+
}
|
|
8876
9103
|
|
|
8877
9104
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8878
|
-
import { jsx as
|
|
9105
|
+
import { jsx as jsx87, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
|
|
8879
9106
|
var FilterItem = ({
|
|
8880
9107
|
index,
|
|
8881
|
-
paramOptions,
|
|
8882
9108
|
operatorOptions,
|
|
8883
9109
|
valueOptions,
|
|
8884
|
-
|
|
9110
|
+
onFilterOptionChange,
|
|
9111
|
+
onFilterDynamicChange,
|
|
8885
9112
|
onOperatorChange,
|
|
8886
|
-
onValueChange
|
|
9113
|
+
onValueChange,
|
|
9114
|
+
initialCriteriaTitle = "Where",
|
|
9115
|
+
criteriaGroupOperator = "and"
|
|
8887
9116
|
}) => {
|
|
8888
9117
|
var _a, _b;
|
|
8889
9118
|
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
@@ -8891,25 +9120,26 @@ var FilterItem = ({
|
|
|
8891
9120
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
8892
9121
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
8893
9122
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
8894
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } =
|
|
9123
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo24(() => {
|
|
8895
9124
|
var _a2;
|
|
8896
|
-
const
|
|
9125
|
+
const currentSelectedFilterGroup = filterOptions.find((item) => {
|
|
8897
9126
|
var _a3;
|
|
8898
9127
|
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
8899
9128
|
});
|
|
8900
|
-
const
|
|
9129
|
+
const selectedFilterOption = (_a2 = currentSelectedFilterGroup == null ? void 0 : currentSelectedFilterGroup.options) == null ? void 0 : _a2.find((item) => {
|
|
8901
9130
|
return filters[index].field === item.value;
|
|
8902
9131
|
});
|
|
8903
|
-
const isCurrentFieldReadOnly =
|
|
9132
|
+
const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
|
|
8904
9133
|
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
8905
9134
|
return filters[index].operator === item.value;
|
|
8906
9135
|
});
|
|
9136
|
+
const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
|
|
8907
9137
|
return {
|
|
8908
|
-
selectedFieldValue:
|
|
9138
|
+
selectedFieldValue: selectedFilterOption,
|
|
8909
9139
|
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
8910
9140
|
selectedMetaValue: filters[index].value,
|
|
8911
9141
|
readOnly: isCurrentFieldReadOnly,
|
|
8912
|
-
bindable:
|
|
9142
|
+
bindable: bindable2
|
|
8913
9143
|
};
|
|
8914
9144
|
}, [filters, filterOptions, index, operatorOptions]);
|
|
8915
9145
|
const readOnlyProps = readOnly ? {
|
|
@@ -8918,17 +9148,28 @@ var FilterItem = ({
|
|
|
8918
9148
|
menuIsOpen: false,
|
|
8919
9149
|
isClearable: false
|
|
8920
9150
|
} : {};
|
|
9151
|
+
const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
|
|
8921
9152
|
return /* @__PURE__ */ jsxs46("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
8922
|
-
/* @__PURE__ */
|
|
9153
|
+
/* @__PURE__ */ jsx87("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
|
|
8923
9154
|
/* @__PURE__ */ jsxs46("div", { css: ConditionalInputRow, children: [
|
|
8924
|
-
/* @__PURE__ */
|
|
8925
|
-
|
|
9155
|
+
CustomLeftHandComponent ? /* @__PURE__ */ jsx87(
|
|
9156
|
+
CustomLeftHandComponent,
|
|
9157
|
+
{
|
|
9158
|
+
filterOption: selectedFieldValue,
|
|
9159
|
+
filter: filters[index],
|
|
9160
|
+
setFilterDynamicValue: onFilterDynamicChange,
|
|
9161
|
+
deselectFilterOption: () => {
|
|
9162
|
+
onFilterOptionChange("");
|
|
9163
|
+
}
|
|
9164
|
+
}
|
|
9165
|
+
) : /* @__PURE__ */ jsx87(
|
|
9166
|
+
InputComboBox5,
|
|
8926
9167
|
{
|
|
8927
9168
|
"aria-label": label,
|
|
8928
|
-
options:
|
|
9169
|
+
options: filterOptions,
|
|
8929
9170
|
onChange: (e) => {
|
|
8930
9171
|
var _a2;
|
|
8931
|
-
|
|
9172
|
+
onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8932
9173
|
},
|
|
8933
9174
|
isOptionDisabled: (option) => {
|
|
8934
9175
|
var _a2;
|
|
@@ -8948,8 +9189,8 @@ var FilterItem = ({
|
|
|
8948
9189
|
name: `filter-field-${index}`
|
|
8949
9190
|
}
|
|
8950
9191
|
),
|
|
8951
|
-
/* @__PURE__ */
|
|
8952
|
-
|
|
9192
|
+
/* @__PURE__ */ jsx87(
|
|
9193
|
+
InputComboBox5,
|
|
8953
9194
|
{
|
|
8954
9195
|
"aria-label": operatorLabel,
|
|
8955
9196
|
options: operatorOptions,
|
|
@@ -8972,7 +9213,7 @@ var FilterItem = ({
|
|
|
8972
9213
|
name: `filter-operator-${index}`
|
|
8973
9214
|
}
|
|
8974
9215
|
),
|
|
8975
|
-
/* @__PURE__ */
|
|
9216
|
+
/* @__PURE__ */ jsx87(
|
|
8976
9217
|
FilterEditorRenderer,
|
|
8977
9218
|
{
|
|
8978
9219
|
"aria-label": metaDataLabel,
|
|
@@ -8986,7 +9227,7 @@ var FilterItem = ({
|
|
|
8986
9227
|
valueTestId: "filter-value"
|
|
8987
9228
|
}
|
|
8988
9229
|
),
|
|
8989
|
-
readOnly
|
|
9230
|
+
readOnly ? null : /* @__PURE__ */ jsx87(
|
|
8990
9231
|
"button",
|
|
8991
9232
|
{
|
|
8992
9233
|
type: "button",
|
|
@@ -8994,15 +9235,185 @@ var FilterItem = ({
|
|
|
8994
9235
|
"aria-label": "delete filter",
|
|
8995
9236
|
css: IconBtn,
|
|
8996
9237
|
"data-testid": "delete-filter",
|
|
8997
|
-
|
|
9238
|
+
disabled: filters.length === 1,
|
|
9239
|
+
children: /* @__PURE__ */ jsx87(Icon8, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
|
|
8998
9240
|
}
|
|
8999
9241
|
)
|
|
9000
9242
|
] })
|
|
9001
9243
|
] });
|
|
9002
9244
|
};
|
|
9245
|
+
|
|
9246
|
+
// src/components/SearchAndFilter/FilterItems.tsx
|
|
9247
|
+
import { Icon as Icon9 } from "@uniformdev/design-system";
|
|
9248
|
+
|
|
9249
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
9250
|
+
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
|
|
9251
|
+
import React14, { useEffect as useEffect25 } from "react";
|
|
9252
|
+
import { jsx as jsx88, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
|
|
9253
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
9254
|
+
buttonRow,
|
|
9255
|
+
additionalFiltersContainer,
|
|
9256
|
+
children
|
|
9257
|
+
}) => {
|
|
9258
|
+
return /* @__PURE__ */ jsxs47("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
9259
|
+
/* @__PURE__ */ jsx88("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
9260
|
+
buttonRow ? /* @__PURE__ */ jsx88(
|
|
9261
|
+
HorizontalRhythm8,
|
|
9262
|
+
{
|
|
9263
|
+
css: SearchAndFilterButtonGroup,
|
|
9264
|
+
gap: "sm",
|
|
9265
|
+
align: "center",
|
|
9266
|
+
justify: "space-between",
|
|
9267
|
+
children: buttonRow
|
|
9268
|
+
}
|
|
9269
|
+
) : null,
|
|
9270
|
+
additionalFiltersContainer ? /* @__PURE__ */ jsx88("div", { children: additionalFiltersContainer }) : null
|
|
9271
|
+
] });
|
|
9272
|
+
};
|
|
9273
|
+
var FilterMenu = ({
|
|
9274
|
+
id,
|
|
9275
|
+
filterTitle = "Show results",
|
|
9276
|
+
menuControls,
|
|
9277
|
+
additionalFiltersContainer,
|
|
9278
|
+
children,
|
|
9279
|
+
dataTestId,
|
|
9280
|
+
resetButtonText = "reset"
|
|
9281
|
+
}) => {
|
|
9282
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
9283
|
+
const innerMenuRef = React14.useRef(null);
|
|
9284
|
+
useEffect25(() => {
|
|
9285
|
+
var _a;
|
|
9286
|
+
if (filterVisibility) {
|
|
9287
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
9288
|
+
}
|
|
9289
|
+
}, [filterVisibility]);
|
|
9290
|
+
return /* @__PURE__ */ jsx88(VerticalRhythm7, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs47(
|
|
9291
|
+
SearchAndFilterOptionsContainer2,
|
|
9292
|
+
{
|
|
9293
|
+
buttonRow: menuControls,
|
|
9294
|
+
additionalFiltersContainer,
|
|
9295
|
+
children: [
|
|
9296
|
+
/* @__PURE__ */ jsxs47(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
9297
|
+
filterTitle ? /* @__PURE__ */ jsx88("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
|
|
9298
|
+
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx88(
|
|
9299
|
+
"button",
|
|
9300
|
+
{
|
|
9301
|
+
type: "button",
|
|
9302
|
+
css: ResetConditionsBtn,
|
|
9303
|
+
disabled: filters.every((f) => !f.field),
|
|
9304
|
+
onClick: () => {
|
|
9305
|
+
handleResetFilters();
|
|
9306
|
+
setFilterVisibility(false);
|
|
9307
|
+
},
|
|
9308
|
+
"data-testid": "reset-filters",
|
|
9309
|
+
children: resetButtonText
|
|
9310
|
+
}
|
|
9311
|
+
) : null
|
|
9312
|
+
] }),
|
|
9313
|
+
children
|
|
9314
|
+
]
|
|
9315
|
+
}
|
|
9316
|
+
) : null });
|
|
9317
|
+
};
|
|
9318
|
+
|
|
9319
|
+
// src/components/SearchAndFilter/util/getNewFilterValueAfterOperatorChange.ts
|
|
9320
|
+
import { hasReferencedVariables as hasReferencedVariables4 } from "@uniformdev/canvas";
|
|
9321
|
+
function getNewFilterValueAfterOperatorChange({
|
|
9322
|
+
newOperatorId,
|
|
9323
|
+
currentFilter,
|
|
9324
|
+
filterOptions
|
|
9325
|
+
}) {
|
|
9326
|
+
var _a, _b, _c;
|
|
9327
|
+
if (Array.isArray(newOperatorId)) {
|
|
9328
|
+
throw new Error("Operator value must be a single string");
|
|
9329
|
+
}
|
|
9330
|
+
const result = {
|
|
9331
|
+
...currentFilter,
|
|
9332
|
+
operator: newOperatorId,
|
|
9333
|
+
value: ""
|
|
9334
|
+
};
|
|
9335
|
+
const currentOperatorId = currentFilter.operator;
|
|
9336
|
+
let currentValue = currentFilter.value;
|
|
9337
|
+
const currentFieldDefinition = filterOptions.flatMap((group) => {
|
|
9338
|
+
var _a2;
|
|
9339
|
+
return (_a2 = group.options) != null ? _a2 : [];
|
|
9340
|
+
}).find((filter) => filter.value === currentFilter.field);
|
|
9341
|
+
const currentOperator = (_a = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _a.find(
|
|
9342
|
+
(op) => op.value === currentOperatorId
|
|
9343
|
+
);
|
|
9344
|
+
const newOperator = (_b = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _b.find((op) => op.value === newOperatorId);
|
|
9345
|
+
if (!currentOperator || !newOperator) {
|
|
9346
|
+
result.value = "";
|
|
9347
|
+
return result;
|
|
9348
|
+
} else {
|
|
9349
|
+
const currentOperatorValueType = currentOperator.expectedValueType;
|
|
9350
|
+
const newOperatorValueType = newOperator.expectedValueType;
|
|
9351
|
+
if (!isFilterBindable(currentFieldDefinition, newOperator) && hasBindings(currentValue)) {
|
|
9352
|
+
currentValue = "";
|
|
9353
|
+
}
|
|
9354
|
+
if (isHardcodedOperatorValue(currentOperatorValueType)) {
|
|
9355
|
+
result.value = isHardcodedOperatorValue(newOperatorValueType) ? newOperatorValueType : "";
|
|
9356
|
+
return result;
|
|
9357
|
+
}
|
|
9358
|
+
switch (newOperatorValueType) {
|
|
9359
|
+
case "single":
|
|
9360
|
+
if (Array.isArray(currentValue)) {
|
|
9361
|
+
if (currentOperatorValueType === "between") {
|
|
9362
|
+
result.value = "";
|
|
9363
|
+
} else {
|
|
9364
|
+
result.value = (_c = currentValue[0]) != null ? _c : "";
|
|
9365
|
+
}
|
|
9366
|
+
} else {
|
|
9367
|
+
result.value = currentValue;
|
|
9368
|
+
}
|
|
9369
|
+
return result;
|
|
9370
|
+
case "array":
|
|
9371
|
+
if (currentOperatorValueType === "between") {
|
|
9372
|
+
result.value = "";
|
|
9373
|
+
} else if (Array.isArray(currentValue)) {
|
|
9374
|
+
result.value = currentValue;
|
|
9375
|
+
} else {
|
|
9376
|
+
result.value = currentValue ? [currentValue] : [];
|
|
9377
|
+
}
|
|
9378
|
+
return result;
|
|
9379
|
+
case "between":
|
|
9380
|
+
if (Array.isArray(currentValue)) {
|
|
9381
|
+
result.value = "";
|
|
9382
|
+
} else {
|
|
9383
|
+
result.value = [currentValue, ""];
|
|
9384
|
+
}
|
|
9385
|
+
return result;
|
|
9386
|
+
case "none":
|
|
9387
|
+
result.value = "";
|
|
9388
|
+
return result;
|
|
9389
|
+
default:
|
|
9390
|
+
result.value = newOperatorValueType;
|
|
9391
|
+
return result;
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9394
|
+
}
|
|
9395
|
+
function isHardcodedOperatorValue(valueType) {
|
|
9396
|
+
return valueType !== void 0 && valueType !== "array" && valueType !== "between" && valueType !== "none" && valueType !== "single";
|
|
9397
|
+
}
|
|
9398
|
+
function hasBindings(currentValue) {
|
|
9399
|
+
if (currentValue === void 0) {
|
|
9400
|
+
return false;
|
|
9401
|
+
}
|
|
9402
|
+
if (Array.isArray(currentValue)) {
|
|
9403
|
+
return currentValue.some((value) => hasReferencedVariables4(value));
|
|
9404
|
+
}
|
|
9405
|
+
return hasReferencedVariables4(currentValue) > 0;
|
|
9406
|
+
}
|
|
9407
|
+
|
|
9408
|
+
// src/components/SearchAndFilter/FilterItems.tsx
|
|
9409
|
+
import { jsx as jsx89, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
|
|
9003
9410
|
var FilterItems = ({
|
|
9004
9411
|
addButtonText = "add condition",
|
|
9005
|
-
additionalFiltersContainer
|
|
9412
|
+
additionalFiltersContainer,
|
|
9413
|
+
filterTitle,
|
|
9414
|
+
resetButtonText,
|
|
9415
|
+
initialCriteriaTitle,
|
|
9416
|
+
criteriaGroupOperator
|
|
9006
9417
|
}) => {
|
|
9007
9418
|
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
9008
9419
|
const handleUpdateFilter = (index, prop, value) => {
|
|
@@ -9010,21 +9421,16 @@ var FilterItems = ({
|
|
|
9010
9421
|
const next = [...filters];
|
|
9011
9422
|
next[index] = { ...next[index], [prop]: value };
|
|
9012
9423
|
if (prop === "operator") {
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
next[index].value = "";
|
|
9018
|
-
}
|
|
9019
|
-
if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
9020
|
-
next[index].value = [next[index].value, ""];
|
|
9021
|
-
}
|
|
9022
|
-
if (value === "def" || value === "true") {
|
|
9023
|
-
next[index].value = "true";
|
|
9024
|
-
}
|
|
9025
|
-
if (value === "ndef" || value === "false") {
|
|
9026
|
-
next[index].value = "false";
|
|
9424
|
+
const newOperatorId = value;
|
|
9425
|
+
const currentFilter = next[index];
|
|
9426
|
+
if (!newOperatorId) {
|
|
9427
|
+
throw new Error("you bad");
|
|
9027
9428
|
}
|
|
9429
|
+
next[index] = getNewFilterValueAfterOperatorChange({
|
|
9430
|
+
newOperatorId,
|
|
9431
|
+
currentFilter,
|
|
9432
|
+
filterOptions
|
|
9433
|
+
});
|
|
9028
9434
|
}
|
|
9029
9435
|
if (prop === "field") {
|
|
9030
9436
|
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
@@ -9033,15 +9439,16 @@ var FilterItems = ({
|
|
|
9033
9439
|
})) == 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";
|
|
9034
9440
|
next[index].operator = firstOperatorInAvailableOperators;
|
|
9035
9441
|
next[index].value = "";
|
|
9442
|
+
next[index].dynamicField = void 0;
|
|
9036
9443
|
}
|
|
9037
9444
|
setFilters(next);
|
|
9038
9445
|
};
|
|
9039
|
-
return /* @__PURE__ */
|
|
9446
|
+
return /* @__PURE__ */ jsx89(
|
|
9040
9447
|
FilterMenu,
|
|
9041
9448
|
{
|
|
9042
9449
|
id: "search-and-filter-options",
|
|
9043
9450
|
dataTestId: "search-and-filter-options",
|
|
9044
|
-
menuControls: /* @__PURE__ */
|
|
9451
|
+
menuControls: /* @__PURE__ */ jsxs48(
|
|
9045
9452
|
"button",
|
|
9046
9453
|
{
|
|
9047
9454
|
type: "button",
|
|
@@ -9049,12 +9456,14 @@ var FilterItems = ({
|
|
|
9049
9456
|
onClick: handleAddFilter,
|
|
9050
9457
|
"data-testid": "add-filter",
|
|
9051
9458
|
children: [
|
|
9052
|
-
/* @__PURE__ */
|
|
9459
|
+
/* @__PURE__ */ jsx89(Icon9, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
9053
9460
|
addButtonText
|
|
9054
9461
|
]
|
|
9055
9462
|
}
|
|
9056
9463
|
),
|
|
9057
9464
|
additionalFiltersContainer,
|
|
9465
|
+
filterTitle,
|
|
9466
|
+
resetButtonText,
|
|
9058
9467
|
children: filters.map((item, i) => {
|
|
9059
9468
|
var _a, _b, _c, _d, _e, _f;
|
|
9060
9469
|
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
@@ -9063,16 +9472,18 @@ var FilterItems = ({
|
|
|
9063
9472
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
9064
9473
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
9065
9474
|
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
9066
|
-
return /* @__PURE__ */
|
|
9475
|
+
return /* @__PURE__ */ jsx89(
|
|
9067
9476
|
FilterItem,
|
|
9068
9477
|
{
|
|
9069
9478
|
index: i,
|
|
9070
|
-
|
|
9071
|
-
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
9479
|
+
onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
|
|
9072
9480
|
operatorOptions: possibleOperators,
|
|
9073
9481
|
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
9074
9482
|
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
9075
|
-
|
|
9483
|
+
onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
|
|
9484
|
+
valueOptions: possibleValueOptions,
|
|
9485
|
+
initialCriteriaTitle,
|
|
9486
|
+
criteriaGroupOperator
|
|
9076
9487
|
},
|
|
9077
9488
|
i
|
|
9078
9489
|
);
|
|
@@ -9086,7 +9497,7 @@ import { VerticalRhythm as VerticalRhythm8 } from "@uniformdev/design-system";
|
|
|
9086
9497
|
|
|
9087
9498
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
9088
9499
|
import { Button as Button6, Callout as Callout7, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
|
|
9089
|
-
import { Fragment as
|
|
9500
|
+
import { Fragment as Fragment18, jsx as jsx90, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
|
|
9090
9501
|
var SearchAndFilterResultContainer = ({
|
|
9091
9502
|
buttonText,
|
|
9092
9503
|
clearButtonLabel = "clear",
|
|
@@ -9116,31 +9527,40 @@ var SearchAndFilterResultContainer = ({
|
|
|
9116
9527
|
handleResetFilters();
|
|
9117
9528
|
}
|
|
9118
9529
|
};
|
|
9119
|
-
return /* @__PURE__ */
|
|
9120
|
-
/* @__PURE__ */
|
|
9121
|
-
/* @__PURE__ */
|
|
9530
|
+
return /* @__PURE__ */ jsxs49(Fragment18, { children: [
|
|
9531
|
+
/* @__PURE__ */ jsxs49(HorizontalRhythm9, { children: [
|
|
9532
|
+
/* @__PURE__ */ jsxs49("span", { children: [
|
|
9122
9533
|
totalResults,
|
|
9123
9534
|
" results ",
|
|
9124
9535
|
searchTerm ? `for "${searchTerm}"` : null
|
|
9125
9536
|
] }),
|
|
9126
|
-
!searchTerm || hideClearButton ? null : /* @__PURE__ */
|
|
9537
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx90(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
9127
9538
|
] }),
|
|
9128
|
-
totalResults === 0 ? /* @__PURE__ */
|
|
9129
|
-
calloutText ? /* @__PURE__ */
|
|
9130
|
-
hideClearButton ? null : /* @__PURE__ */
|
|
9539
|
+
totalResults === 0 ? /* @__PURE__ */ jsxs49(Callout7, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
9540
|
+
calloutText ? /* @__PURE__ */ jsx90(Paragraph, { children: calloutText }) : null,
|
|
9541
|
+
hideClearButton ? null : /* @__PURE__ */ jsx90(
|
|
9542
|
+
Button6,
|
|
9543
|
+
{
|
|
9544
|
+
buttonType: "tertiaryOutline",
|
|
9545
|
+
size: "xs",
|
|
9546
|
+
onClick: handleClearSearch,
|
|
9547
|
+
"data-testid": "clear-search",
|
|
9548
|
+
children: buttonText != null ? buttonText : "Clear search"
|
|
9549
|
+
}
|
|
9550
|
+
)
|
|
9131
9551
|
] }) : null
|
|
9132
9552
|
] });
|
|
9133
9553
|
};
|
|
9134
9554
|
|
|
9135
9555
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9136
|
-
import { jsx as
|
|
9556
|
+
import { jsx as jsx91, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
|
|
9137
9557
|
var SearchAndFilter = ({
|
|
9138
9558
|
filters,
|
|
9139
9559
|
filterOptions,
|
|
9140
9560
|
filterVisible,
|
|
9141
9561
|
filterControls,
|
|
9142
9562
|
viewSwitchControls,
|
|
9143
|
-
resultsContainerView = /* @__PURE__ */
|
|
9563
|
+
resultsContainerView = /* @__PURE__ */ jsx91(SearchAndFilterResultContainer, {}),
|
|
9144
9564
|
filterMapper: filterMapper2 = filterMapper,
|
|
9145
9565
|
additionalFiltersContainer,
|
|
9146
9566
|
onChange,
|
|
@@ -9150,7 +9570,7 @@ var SearchAndFilter = ({
|
|
|
9150
9570
|
allowBindingSearchTerm = false,
|
|
9151
9571
|
resetFilterValues = []
|
|
9152
9572
|
}) => {
|
|
9153
|
-
return /* @__PURE__ */
|
|
9573
|
+
return /* @__PURE__ */ jsx91(
|
|
9154
9574
|
SearchAndFilterProvider,
|
|
9155
9575
|
{
|
|
9156
9576
|
filters,
|
|
@@ -9163,18 +9583,18 @@ var SearchAndFilter = ({
|
|
|
9163
9583
|
resetFilterValues,
|
|
9164
9584
|
filterMapper: filterMapper2,
|
|
9165
9585
|
allowBindingSearchTerm,
|
|
9166
|
-
children: /* @__PURE__ */
|
|
9167
|
-
/* @__PURE__ */
|
|
9168
|
-
/* @__PURE__ */
|
|
9586
|
+
children: /* @__PURE__ */ jsxs50(VerticalRhythm8, { "data-testid": "search-and-filter", children: [
|
|
9587
|
+
/* @__PURE__ */ jsxs50("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
9588
|
+
/* @__PURE__ */ jsx91(
|
|
9169
9589
|
"div",
|
|
9170
9590
|
{
|
|
9171
9591
|
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
9172
|
-
children: !filterControls ? /* @__PURE__ */
|
|
9592
|
+
children: !filterControls ? /* @__PURE__ */ jsx91(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
9173
9593
|
}
|
|
9174
9594
|
),
|
|
9175
9595
|
viewSwitchControls
|
|
9176
9596
|
] }),
|
|
9177
|
-
/* @__PURE__ */
|
|
9597
|
+
/* @__PURE__ */ jsx91(FilterItems, { additionalFiltersContainer }),
|
|
9178
9598
|
resultsContainerView
|
|
9179
9599
|
] })
|
|
9180
9600
|
}
|
|
@@ -9183,9 +9603,9 @@ var SearchAndFilter = ({
|
|
|
9183
9603
|
|
|
9184
9604
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
9185
9605
|
import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
|
|
9186
|
-
import { createContext as createContext8, useState as
|
|
9187
|
-
import { useDebounce as
|
|
9188
|
-
import { jsx as
|
|
9606
|
+
import { createContext as createContext8, useState as useState26 } from "react";
|
|
9607
|
+
import { useDebounce as useDebounce11 } from "react-use";
|
|
9608
|
+
import { jsx as jsx92 } from "@emotion/react/jsx-runtime";
|
|
9189
9609
|
var SearchOnlyContext = createContext8({
|
|
9190
9610
|
searchTerm: "",
|
|
9191
9611
|
setSearchTerm: () => {
|
|
@@ -9193,8 +9613,8 @@ var SearchOnlyContext = createContext8({
|
|
|
9193
9613
|
});
|
|
9194
9614
|
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
9195
9615
|
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
9196
|
-
const [localeSearchTerm, setLocaleSearchTerm] =
|
|
9197
|
-
|
|
9616
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState26("");
|
|
9617
|
+
useDebounce11(
|
|
9198
9618
|
() => {
|
|
9199
9619
|
setSearchTerm(localeSearchTerm);
|
|
9200
9620
|
onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
|
|
@@ -9202,14 +9622,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9202
9622
|
300,
|
|
9203
9623
|
[localeSearchTerm]
|
|
9204
9624
|
);
|
|
9205
|
-
return /* @__PURE__ */
|
|
9625
|
+
return /* @__PURE__ */ jsx92(
|
|
9206
9626
|
SearchOnlyContext.Provider,
|
|
9207
9627
|
{
|
|
9208
9628
|
value: {
|
|
9209
9629
|
searchTerm,
|
|
9210
9630
|
setSearchTerm: setLocaleSearchTerm
|
|
9211
9631
|
},
|
|
9212
|
-
children: /* @__PURE__ */
|
|
9632
|
+
children: /* @__PURE__ */ jsx92("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx92(
|
|
9213
9633
|
InputKeywordSearch3,
|
|
9214
9634
|
{
|
|
9215
9635
|
placeholder: "Search...",
|
|
@@ -9224,7 +9644,7 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9224
9644
|
};
|
|
9225
9645
|
|
|
9226
9646
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9227
|
-
import { InputComboBox as
|
|
9647
|
+
import { InputComboBox as InputComboBox6, InputSelect as InputSelect8, SegmentedControl, VerticalRhythm as VerticalRhythm9 } from "@uniformdev/design-system";
|
|
9228
9648
|
|
|
9229
9649
|
// src/components/SearchAndFilter/styles/SortItems.styles.ts
|
|
9230
9650
|
import { css as css39 } from "@emotion/react";
|
|
@@ -9304,7 +9724,8 @@ var FilterButton3 = css39`
|
|
|
9304
9724
|
gap: var(--spacing-sm);
|
|
9305
9725
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
9306
9726
|
max-height: 40px;
|
|
9307
|
-
transition:
|
|
9727
|
+
transition:
|
|
9728
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
9308
9729
|
background-color var(--duration-fast) var(--timing-ease-out),
|
|
9309
9730
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
9310
9731
|
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
@@ -9460,7 +9881,7 @@ var InputVariableWrapper = css39`
|
|
|
9460
9881
|
`;
|
|
9461
9882
|
|
|
9462
9883
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9463
|
-
import { jsx as
|
|
9884
|
+
import { jsx as jsx93, jsxs as jsxs51 } from "@emotion/react/jsx-runtime";
|
|
9464
9885
|
var SortItems = ({
|
|
9465
9886
|
sortByLabel = "Sort by",
|
|
9466
9887
|
localeLabel = "Show locale",
|
|
@@ -9482,11 +9903,11 @@ var SortItems = ({
|
|
|
9482
9903
|
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
9483
9904
|
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
9484
9905
|
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9485
|
-
return /* @__PURE__ */
|
|
9486
|
-
/* @__PURE__ */
|
|
9487
|
-
/* @__PURE__ */
|
|
9488
|
-
/* @__PURE__ */
|
|
9489
|
-
/* @__PURE__ */
|
|
9906
|
+
return /* @__PURE__ */ jsxs51("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9907
|
+
/* @__PURE__ */ jsxs51(VerticalRhythm9, { gap: "xs", children: [
|
|
9908
|
+
/* @__PURE__ */ jsx93("span", { css: Title2, children: sortByLabel }),
|
|
9909
|
+
/* @__PURE__ */ jsxs51("div", { css: SortFilterInputRow, children: [
|
|
9910
|
+
/* @__PURE__ */ jsx93(
|
|
9490
9911
|
InputVariables,
|
|
9491
9912
|
{
|
|
9492
9913
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9494,8 +9915,8 @@ var SortItems = ({
|
|
|
9494
9915
|
value: sortField,
|
|
9495
9916
|
valueToResetTo: "created_at",
|
|
9496
9917
|
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9497
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9498
|
-
|
|
9918
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx93(
|
|
9919
|
+
InputComboBox6,
|
|
9499
9920
|
{
|
|
9500
9921
|
id: "sort-by-field",
|
|
9501
9922
|
"aria-label": "Sort by",
|
|
@@ -9517,7 +9938,7 @@ var SortItems = ({
|
|
|
9517
9938
|
)
|
|
9518
9939
|
}
|
|
9519
9940
|
),
|
|
9520
|
-
/* @__PURE__ */
|
|
9941
|
+
/* @__PURE__ */ jsx93(
|
|
9521
9942
|
InputVariables,
|
|
9522
9943
|
{
|
|
9523
9944
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9525,7 +9946,7 @@ var SortItems = ({
|
|
|
9525
9946
|
valueToResetTo: "DESC",
|
|
9526
9947
|
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9527
9948
|
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9528
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9949
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx93(
|
|
9529
9950
|
SegmentedControl,
|
|
9530
9951
|
{
|
|
9531
9952
|
noCheckmark: true,
|
|
@@ -9557,14 +9978,14 @@ var SortItems = ({
|
|
|
9557
9978
|
)
|
|
9558
9979
|
] })
|
|
9559
9980
|
] }),
|
|
9560
|
-
hideLocaleOptions ? null : /* @__PURE__ */
|
|
9981
|
+
hideLocaleOptions ? null : /* @__PURE__ */ jsx93(VerticalRhythm9, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx93(
|
|
9561
9982
|
InputVariables,
|
|
9562
9983
|
{
|
|
9563
9984
|
label: localeLabelValue,
|
|
9564
9985
|
value: localeValue,
|
|
9565
9986
|
showMenuPosition: "inline-right",
|
|
9566
9987
|
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9567
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9988
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx93(
|
|
9568
9989
|
InputSelect8,
|
|
9569
9990
|
{
|
|
9570
9991
|
name: "localeReturned",
|
|
@@ -9592,8 +10013,8 @@ import {
|
|
|
9592
10013
|
Callout as Callout8,
|
|
9593
10014
|
DrawerContent,
|
|
9594
10015
|
Heading,
|
|
9595
|
-
Input as
|
|
9596
|
-
InputComboBox as
|
|
10016
|
+
Input as Input11,
|
|
10017
|
+
InputComboBox as InputComboBox7,
|
|
9597
10018
|
InputKeywordSearch as InputKeywordSearch4,
|
|
9598
10019
|
InputSelect as InputSelect9,
|
|
9599
10020
|
InputToggle as InputToggle3,
|
|
@@ -9634,6 +10055,7 @@ export {
|
|
|
9634
10055
|
ControlledObjectSearchProvider,
|
|
9635
10056
|
ControlledValuePlugin,
|
|
9636
10057
|
DATE_OPERATORS,
|
|
10058
|
+
DATE_TIME_OPERATORS,
|
|
9637
10059
|
DISCONNECT_VARIABLE_COMMAND,
|
|
9638
10060
|
DamSelectedItem,
|
|
9639
10061
|
DataRefreshButton,
|
|
@@ -9661,8 +10083,8 @@ export {
|
|
|
9661
10083
|
Heading,
|
|
9662
10084
|
INSERT_VARIABLE_COMMAND,
|
|
9663
10085
|
icons_exports as Icons,
|
|
9664
|
-
|
|
9665
|
-
|
|
10086
|
+
Input11 as Input,
|
|
10087
|
+
InputComboBox7 as InputComboBox,
|
|
9666
10088
|
InputKeywordSearch4 as InputKeywordSearch,
|
|
9667
10089
|
InputSelect9 as InputSelect,
|
|
9668
10090
|
InputToggle3 as InputToggle,
|
|
@@ -9679,6 +10101,7 @@ export {
|
|
|
9679
10101
|
NumberEditor,
|
|
9680
10102
|
NumberRangeEditor,
|
|
9681
10103
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
10104
|
+
OPTIONAL_SYSTEM_FIELD_OPERATORS,
|
|
9682
10105
|
ObjectSearchContainer,
|
|
9683
10106
|
ObjectSearchContext,
|
|
9684
10107
|
ObjectSearchFilter,
|
|
@@ -9729,7 +10152,6 @@ export {
|
|
|
9729
10152
|
RequestUrlInput,
|
|
9730
10153
|
ResolvableLoadingValue,
|
|
9731
10154
|
SELECT_OPERATORS,
|
|
9732
|
-
SYSTEM_DATE_OPERATORS,
|
|
9733
10155
|
SYSTEM_FIELD_OPERATORS,
|
|
9734
10156
|
ScrollableList2 as ScrollableList,
|
|
9735
10157
|
ScrollableListItem,
|
|
@@ -9747,10 +10169,12 @@ export {
|
|
|
9747
10169
|
Switch,
|
|
9748
10170
|
TEXTBOX_OPERATORS,
|
|
9749
10171
|
TextEditor,
|
|
10172
|
+
TextMultiChoiceEditor,
|
|
9750
10173
|
TextVariableRenderer,
|
|
9751
10174
|
Textarea,
|
|
9752
10175
|
Theme3 as Theme,
|
|
9753
10176
|
USER_OPERATORS,
|
|
10177
|
+
VariableChip,
|
|
9754
10178
|
VariableEditor,
|
|
9755
10179
|
VariableNode,
|
|
9756
10180
|
VariablesList,
|
|
@@ -9790,7 +10214,7 @@ export {
|
|
|
9790
10214
|
entrySearchSelectOption,
|
|
9791
10215
|
entrySearchWrapper,
|
|
9792
10216
|
filterMapper,
|
|
9793
|
-
hasReferencedVariables,
|
|
10217
|
+
hasReferencedVariables2 as hasReferencedVariables,
|
|
9794
10218
|
prettifyBindExpression,
|
|
9795
10219
|
productSearchRowActiveIcon,
|
|
9796
10220
|
productSearchRowCategory,
|
|
@@ -9825,6 +10249,7 @@ export {
|
|
|
9825
10249
|
selectedItemIcon,
|
|
9826
10250
|
selectedItemInner,
|
|
9827
10251
|
selectedItemTitle,
|
|
10252
|
+
serializeVariablesEditorSerializedState,
|
|
9828
10253
|
serializeVariablesEditorState,
|
|
9829
10254
|
setVariablesEditorValue,
|
|
9830
10255
|
urlEncodeRequestParameter,
|