@uniformdev/mesh-sdk-react 19.173.1-alpha.17 → 19.173.2-alpha.258
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 +206 -126
- package/dist/index.d.ts +206 -126
- package/dist/index.esm.js +595 -399
- package/dist/index.js +682 -490
- package/dist/index.mjs +595 -399
- package/package.json +15 -14
package/dist/index.js
CHANGED
|
@@ -33,12 +33,13 @@ var src_exports = {};
|
|
|
33
33
|
__export(src_exports, {
|
|
34
34
|
$createVariableNode: () => $createVariableNode,
|
|
35
35
|
$isVariableNode: () => $isVariableNode,
|
|
36
|
-
AddListButton: () =>
|
|
37
|
-
Button: () =>
|
|
36
|
+
AddListButton: () => import_design_system65.AddListButton,
|
|
37
|
+
Button: () => import_design_system65.Button,
|
|
38
38
|
CHECKBOX_OPERATORS: () => CHECKBOX_OPERATORS,
|
|
39
|
-
Callout: () =>
|
|
39
|
+
Callout: () => import_design_system65.Callout,
|
|
40
40
|
ControlledValuePlugin: () => ControlledValuePlugin,
|
|
41
41
|
DATE_OPERATORS: () => DATE_OPERATORS,
|
|
42
|
+
DATE_TIME_OPERATORS: () => DATE_TIME_OPERATORS,
|
|
42
43
|
DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
|
|
43
44
|
DamSelectedItem: () => DamSelectedItem,
|
|
44
45
|
DataRefreshButton: () => DataRefreshButton,
|
|
@@ -51,7 +52,7 @@ __export(src_exports, {
|
|
|
51
52
|
DateRangeEditor: () => DateRangeEditor,
|
|
52
53
|
DefaultSearchRow: () => DefaultSearchRow,
|
|
53
54
|
DefaultSelectedItem: () => DefaultSelectedItem,
|
|
54
|
-
DrawerContent: () =>
|
|
55
|
+
DrawerContent: () => import_design_system65.DrawerContent,
|
|
55
56
|
EDIT_VARIABLE_COMMAND: () => EDIT_VARIABLE_COMMAND,
|
|
56
57
|
EntrySearch: () => EntrySearch,
|
|
57
58
|
FilterButton: () => FilterButton2,
|
|
@@ -62,22 +63,22 @@ __export(src_exports, {
|
|
|
62
63
|
FilterMenu: () => FilterMenu,
|
|
63
64
|
FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
|
|
64
65
|
FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
|
|
65
|
-
Heading: () =>
|
|
66
|
+
Heading: () => import_design_system65.Heading,
|
|
66
67
|
INSERT_VARIABLE_COMMAND: () => INSERT_VARIABLE_COMMAND,
|
|
67
68
|
Icons: () => icons_exports,
|
|
68
|
-
Input: () =>
|
|
69
|
-
InputComboBox: () =>
|
|
70
|
-
InputKeywordSearch: () =>
|
|
71
|
-
InputSelect: () =>
|
|
72
|
-
InputToggle: () =>
|
|
69
|
+
Input: () => import_design_system65.Input,
|
|
70
|
+
InputComboBox: () => import_design_system65.InputComboBox,
|
|
71
|
+
InputKeywordSearch: () => import_design_system65.InputKeywordSearch,
|
|
72
|
+
InputSelect: () => import_design_system65.InputSelect,
|
|
73
|
+
InputToggle: () => import_design_system65.InputToggle,
|
|
73
74
|
InputVariables: () => InputVariables,
|
|
74
|
-
Label: () =>
|
|
75
|
+
Label: () => import_design_system65.Label,
|
|
75
76
|
LinkButton: () => LinkButton,
|
|
76
|
-
LoadingIndicator: () =>
|
|
77
|
-
LoadingOverlay: () =>
|
|
77
|
+
LoadingIndicator: () => import_design_system65.LoadingIndicator,
|
|
78
|
+
LoadingOverlay: () => import_design_system65.LoadingOverlay,
|
|
78
79
|
MULTI_SELECT_OPERATORS: () => MULTI_SELECT_OPERATORS,
|
|
79
|
-
Menu: () =>
|
|
80
|
-
MenuItem: () =>
|
|
80
|
+
Menu: () => import_design_system65.Menu,
|
|
81
|
+
MenuItem: () => import_design_system65.MenuItem,
|
|
81
82
|
MeshApp: () => MeshApp,
|
|
82
83
|
NUMBER_OPERATORS: () => NUMBER_OPERATORS,
|
|
83
84
|
NumberEditor: () => NumberEditor,
|
|
@@ -96,22 +97,22 @@ __export(src_exports, {
|
|
|
96
97
|
PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
|
|
97
98
|
ParamTypeDynamicDataProvider: () => ParamTypeDynamicDataProvider,
|
|
98
99
|
ParameterConnectionIndicator: () => ParameterConnectionIndicator,
|
|
99
|
-
ParameterGroup: () =>
|
|
100
|
-
ParameterImage: () =>
|
|
101
|
-
ParameterImageInner: () =>
|
|
102
|
-
ParameterInput: () =>
|
|
103
|
-
ParameterInputInner: () =>
|
|
104
|
-
ParameterLabel: () =>
|
|
105
|
-
ParameterMenuButton: () =>
|
|
100
|
+
ParameterGroup: () => import_design_system65.ParameterGroup,
|
|
101
|
+
ParameterImage: () => import_design_system65.ParameterImage,
|
|
102
|
+
ParameterImageInner: () => import_design_system65.ParameterImageInner,
|
|
103
|
+
ParameterInput: () => import_design_system65.ParameterInput,
|
|
104
|
+
ParameterInputInner: () => import_design_system65.ParameterInputInner,
|
|
105
|
+
ParameterLabel: () => import_design_system65.ParameterLabel,
|
|
106
|
+
ParameterMenuButton: () => import_design_system65.ParameterMenuButton,
|
|
106
107
|
ParameterOrSingleVariable: () => ParameterOrSingleVariable,
|
|
107
|
-
ParameterSelect: () =>
|
|
108
|
-
ParameterSelectInner: () =>
|
|
109
|
-
ParameterShell: () =>
|
|
108
|
+
ParameterSelect: () => import_design_system65.ParameterSelect,
|
|
109
|
+
ParameterSelectInner: () => import_design_system65.ParameterSelectInner,
|
|
110
|
+
ParameterShell: () => import_design_system65.ParameterShell,
|
|
110
111
|
ParameterShellContext: () => import_design_system14.ParameterShellContext,
|
|
111
|
-
ParameterTextarea: () =>
|
|
112
|
-
ParameterTextareaInner: () =>
|
|
113
|
-
ParameterToggle: () =>
|
|
114
|
-
ParameterToggleInner: () =>
|
|
112
|
+
ParameterTextarea: () => import_design_system65.ParameterTextarea,
|
|
113
|
+
ParameterTextareaInner: () => import_design_system65.ParameterTextareaInner,
|
|
114
|
+
ParameterToggle: () => import_design_system65.ParameterToggle,
|
|
115
|
+
ParameterToggleInner: () => import_design_system65.ParameterToggleInner,
|
|
115
116
|
ParameterVariables: () => ParameterVariables,
|
|
116
117
|
ProductPreviewList: () => ProductPreviewList,
|
|
117
118
|
ProductQuery: () => ProductQuery,
|
|
@@ -132,10 +133,9 @@ __export(src_exports, {
|
|
|
132
133
|
RequestUrlInput: () => RequestUrlInput,
|
|
133
134
|
ResolvableLoadingValue: () => ResolvableLoadingValue,
|
|
134
135
|
SELECT_OPERATORS: () => SELECT_OPERATORS,
|
|
135
|
-
SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
|
|
136
136
|
SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
|
|
137
|
-
ScrollableList: () =>
|
|
138
|
-
ScrollableListItem: () =>
|
|
137
|
+
ScrollableList: () => import_design_system65.ScrollableList,
|
|
138
|
+
ScrollableListItem: () => import_design_system65.ScrollableListItem,
|
|
139
139
|
SearchAndFilter: () => SearchAndFilter,
|
|
140
140
|
SearchAndFilterContext: () => SearchAndFilterContext,
|
|
141
141
|
SearchAndFilterOptionsContainer: () => SearchAndFilterOptionsContainer2,
|
|
@@ -147,13 +147,13 @@ __export(src_exports, {
|
|
|
147
147
|
SortItems: () => SortItems,
|
|
148
148
|
StatusMultiEditor: () => StatusMultiEditor,
|
|
149
149
|
StatusSingleEditor: () => StatusSingleEditor,
|
|
150
|
-
Switch: () =>
|
|
150
|
+
Switch: () => import_design_system65.Switch,
|
|
151
151
|
TEXTBOX_OPERATORS: () => TEXTBOX_OPERATORS,
|
|
152
152
|
TextEditor: () => TextEditor,
|
|
153
153
|
TextMultiChoiceEditor: () => TextMultiChoiceEditor,
|
|
154
154
|
TextVariableRenderer: () => TextVariableRenderer,
|
|
155
|
-
Textarea: () =>
|
|
156
|
-
Theme: () =>
|
|
155
|
+
Textarea: () => import_design_system65.Textarea,
|
|
156
|
+
Theme: () => import_design_system65.Theme,
|
|
157
157
|
USER_OPERATORS: () => USER_OPERATORS,
|
|
158
158
|
VariableChip: () => VariableChip,
|
|
159
159
|
VariableEditor: () => VariableEditor,
|
|
@@ -194,7 +194,7 @@ __export(src_exports, {
|
|
|
194
194
|
entrySearchSelectOption: () => entrySearchSelectOption,
|
|
195
195
|
entrySearchWrapper: () => entrySearchWrapper,
|
|
196
196
|
filterMapper: () => filterMapper,
|
|
197
|
-
hasReferencedVariables: () =>
|
|
197
|
+
hasReferencedVariables: () => hasReferencedVariables2,
|
|
198
198
|
prettifyBindExpression: () => prettifyBindExpression,
|
|
199
199
|
productSearchRowActiveIcon: () => productSearchRowActiveIcon,
|
|
200
200
|
productSearchRowCategory: () => productSearchRowCategory,
|
|
@@ -229,6 +229,7 @@ __export(src_exports, {
|
|
|
229
229
|
selectedItemIcon: () => selectedItemIcon,
|
|
230
230
|
selectedItemInner: () => selectedItemInner,
|
|
231
231
|
selectedItemTitle: () => selectedItemTitle,
|
|
232
|
+
serializeVariablesEditorSerializedState: () => serializeVariablesEditorSerializedState,
|
|
232
233
|
serializeVariablesEditorState: () => serializeVariablesEditorState,
|
|
233
234
|
setVariablesEditorValue: () => setVariablesEditorValue,
|
|
234
235
|
urlEncodeRequestParameter: () => urlEncodeRequestParameter,
|
|
@@ -249,7 +250,7 @@ __export(src_exports, {
|
|
|
249
250
|
useVariableEditor: () => useVariableEditor,
|
|
250
251
|
useVariables: () => useVariables,
|
|
251
252
|
useVariablesMenu: () => useVariablesMenu,
|
|
252
|
-
utilityColors: () =>
|
|
253
|
+
utilityColors: () => import_design_system65.utilityColors,
|
|
253
254
|
variableDefaultTextValue: () => variableDefaultTextValue,
|
|
254
255
|
variablePrefix: () => variablePrefix,
|
|
255
256
|
variableSuffix: () => variableSuffix,
|
|
@@ -1220,7 +1221,8 @@ var searchRowContainer = import_react8.css`
|
|
|
1220
1221
|
cursor: pointer;
|
|
1221
1222
|
padding: var(--spacing-sm);
|
|
1222
1223
|
position: relative;
|
|
1223
|
-
transition:
|
|
1224
|
+
transition:
|
|
1225
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
1224
1226
|
color var(--duration-fast) var(--timing-ease-out);
|
|
1225
1227
|
`;
|
|
1226
1228
|
var searchRowContainerWithPopover = import_react8.css`
|
|
@@ -2200,7 +2202,8 @@ var productSearchRowContainer = import_react18.css`
|
|
|
2200
2202
|
padding: var(--spacing-sm) 0;
|
|
2201
2203
|
margin-right: var(--spacing-sm);
|
|
2202
2204
|
position: relative;
|
|
2203
|
-
transition:
|
|
2205
|
+
transition:
|
|
2206
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
2204
2207
|
color var(--duration-fast) var(--timing-ease-out);
|
|
2205
2208
|
`;
|
|
2206
2209
|
var productSearchRowContent = import_react18.css`
|
|
@@ -3036,18 +3039,60 @@ var import_design_system14 = require("@uniformdev/design-system");
|
|
|
3036
3039
|
|
|
3037
3040
|
// src/components/Variables/composer/ControlledValuePlugin.tsx
|
|
3038
3041
|
var import_LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
3039
|
-
var import_lite = require("dequal/lite");
|
|
3040
3042
|
var import_react31 = require("react");
|
|
3041
3043
|
|
|
3042
|
-
// src/components/Variables/util/
|
|
3044
|
+
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
3043
3045
|
var import_canvas2 = require("@uniformdev/canvas");
|
|
3044
3046
|
var import_lexical = require("lexical");
|
|
3047
|
+
|
|
3048
|
+
// src/components/Variables/util/variableExpression.ts
|
|
3049
|
+
var variablePrefix = "${";
|
|
3050
|
+
var variableSuffix = "}";
|
|
3051
|
+
|
|
3052
|
+
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
3053
|
+
function serializeVariablesEditorState(editorState) {
|
|
3054
|
+
return serializeVariablesEditorSerializedState(editorState.toJSON().root);
|
|
3055
|
+
}
|
|
3056
|
+
function serializeVariablesEditorSerializedState(serializedEditorState) {
|
|
3057
|
+
const buf = [];
|
|
3058
|
+
if (serializedEditorState) {
|
|
3059
|
+
serializeRecursive(serializedEditorState, buf);
|
|
3060
|
+
}
|
|
3061
|
+
const result = buf.join("");
|
|
3062
|
+
return result.length > 0 ? result : void 0;
|
|
3063
|
+
}
|
|
3064
|
+
function serializeRecursive(node, buffer) {
|
|
3065
|
+
if (node.type === import_lexical.TextNode.getType()) {
|
|
3066
|
+
buffer.push(node.text.replace(variablePrefix, "\\${"));
|
|
3067
|
+
}
|
|
3068
|
+
if (node.type === VariableNode.getType()) {
|
|
3069
|
+
buffer.push((0, import_canvas2.createVariableReference)(node.reference));
|
|
3070
|
+
}
|
|
3071
|
+
if (node.type === import_lexical.LineBreakNode.getType()) {
|
|
3072
|
+
buffer.push("\n");
|
|
3073
|
+
}
|
|
3074
|
+
if ("children" in node && node.children) {
|
|
3075
|
+
for (const child of node.children) {
|
|
3076
|
+
if (!child) {
|
|
3077
|
+
continue;
|
|
3078
|
+
}
|
|
3079
|
+
serializeRecursive(child, buffer);
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
// src/components/Variables/util/setVariablesEditorValue.ts
|
|
3085
|
+
var import_richtext = require("@uniformdev/richtext");
|
|
3086
|
+
|
|
3087
|
+
// src/components/Variables/util/deserializeVariablesEditorState.ts
|
|
3088
|
+
var import_canvas3 = require("@uniformdev/canvas");
|
|
3089
|
+
var import_lexical2 = require("lexical");
|
|
3045
3090
|
function deserializeVariablesEditorState(serialized) {
|
|
3046
3091
|
const result = [];
|
|
3047
|
-
(0,
|
|
3092
|
+
(0, import_canvas3.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
|
|
3048
3093
|
if (type === "text") {
|
|
3049
3094
|
const node = {
|
|
3050
|
-
type:
|
|
3095
|
+
type: import_lexical2.TextNode.getType(),
|
|
3051
3096
|
text: token,
|
|
3052
3097
|
mode: "normal",
|
|
3053
3098
|
version: 1,
|
|
@@ -3089,11 +3134,11 @@ function deserializeVariablesEditorState(serialized) {
|
|
|
3089
3134
|
}
|
|
3090
3135
|
|
|
3091
3136
|
// src/components/Variables/util/refreshVariableNodeMetadata.ts
|
|
3092
|
-
var
|
|
3137
|
+
var import_lexical3 = require("lexical");
|
|
3093
3138
|
function refreshVariableNodeMetadata(editor) {
|
|
3094
3139
|
setTimeout(() => {
|
|
3095
3140
|
editor.update(() => {
|
|
3096
|
-
(0,
|
|
3141
|
+
(0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
3097
3142
|
variableNode.markDirty();
|
|
3098
3143
|
});
|
|
3099
3144
|
});
|
|
@@ -3101,14 +3146,18 @@ function refreshVariableNodeMetadata(editor) {
|
|
|
3101
3146
|
}
|
|
3102
3147
|
|
|
3103
3148
|
// src/components/Variables/util/setVariablesEditorValue.ts
|
|
3104
|
-
function setVariablesEditorValue(editor, newValue) {
|
|
3149
|
+
function setVariablesEditorValue(editor, newValue, tag) {
|
|
3105
3150
|
if (typeof newValue === "undefined" || typeof newValue === "string") {
|
|
3106
3151
|
const parsedState = editor.parseEditorState(deserializeVariablesEditorState(newValue));
|
|
3107
|
-
editor.setEditorState(parsedState)
|
|
3152
|
+
editor.setEditorState(parsedState.clone(null), {
|
|
3153
|
+
tag
|
|
3154
|
+
});
|
|
3108
3155
|
} else {
|
|
3109
3156
|
try {
|
|
3110
3157
|
const parsedState = editor.parseEditorState(newValue);
|
|
3111
|
-
editor.setEditorState(parsedState)
|
|
3158
|
+
editor.setEditorState(parsedState.clone(null), {
|
|
3159
|
+
tag
|
|
3160
|
+
});
|
|
3112
3161
|
} catch (e) {
|
|
3113
3162
|
console.warn(
|
|
3114
3163
|
"Tried to set invalid Lexical state, probably invalidly formatted state object - falling back to empty state. Invalid state attempted:",
|
|
@@ -3116,27 +3165,10 @@ function setVariablesEditorValue(editor, newValue) {
|
|
|
3116
3165
|
"Error:",
|
|
3117
3166
|
e
|
|
3118
3167
|
);
|
|
3119
|
-
const parsedState = editor.parseEditorState(
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
version: 1,
|
|
3123
|
-
direction: null,
|
|
3124
|
-
format: "",
|
|
3125
|
-
indent: 0,
|
|
3126
|
-
children: [
|
|
3127
|
-
{
|
|
3128
|
-
type: "paragraph",
|
|
3129
|
-
version: 1,
|
|
3130
|
-
format: "start",
|
|
3131
|
-
indent: 0,
|
|
3132
|
-
direction: null,
|
|
3133
|
-
children: [],
|
|
3134
|
-
textFormat: 0
|
|
3135
|
-
}
|
|
3136
|
-
]
|
|
3137
|
-
}
|
|
3168
|
+
const parsedState = editor.parseEditorState(import_richtext.emptyRichTextValue);
|
|
3169
|
+
editor.setEditorState(parsedState.clone(null), {
|
|
3170
|
+
tag
|
|
3138
3171
|
});
|
|
3139
|
-
editor.setEditorState(parsedState);
|
|
3140
3172
|
}
|
|
3141
3173
|
}
|
|
3142
3174
|
refreshVariableNodeMetadata(editor);
|
|
@@ -3149,17 +3181,18 @@ function ControlledValuePlugin({
|
|
|
3149
3181
|
extraDependencies
|
|
3150
3182
|
}) {
|
|
3151
3183
|
const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
|
|
3152
|
-
const lastValueRef = (0, import_react31.useRef)(value);
|
|
3153
3184
|
(0, import_react31.useEffect)(() => {
|
|
3185
|
+
var _a, _b;
|
|
3154
3186
|
if (!enabled) {
|
|
3155
3187
|
return;
|
|
3156
3188
|
}
|
|
3157
|
-
|
|
3189
|
+
const currentValue = (_a = serializeVariablesEditorState(editor.getEditorState())) != null ? _a : "";
|
|
3190
|
+
const newValue = (_b = value !== void 0 && typeof value !== "string" ? serializeVariablesEditorSerializedState(value.root) : value) != null ? _b : "";
|
|
3191
|
+
if (currentValue === newValue) {
|
|
3158
3192
|
return;
|
|
3159
3193
|
}
|
|
3160
3194
|
setTimeout(() => {
|
|
3161
3195
|
if (editor) {
|
|
3162
|
-
lastValueRef.current = value;
|
|
3163
3196
|
setVariablesEditorValue(editor, value);
|
|
3164
3197
|
}
|
|
3165
3198
|
});
|
|
@@ -3248,9 +3281,9 @@ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerCont
|
|
|
3248
3281
|
var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
|
|
3249
3282
|
var import_selection = require("@lexical/selection");
|
|
3250
3283
|
var import_utils2 = require("@lexical/utils");
|
|
3251
|
-
var
|
|
3284
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
3252
3285
|
var import_design_system18 = require("@uniformdev/design-system");
|
|
3253
|
-
var
|
|
3286
|
+
var import_lexical5 = require("lexical");
|
|
3254
3287
|
var import_react40 = require("react");
|
|
3255
3288
|
|
|
3256
3289
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
@@ -3265,10 +3298,10 @@ var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerCont
|
|
|
3265
3298
|
var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
|
|
3266
3299
|
var import_utils = require("@lexical/utils");
|
|
3267
3300
|
var import_AiFillPlusCircle = require("@react-icons/all-files/ai/AiFillPlusCircle");
|
|
3268
|
-
var
|
|
3301
|
+
var import_canvas4 = require("@uniformdev/canvas");
|
|
3269
3302
|
var import_design_system17 = require("@uniformdev/design-system");
|
|
3270
|
-
var
|
|
3271
|
-
var
|
|
3303
|
+
var import_lite = require("dequal/lite");
|
|
3304
|
+
var import_lexical4 = require("lexical");
|
|
3272
3305
|
var import_react39 = require("react");
|
|
3273
3306
|
var import_react_dom = require("react-dom");
|
|
3274
3307
|
|
|
@@ -3723,12 +3756,12 @@ function variablesToGroupedList(variables, filterFn, context) {
|
|
|
3723
3756
|
|
|
3724
3757
|
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3725
3758
|
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
3726
|
-
var OPEN_INSERT_VARIABLE_COMMAND = (0,
|
|
3727
|
-
var EDIT_VARIABLE_COMMAND = (0,
|
|
3728
|
-
var DISCONNECT_VARIABLE_COMMAND = (0,
|
|
3759
|
+
var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:open-insert-variable");
|
|
3760
|
+
var EDIT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:edit-variable");
|
|
3761
|
+
var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)(
|
|
3729
3762
|
"uniform:disconnect-variable"
|
|
3730
3763
|
);
|
|
3731
|
-
var INSERT_VARIABLE_COMMAND = (0,
|
|
3764
|
+
var INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:insert-variable");
|
|
3732
3765
|
var TRIGGER = "\\$\\$";
|
|
3733
3766
|
var LENGTH_LIMIT = 20;
|
|
3734
3767
|
var DollarSignVariablesRegex = new RegExp(`(^.*)(${TRIGGER}(.{0,${LENGTH_LIMIT}}))$`);
|
|
@@ -3798,7 +3831,7 @@ function useVariablesMenu({
|
|
|
3798
3831
|
var _a;
|
|
3799
3832
|
const targetVariable = variables[value];
|
|
3800
3833
|
if (overwriteExistingValue) {
|
|
3801
|
-
setVariablesEditorValue(editor, (0,
|
|
3834
|
+
setVariablesEditorValue(editor, (0, import_canvas4.createVariableReference)(value));
|
|
3802
3835
|
return true;
|
|
3803
3836
|
}
|
|
3804
3837
|
const variableNode = $createVariableNode(value, {
|
|
@@ -3812,7 +3845,7 @@ function useVariablesMenu({
|
|
|
3812
3845
|
if (nodeToReplace) {
|
|
3813
3846
|
nodeToReplace.replace(variableNode);
|
|
3814
3847
|
} else {
|
|
3815
|
-
(0,
|
|
3848
|
+
(0, import_lexical4.$insertNodes)([variableNode]);
|
|
3816
3849
|
}
|
|
3817
3850
|
});
|
|
3818
3851
|
}
|
|
@@ -3895,11 +3928,11 @@ function VariablesPlugin({
|
|
|
3895
3928
|
return;
|
|
3896
3929
|
}
|
|
3897
3930
|
editor.update(() => {
|
|
3898
|
-
const selection = (0,
|
|
3899
|
-
if ((0,
|
|
3931
|
+
const selection = (0, import_lexical4.$getSelection)();
|
|
3932
|
+
if ((0, import_lexical4.$isNodeSelection)(selection)) {
|
|
3900
3933
|
const selectedNodes = selection.getNodes();
|
|
3901
3934
|
if (selectedNodes.every((node) => $isVariableNode(node))) {
|
|
3902
|
-
(0,
|
|
3935
|
+
(0, import_lexical4.$setSelection)(null);
|
|
3903
3936
|
}
|
|
3904
3937
|
}
|
|
3905
3938
|
});
|
|
@@ -3915,7 +3948,7 @@ function VariablesPlugin({
|
|
|
3915
3948
|
}
|
|
3916
3949
|
return true;
|
|
3917
3950
|
},
|
|
3918
|
-
|
|
3951
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
3919
3952
|
),
|
|
3920
3953
|
// disconnects a variable node from its variable value and leaves the variable's default value
|
|
3921
3954
|
// as a string literal in its place. Note that single-valued binding UIs override this so that it
|
|
@@ -3925,17 +3958,17 @@ function VariablesPlugin({
|
|
|
3925
3958
|
({ sourceKey }) => {
|
|
3926
3959
|
editor.update(() => {
|
|
3927
3960
|
var _a;
|
|
3928
|
-
const currentNode = (0,
|
|
3961
|
+
const currentNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
|
|
3929
3962
|
if (!$isVariableNode(currentNode)) {
|
|
3930
3963
|
throw new Error("Cannot disconnect a non-variable node");
|
|
3931
3964
|
}
|
|
3932
3965
|
const currentVariableDefinition = variablesRef.current.variables[currentNode.reference];
|
|
3933
|
-
const variableTextNode = (0,
|
|
3966
|
+
const variableTextNode = (0, import_lexical4.$createTextNode)(
|
|
3934
3967
|
variableDefaultTextValue(
|
|
3935
3968
|
(_a = currentVariableDefinition == null ? void 0 : currentVariableDefinition.default) != null ? _a : currentNode.getState().displayName
|
|
3936
3969
|
)
|
|
3937
3970
|
);
|
|
3938
|
-
const variableNode = (0,
|
|
3971
|
+
const variableNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
|
|
3939
3972
|
if (!variableNode) {
|
|
3940
3973
|
console.error("Disconnected from unknown node.");
|
|
3941
3974
|
return true;
|
|
@@ -3945,7 +3978,7 @@ function VariablesPlugin({
|
|
|
3945
3978
|
});
|
|
3946
3979
|
return true;
|
|
3947
3980
|
},
|
|
3948
|
-
|
|
3981
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
3949
3982
|
),
|
|
3950
3983
|
editor.registerCommand(
|
|
3951
3984
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
@@ -3965,7 +3998,7 @@ function VariablesPlugin({
|
|
|
3965
3998
|
}
|
|
3966
3999
|
return true;
|
|
3967
4000
|
},
|
|
3968
|
-
|
|
4001
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
3969
4002
|
),
|
|
3970
4003
|
// register the insert variable command, used to handle inserting
|
|
3971
4004
|
// a variable reference from non-autocomplete menus at the current selection,
|
|
@@ -3976,27 +4009,33 @@ function VariablesPlugin({
|
|
|
3976
4009
|
var _a, _b;
|
|
3977
4010
|
if (!disableVariables) {
|
|
3978
4011
|
const targetVariable = variablesRef.current.variables[reference];
|
|
3979
|
-
if (overwriteExistingValue) {
|
|
3980
|
-
setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(reference));
|
|
3981
|
-
return true;
|
|
3982
|
-
}
|
|
3983
4012
|
const variableNode = $createVariableNode(reference, {
|
|
3984
|
-
displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
|
|
4013
|
+
displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
|
|
3985
4014
|
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
3986
4015
|
referenceIsValid: true,
|
|
3987
4016
|
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
3988
4017
|
isFresh: true,
|
|
3989
4018
|
isLoading: false
|
|
3990
4019
|
});
|
|
4020
|
+
if (overwriteExistingValue) {
|
|
4021
|
+
const pNode = (0, import_lexical4.$createParagraphNode)();
|
|
4022
|
+
pNode.append(variableNode);
|
|
4023
|
+
editor.update(() => {
|
|
4024
|
+
const root = (0, import_lexical4.$getRoot)();
|
|
4025
|
+
root.clear();
|
|
4026
|
+
root.append(pNode);
|
|
4027
|
+
});
|
|
4028
|
+
return true;
|
|
4029
|
+
}
|
|
3991
4030
|
if (targetKey) {
|
|
3992
|
-
(_b = (0,
|
|
4031
|
+
(_b = (0, import_lexical4.$getNodeByKey)(targetKey)) == null ? void 0 : _b.replace(variableNode);
|
|
3993
4032
|
} else {
|
|
3994
|
-
(0,
|
|
4033
|
+
(0, import_lexical4.$insertNodes)([variableNode]);
|
|
3995
4034
|
}
|
|
3996
4035
|
}
|
|
3997
4036
|
return true;
|
|
3998
4037
|
},
|
|
3999
|
-
|
|
4038
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
4000
4039
|
)
|
|
4001
4040
|
);
|
|
4002
4041
|
}, [
|
|
@@ -4023,14 +4062,14 @@ function VariablesPlugin({
|
|
|
4023
4062
|
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;
|
|
4024
4063
|
const newState = {
|
|
4025
4064
|
...currentState,
|
|
4026
|
-
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
|
|
4065
|
+
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
|
|
4027
4066
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
4028
4067
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
4029
4068
|
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),
|
|
4030
4069
|
tooltip,
|
|
4031
4070
|
isFresh: false
|
|
4032
4071
|
};
|
|
4033
|
-
if (!(0,
|
|
4072
|
+
if (!(0, import_lite.dequal)(currentState, newState)) {
|
|
4034
4073
|
variableNode.setState(newState);
|
|
4035
4074
|
}
|
|
4036
4075
|
},
|
|
@@ -4038,7 +4077,7 @@ function VariablesPlugin({
|
|
|
4038
4077
|
);
|
|
4039
4078
|
(0, import_react39.useEffect)(() => {
|
|
4040
4079
|
editor.update(() => {
|
|
4041
|
-
(0,
|
|
4080
|
+
(0, import_lexical4.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
4042
4081
|
updateExistingNodeIfChanged(variableNode);
|
|
4043
4082
|
});
|
|
4044
4083
|
});
|
|
@@ -4128,7 +4167,7 @@ function VariablesPlugin({
|
|
|
4128
4167
|
|
|
4129
4168
|
// src/components/Variables/composer/VariableNode.tsx
|
|
4130
4169
|
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
4131
|
-
var VariableNode = class _VariableNode extends
|
|
4170
|
+
var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
|
|
4132
4171
|
constructor(reference, state, key) {
|
|
4133
4172
|
super(key);
|
|
4134
4173
|
this.reference = reference;
|
|
@@ -4177,7 +4216,7 @@ var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
|
|
|
4177
4216
|
* (albeit it won't get the fancy chip-node)
|
|
4178
4217
|
*/
|
|
4179
4218
|
getTextContent() {
|
|
4180
|
-
return (0,
|
|
4219
|
+
return (0, import_canvas5.createVariableReference)(this.reference);
|
|
4181
4220
|
}
|
|
4182
4221
|
/** Creates the DOM wrapper that hosts the node */
|
|
4183
4222
|
createDOM() {
|
|
@@ -4211,9 +4250,9 @@ function VariableNodeComponent({
|
|
|
4211
4250
|
const readOnly = !editor.isEditable();
|
|
4212
4251
|
const onDelete = (0, import_react40.useCallback)(
|
|
4213
4252
|
(event) => {
|
|
4214
|
-
if (isSelected && (0,
|
|
4253
|
+
if (isSelected && (0, import_lexical5.$isNodeSelection)((0, import_lexical5.$getSelection)())) {
|
|
4215
4254
|
event.preventDefault();
|
|
4216
|
-
const node = (0,
|
|
4255
|
+
const node = (0, import_lexical5.$getNodeByKey)(nodeKey);
|
|
4217
4256
|
if ($isVariableNode(node)) {
|
|
4218
4257
|
node.remove();
|
|
4219
4258
|
}
|
|
@@ -4224,18 +4263,18 @@ function VariableNodeComponent({
|
|
|
4224
4263
|
);
|
|
4225
4264
|
(0, import_react40.useEffect)(() => {
|
|
4226
4265
|
return (0, import_utils2.mergeRegister)(
|
|
4227
|
-
editor.registerCommand(
|
|
4228
|
-
editor.registerCommand(
|
|
4266
|
+
editor.registerCommand(import_lexical5.KEY_DELETE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
|
|
4267
|
+
editor.registerCommand(import_lexical5.KEY_BACKSPACE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
|
|
4229
4268
|
// HACK: see https://github.com/facebook/lexical/issues/4214
|
|
4230
4269
|
// Copied from https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L775
|
|
4231
4270
|
// Fixes selection moving into and out of this node with arrow keys and plain text plugin.
|
|
4232
4271
|
// If the above bug is fixed this may be removable. It's been tested when this is used within the RTE,
|
|
4233
4272
|
// and seems to work ok there. It should also unregister itself when not in the context of the node. I think?
|
|
4234
4273
|
editor.registerCommand(
|
|
4235
|
-
|
|
4274
|
+
import_lexical5.KEY_ARROW_LEFT_COMMAND,
|
|
4236
4275
|
(event) => {
|
|
4237
|
-
const selection = (0,
|
|
4238
|
-
if ((0,
|
|
4276
|
+
const selection = (0, import_lexical5.$getSelection)();
|
|
4277
|
+
if ((0, import_lexical5.$isNodeSelection)(selection)) {
|
|
4239
4278
|
const nodes = selection.getNodes();
|
|
4240
4279
|
if (nodes.length > 0) {
|
|
4241
4280
|
event.preventDefault();
|
|
@@ -4243,7 +4282,7 @@ function VariableNodeComponent({
|
|
|
4243
4282
|
return true;
|
|
4244
4283
|
}
|
|
4245
4284
|
}
|
|
4246
|
-
if (!(0,
|
|
4285
|
+
if (!(0, import_lexical5.$isRangeSelection)(selection)) {
|
|
4247
4286
|
return false;
|
|
4248
4287
|
}
|
|
4249
4288
|
if ((0, import_selection.$shouldOverrideDefaultCharacterSelection)(selection, true)) {
|
|
@@ -4254,15 +4293,15 @@ function VariableNodeComponent({
|
|
|
4254
4293
|
}
|
|
4255
4294
|
return false;
|
|
4256
4295
|
},
|
|
4257
|
-
|
|
4296
|
+
import_lexical5.COMMAND_PRIORITY_EDITOR
|
|
4258
4297
|
),
|
|
4259
4298
|
// HACK: as above
|
|
4260
4299
|
// Source: https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L802C5-L831C7
|
|
4261
4300
|
editor.registerCommand(
|
|
4262
|
-
|
|
4301
|
+
import_lexical5.KEY_ARROW_RIGHT_COMMAND,
|
|
4263
4302
|
(event) => {
|
|
4264
|
-
const selection = (0,
|
|
4265
|
-
if ((0,
|
|
4303
|
+
const selection = (0, import_lexical5.$getSelection)();
|
|
4304
|
+
if ((0, import_lexical5.$isNodeSelection)(selection) && !$isTargetWithinDecorator(event.target)) {
|
|
4266
4305
|
const nodes = selection.getNodes();
|
|
4267
4306
|
if (nodes.length > 0) {
|
|
4268
4307
|
event.preventDefault();
|
|
@@ -4270,7 +4309,7 @@ function VariableNodeComponent({
|
|
|
4270
4309
|
return true;
|
|
4271
4310
|
}
|
|
4272
4311
|
}
|
|
4273
|
-
if (!(0,
|
|
4312
|
+
if (!(0, import_lexical5.$isRangeSelection)(selection)) {
|
|
4274
4313
|
return false;
|
|
4275
4314
|
}
|
|
4276
4315
|
const isHoldingShift = event.shiftKey;
|
|
@@ -4281,7 +4320,7 @@ function VariableNodeComponent({
|
|
|
4281
4320
|
}
|
|
4282
4321
|
return false;
|
|
4283
4322
|
},
|
|
4284
|
-
|
|
4323
|
+
import_lexical5.COMMAND_PRIORITY_EDITOR
|
|
4285
4324
|
)
|
|
4286
4325
|
);
|
|
4287
4326
|
}, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
|
|
@@ -4305,8 +4344,8 @@ function VariableNodeComponent({
|
|
|
4305
4344
|
);
|
|
4306
4345
|
}
|
|
4307
4346
|
function $isTargetWithinDecorator(target) {
|
|
4308
|
-
const node = (0,
|
|
4309
|
-
return (0,
|
|
4347
|
+
const node = (0, import_lexical5.$getNearestNodeFromDOMNode)(target);
|
|
4348
|
+
return (0, import_lexical5.$isDecoratorNode)(node);
|
|
4310
4349
|
}
|
|
4311
4350
|
|
|
4312
4351
|
// src/components/Variables/InputVariables.tsx
|
|
@@ -4332,19 +4371,19 @@ function EditorRefPlugin({
|
|
|
4332
4371
|
// src/components/Variables/composer/PasteTransformerPlugin.tsx
|
|
4333
4372
|
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
4334
4373
|
var import_utils3 = require("@lexical/utils");
|
|
4335
|
-
var
|
|
4374
|
+
var import_lexical6 = require("lexical");
|
|
4336
4375
|
var import_react41 = require("react");
|
|
4337
4376
|
function PasteTransformerPlugin({ transformPaste }) {
|
|
4338
4377
|
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
4339
4378
|
(0, import_react41.useEffect)(() => {
|
|
4340
4379
|
return (0, import_utils3.mergeRegister)(
|
|
4341
4380
|
editor.registerCommand(
|
|
4342
|
-
|
|
4381
|
+
import_lexical6.PASTE_COMMAND,
|
|
4343
4382
|
(event) => {
|
|
4344
4383
|
var _a;
|
|
4345
|
-
const selection = (0,
|
|
4384
|
+
const selection = (0, import_lexical6.$getSelection)();
|
|
4346
4385
|
const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
|
|
4347
|
-
if (pastedText && transformPaste && (0,
|
|
4386
|
+
if (pastedText && transformPaste && (0, import_lexical6.$isRangeSelection)(selection)) {
|
|
4348
4387
|
const result = transformPaste(pastedText);
|
|
4349
4388
|
if (result !== void 0) {
|
|
4350
4389
|
selection.insertText(result);
|
|
@@ -4353,7 +4392,7 @@ function PasteTransformerPlugin({ transformPaste }) {
|
|
|
4353
4392
|
}
|
|
4354
4393
|
return false;
|
|
4355
4394
|
},
|
|
4356
|
-
|
|
4395
|
+
import_lexical6.COMMAND_PRIORITY_HIGH
|
|
4357
4396
|
)
|
|
4358
4397
|
);
|
|
4359
4398
|
}, [editor, transformPaste]);
|
|
@@ -4382,9 +4421,11 @@ var input = import_react42.css`
|
|
|
4382
4421
|
min-height: 50px;
|
|
4383
4422
|
width: 100%;
|
|
4384
4423
|
position: relative;
|
|
4385
|
-
transition:
|
|
4424
|
+
transition:
|
|
4425
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4386
4426
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
4387
|
-
color var(--duration-fast) var(--timing-ease-out),
|
|
4427
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
4428
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
4388
4429
|
|
|
4389
4430
|
&::placeholder {
|
|
4390
4431
|
color: var(--gray-400);
|
|
@@ -4448,7 +4489,8 @@ var variableBindButton = import_react43.css`
|
|
|
4448
4489
|
display: flex;
|
|
4449
4490
|
height: 1.2rem;
|
|
4450
4491
|
padding: var(--spacing-2xs);
|
|
4451
|
-
transition:
|
|
4492
|
+
transition:
|
|
4493
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4452
4494
|
color var(--duration-fast) var(--timing-ease-out);
|
|
4453
4495
|
width: 1.2rem;
|
|
4454
4496
|
|
|
@@ -4531,23 +4573,9 @@ var inputMultiLine = (lines) => import_react43.css`
|
|
|
4531
4573
|
`;
|
|
4532
4574
|
|
|
4533
4575
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4576
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
4534
4577
|
var React10 = __toESM(require("react"));
|
|
4535
4578
|
var import_react44 = require("react");
|
|
4536
|
-
|
|
4537
|
-
// src/components/Variables/util/hasReferencedVariables.ts
|
|
4538
|
-
var import_canvas5 = require("@uniformdev/canvas");
|
|
4539
|
-
function hasReferencedVariables(value) {
|
|
4540
|
-
let result = false;
|
|
4541
|
-
(0, import_canvas5.parseVariableExpression)(value, (token, type) => {
|
|
4542
|
-
if (type === "variable") {
|
|
4543
|
-
result = true;
|
|
4544
|
-
return false;
|
|
4545
|
-
}
|
|
4546
|
-
});
|
|
4547
|
-
return result;
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4550
|
-
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4551
4579
|
function useInputVariablesState({
|
|
4552
4580
|
value,
|
|
4553
4581
|
onChange,
|
|
@@ -4562,20 +4590,20 @@ function useInputVariablesState({
|
|
|
4562
4590
|
renderMenuInPortal
|
|
4563
4591
|
}) {
|
|
4564
4592
|
const { variables } = useVariables(true);
|
|
4565
|
-
const
|
|
4593
|
+
const variableReferenceCountInValue = (0, import_canvas6.hasReferencedVariables)(value != null ? value : "");
|
|
4566
4594
|
const [lastKnownId] = React10.useState(id);
|
|
4567
|
-
const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(
|
|
4595
|
+
const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
|
|
4568
4596
|
React10.useEffect(() => {
|
|
4569
|
-
if (
|
|
4597
|
+
if (variableReferenceCountInValue) {
|
|
4570
4598
|
setHadVariablesInValue(true);
|
|
4571
4599
|
}
|
|
4572
|
-
}, [
|
|
4600
|
+
}, [variableReferenceCountInValue]);
|
|
4573
4601
|
React10.useEffect(() => {
|
|
4574
4602
|
if (id !== lastKnownId) {
|
|
4575
|
-
setHadVariablesInValue(
|
|
4603
|
+
setHadVariablesInValue(variableReferenceCountInValue > 0);
|
|
4576
4604
|
}
|
|
4577
|
-
}, [
|
|
4578
|
-
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue :
|
|
4605
|
+
}, [variableReferenceCountInValue, id, lastKnownId]);
|
|
4606
|
+
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
|
|
4579
4607
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4580
4608
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
4581
4609
|
const sharedMenuProps = (0, import_react44.useMemo)(
|
|
@@ -4604,7 +4632,7 @@ function useInputVariablesState({
|
|
|
4604
4632
|
return {
|
|
4605
4633
|
sharedMenuProps,
|
|
4606
4634
|
disableVariablesForReals,
|
|
4607
|
-
hasVariablesInValue,
|
|
4635
|
+
hasVariablesInValue: variableReferenceCountInValue > 0,
|
|
4608
4636
|
hadVariablesInValue: hadVariablesInValueForReals,
|
|
4609
4637
|
setHadVariablesInValue
|
|
4610
4638
|
};
|
|
@@ -4627,7 +4655,8 @@ var variableBindButton2 = import_react45.css`
|
|
|
4627
4655
|
display: flex;
|
|
4628
4656
|
height: 1.2rem;
|
|
4629
4657
|
padding: var(--spacing-2xs);
|
|
4630
|
-
transition:
|
|
4658
|
+
transition:
|
|
4659
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4631
4660
|
color var(--duration-fast) var(--timing-ease-out);
|
|
4632
4661
|
width: 1.2rem;
|
|
4633
4662
|
|
|
@@ -4645,7 +4674,7 @@ var variableBindButton2 = import_react45.css`
|
|
|
4645
4674
|
|
|
4646
4675
|
// src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
|
|
4647
4676
|
var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
|
|
4648
|
-
var
|
|
4677
|
+
var import_lexical7 = require("lexical");
|
|
4649
4678
|
|
|
4650
4679
|
// src/components/Variables/toolbox/SelectVariableMenu.tsx
|
|
4651
4680
|
var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
|
|
@@ -4753,7 +4782,7 @@ function VariablesComposerVariableMenu(props) {
|
|
|
4753
4782
|
};
|
|
4754
4783
|
const onResetVariable = () => {
|
|
4755
4784
|
var _a;
|
|
4756
|
-
editor.dispatchCommand(
|
|
4785
|
+
editor.dispatchCommand(import_lexical7.CLEAR_EDITOR_COMMAND, void 0);
|
|
4757
4786
|
(_a = props.onResetVariables) == null ? void 0 : _a.call(props);
|
|
4758
4787
|
};
|
|
4759
4788
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -4815,50 +4844,18 @@ function DisablePlugin({ disabled }) {
|
|
|
4815
4844
|
|
|
4816
4845
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4817
4846
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
4818
|
-
var
|
|
4847
|
+
var import_lexical8 = require("lexical");
|
|
4819
4848
|
var import_react48 = require("react");
|
|
4820
4849
|
function SingleLineTextPlugin() {
|
|
4821
4850
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
4822
4851
|
(0, import_react48.useEffect)(() => {
|
|
4823
|
-
editor.registerNodeTransform(
|
|
4852
|
+
editor.registerNodeTransform(import_lexical8.LineBreakNode, (node) => {
|
|
4824
4853
|
node.remove();
|
|
4825
4854
|
});
|
|
4826
4855
|
}, [editor]);
|
|
4827
4856
|
return null;
|
|
4828
4857
|
}
|
|
4829
4858
|
|
|
4830
|
-
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
4831
|
-
var import_canvas6 = require("@uniformdev/canvas");
|
|
4832
|
-
var import_lexical8 = require("lexical");
|
|
4833
|
-
|
|
4834
|
-
// src/components/Variables/util/variableExpression.ts
|
|
4835
|
-
var variablePrefix = "${";
|
|
4836
|
-
var variableSuffix = "}";
|
|
4837
|
-
|
|
4838
|
-
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
4839
|
-
function serializeVariablesEditorState(editorState) {
|
|
4840
|
-
const buf = [];
|
|
4841
|
-
serializeRecursive(editorState.toJSON().root, buf);
|
|
4842
|
-
const result = buf.join("");
|
|
4843
|
-
return result.length > 0 ? result : void 0;
|
|
4844
|
-
}
|
|
4845
|
-
function serializeRecursive(node, buffer) {
|
|
4846
|
-
if (node.type === import_lexical8.TextNode.getType()) {
|
|
4847
|
-
buffer.push(node.text.replace(variablePrefix, "\\${"));
|
|
4848
|
-
}
|
|
4849
|
-
if (node.type === VariableNode.getType()) {
|
|
4850
|
-
buffer.push((0, import_canvas6.createVariableReference)(node.reference));
|
|
4851
|
-
}
|
|
4852
|
-
if (node.type === import_lexical8.LineBreakNode.getType()) {
|
|
4853
|
-
buffer.push("\n");
|
|
4854
|
-
}
|
|
4855
|
-
if ("children" in node && node.children) {
|
|
4856
|
-
for (const child of node.children) {
|
|
4857
|
-
serializeRecursive(child, buffer);
|
|
4858
|
-
}
|
|
4859
|
-
}
|
|
4860
|
-
}
|
|
4861
|
-
|
|
4862
4859
|
// src/components/Variables/toolbox/VariablesComposer.tsx
|
|
4863
4860
|
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
4864
4861
|
function VariablesComposer(props) {
|
|
@@ -5053,7 +5050,8 @@ function InputVariables(props) {
|
|
|
5053
5050
|
filterVariable,
|
|
5054
5051
|
styleVariant = "default",
|
|
5055
5052
|
renderMenuInPortal,
|
|
5056
|
-
disableDismissEditorOnChange
|
|
5053
|
+
disableDismissEditorOnChange,
|
|
5054
|
+
singleTokenMode
|
|
5057
5055
|
} = props;
|
|
5058
5056
|
const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
5059
5057
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -5118,7 +5116,7 @@ function InputVariables(props) {
|
|
|
5118
5116
|
buttonCss: variableBindButton,
|
|
5119
5117
|
tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5120
5118
|
buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5121
|
-
replaceValueOnVariableInsert: useInputWithNoVariables
|
|
5119
|
+
replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
|
|
5122
5120
|
}
|
|
5123
5121
|
)
|
|
5124
5122
|
]
|
|
@@ -5158,13 +5156,13 @@ function InputVariables(props) {
|
|
|
5158
5156
|
showAddVariableMenuOption,
|
|
5159
5157
|
enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
|
|
5160
5158
|
getEditorContext,
|
|
5161
|
-
disabled,
|
|
5159
|
+
disabled: disabled || singleTokenMode,
|
|
5162
5160
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
5163
5161
|
autoFocus,
|
|
5164
5162
|
filterVariable,
|
|
5165
5163
|
children: [
|
|
5166
5164
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PasteTransformerPlugin, { transformPaste }),
|
|
5167
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
5168
5166
|
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
5169
5167
|
body
|
|
5170
5168
|
]
|
|
@@ -5222,7 +5220,7 @@ function ParameterConnectionIndicator({
|
|
|
5222
5220
|
return result;
|
|
5223
5221
|
}, [value]);
|
|
5224
5222
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5225
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: { flex: 1 }, children }),
|
|
5223
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: { flex: 1, maxWidth: "100%" }, children }),
|
|
5226
5224
|
disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5227
5225
|
import_design_system22.Menu,
|
|
5228
5226
|
{
|
|
@@ -5460,8 +5458,15 @@ ${prettifyBindExpression(bindExpression)}`
|
|
|
5460
5458
|
};
|
|
5461
5459
|
}
|
|
5462
5460
|
|
|
5461
|
+
// src/components/Variables/util/hasReferencedVariables.ts
|
|
5462
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
5463
|
+
function hasReferencedVariables2(value) {
|
|
5464
|
+
return (0, import_canvas8.hasReferencedVariables)(value) > 0;
|
|
5465
|
+
}
|
|
5466
|
+
|
|
5463
5467
|
// src/components/Variables/VariablesList.tsx
|
|
5464
5468
|
var import_react58 = require("@emotion/react");
|
|
5469
|
+
var import_CgTrash = require("@react-icons/all-files/cg/CgTrash");
|
|
5465
5470
|
var import_design_system25 = require("@uniformdev/design-system");
|
|
5466
5471
|
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
5467
5472
|
|
|
@@ -5586,7 +5591,7 @@ function VariablesList() {
|
|
|
5586
5591
|
],
|
|
5587
5592
|
"aria-controls": text,
|
|
5588
5593
|
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
5589
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.Icon, { icon:
|
|
5594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.Icon, { icon: import_CgTrash.CgTrash, iconColor: "red" })
|
|
5590
5595
|
}
|
|
5591
5596
|
) })
|
|
5592
5597
|
]
|
|
@@ -6488,11 +6493,11 @@ var DataRefreshButton = ({
|
|
|
6488
6493
|
|
|
6489
6494
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6490
6495
|
var import_react68 = require("@emotion/react");
|
|
6491
|
-
var
|
|
6496
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
6492
6497
|
var import_design_system35 = require("@uniformdev/design-system");
|
|
6493
6498
|
|
|
6494
6499
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6495
|
-
var
|
|
6500
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
6496
6501
|
var import_react66 = require("react");
|
|
6497
6502
|
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6498
6503
|
var ObjectSearchContext = (0, import_react66.createContext)({
|
|
@@ -6591,7 +6596,7 @@ function useObjectSearchContext() {
|
|
|
6591
6596
|
return (0, import_react66.useContext)(ObjectSearchContext);
|
|
6592
6597
|
}
|
|
6593
6598
|
function bindQuery(query, inputs) {
|
|
6594
|
-
const { result, errors } = (0,
|
|
6599
|
+
const { result, errors } = (0, import_canvas9.bindVariablesToObject)({
|
|
6595
6600
|
value: query,
|
|
6596
6601
|
variables: inputs,
|
|
6597
6602
|
errorPrefix: "Dynamic input"
|
|
@@ -6780,7 +6785,7 @@ var ObjectSearchContainer = ({
|
|
|
6780
6785
|
onSelectItem([]);
|
|
6781
6786
|
return;
|
|
6782
6787
|
}
|
|
6783
|
-
const { result, errors } = (0,
|
|
6788
|
+
const { result, errors } = (0, import_canvas10.bindVariables)({
|
|
6784
6789
|
value: selectedValue,
|
|
6785
6790
|
variables: flatVariables,
|
|
6786
6791
|
errorPrefix: "Dynamic input"
|
|
@@ -6801,7 +6806,7 @@ var ObjectSearchContainer = ({
|
|
|
6801
6806
|
}
|
|
6802
6807
|
]);
|
|
6803
6808
|
};
|
|
6804
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.
|
|
6809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6805
6810
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6806
6811
|
InputVariables,
|
|
6807
6812
|
{
|
|
@@ -6818,7 +6823,7 @@ var ObjectSearchContainer = ({
|
|
|
6818
6823
|
}
|
|
6819
6824
|
) : body }),
|
|
6820
6825
|
children
|
|
6821
|
-
] })
|
|
6826
|
+
] });
|
|
6822
6827
|
};
|
|
6823
6828
|
var DefaultResultList = () => {
|
|
6824
6829
|
var _a;
|
|
@@ -6947,7 +6952,8 @@ var ButtonStyles = import_react71.css`
|
|
|
6947
6952
|
font-size: var(--fs-sm);
|
|
6948
6953
|
line-height: 1;
|
|
6949
6954
|
gap: var(--spacing-xs);
|
|
6950
|
-
transition:
|
|
6955
|
+
transition:
|
|
6956
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
6951
6957
|
background-color var(--duration-fast) var(--timing-ease-out);
|
|
6952
6958
|
|
|
6953
6959
|
&:hover {
|
|
@@ -7463,371 +7469,445 @@ var JsonMeshVariableEditor = ({
|
|
|
7463
7469
|
var NUMBER_OPERATORS = [
|
|
7464
7470
|
{
|
|
7465
7471
|
label: "equals...",
|
|
7466
|
-
symbol: "=",
|
|
7467
7472
|
value: "eq",
|
|
7468
|
-
editorType: "number"
|
|
7473
|
+
editorType: "number",
|
|
7474
|
+
expectedValueType: "single"
|
|
7469
7475
|
},
|
|
7470
7476
|
{
|
|
7471
7477
|
label: "does not equal...",
|
|
7472
|
-
symbol: "\u2260",
|
|
7473
7478
|
value: "neq",
|
|
7474
|
-
editorType: "number"
|
|
7479
|
+
editorType: "number",
|
|
7480
|
+
expectedValueType: "single"
|
|
7475
7481
|
},
|
|
7476
7482
|
{
|
|
7477
7483
|
label: "greater than...",
|
|
7478
|
-
symbol: ">",
|
|
7479
7484
|
value: "gt",
|
|
7480
|
-
editorType: "number"
|
|
7485
|
+
editorType: "number",
|
|
7486
|
+
expectedValueType: "single"
|
|
7481
7487
|
},
|
|
7482
7488
|
{
|
|
7483
7489
|
label: "greater than or equal to...",
|
|
7484
|
-
symbol: "\u2265",
|
|
7485
7490
|
value: "gte",
|
|
7486
|
-
editorType: "number"
|
|
7491
|
+
editorType: "number",
|
|
7492
|
+
expectedValueType: "single"
|
|
7487
7493
|
},
|
|
7488
7494
|
{
|
|
7489
7495
|
label: "less than...",
|
|
7490
|
-
symbol: "<",
|
|
7491
7496
|
value: "lt",
|
|
7492
|
-
editorType: "number"
|
|
7497
|
+
editorType: "number",
|
|
7498
|
+
expectedValueType: "single"
|
|
7493
7499
|
},
|
|
7494
7500
|
{
|
|
7495
7501
|
label: "less than or equal to...",
|
|
7496
|
-
symbol: "\u2264",
|
|
7497
7502
|
value: "lte",
|
|
7498
|
-
editorType: "number"
|
|
7503
|
+
editorType: "number",
|
|
7504
|
+
expectedValueType: "single"
|
|
7499
7505
|
},
|
|
7500
7506
|
{
|
|
7501
7507
|
label: "is empty",
|
|
7502
7508
|
value: "ndef",
|
|
7503
|
-
editorType: "empty"
|
|
7509
|
+
editorType: "empty",
|
|
7510
|
+
expectedValueType: "false"
|
|
7504
7511
|
},
|
|
7505
7512
|
{
|
|
7506
7513
|
label: "is between...",
|
|
7507
7514
|
value: "between",
|
|
7508
|
-
editorType: "numberRange"
|
|
7515
|
+
editorType: "numberRange",
|
|
7516
|
+
expectedValueType: "between"
|
|
7509
7517
|
},
|
|
7510
7518
|
{
|
|
7511
7519
|
label: "is not empty",
|
|
7512
7520
|
value: "def",
|
|
7513
|
-
editorType: "empty"
|
|
7521
|
+
editorType: "empty",
|
|
7522
|
+
expectedValueType: "true"
|
|
7514
7523
|
}
|
|
7515
7524
|
];
|
|
7516
7525
|
var DATE_OPERATORS = [
|
|
7517
7526
|
{
|
|
7518
7527
|
label: "is",
|
|
7519
7528
|
value: "eq",
|
|
7520
|
-
editorType: "date"
|
|
7529
|
+
editorType: "date",
|
|
7530
|
+
expectedValueType: "single"
|
|
7521
7531
|
},
|
|
7522
7532
|
{
|
|
7523
7533
|
label: "is between...",
|
|
7524
7534
|
value: "between",
|
|
7525
|
-
editorType: "dateRange"
|
|
7535
|
+
editorType: "dateRange",
|
|
7536
|
+
expectedValueType: "between"
|
|
7526
7537
|
},
|
|
7527
7538
|
{
|
|
7528
7539
|
label: "is before...",
|
|
7529
7540
|
value: "lt",
|
|
7530
|
-
editorType: "date"
|
|
7541
|
+
editorType: "date",
|
|
7542
|
+
expectedValueType: "single"
|
|
7531
7543
|
},
|
|
7532
7544
|
{
|
|
7533
7545
|
label: "is after...",
|
|
7534
7546
|
value: "gt",
|
|
7535
|
-
editorType: "date"
|
|
7547
|
+
editorType: "date",
|
|
7548
|
+
expectedValueType: "single"
|
|
7536
7549
|
},
|
|
7537
7550
|
{
|
|
7538
7551
|
label: "is on or before...",
|
|
7539
7552
|
value: "lte",
|
|
7540
|
-
editorType: "date"
|
|
7553
|
+
editorType: "date",
|
|
7554
|
+
expectedValueType: "single"
|
|
7541
7555
|
},
|
|
7542
7556
|
{
|
|
7543
7557
|
label: "is on or after...",
|
|
7544
7558
|
value: "gte",
|
|
7545
|
-
editorType: "date"
|
|
7559
|
+
editorType: "date",
|
|
7560
|
+
expectedValueType: "single"
|
|
7546
7561
|
},
|
|
7547
7562
|
{
|
|
7548
7563
|
label: "is empty",
|
|
7549
7564
|
value: "ndef",
|
|
7550
|
-
editorType: "empty"
|
|
7565
|
+
editorType: "empty",
|
|
7566
|
+
expectedValueType: "false"
|
|
7551
7567
|
},
|
|
7552
7568
|
{
|
|
7553
7569
|
label: "is not",
|
|
7554
7570
|
value: "neq",
|
|
7555
|
-
editorType: "date"
|
|
7571
|
+
editorType: "date",
|
|
7572
|
+
expectedValueType: "single"
|
|
7556
7573
|
},
|
|
7557
7574
|
{
|
|
7558
7575
|
label: "is not empty",
|
|
7559
7576
|
value: "def",
|
|
7560
|
-
editorType: "empty"
|
|
7577
|
+
editorType: "empty",
|
|
7578
|
+
expectedValueType: "true"
|
|
7561
7579
|
}
|
|
7562
7580
|
];
|
|
7563
7581
|
var TEXTBOX_OPERATORS = [
|
|
7564
7582
|
{
|
|
7565
7583
|
label: "contains...",
|
|
7566
7584
|
value: "match",
|
|
7567
|
-
editorType: "text"
|
|
7585
|
+
editorType: "text",
|
|
7586
|
+
expectedValueType: "single"
|
|
7568
7587
|
},
|
|
7569
7588
|
{
|
|
7570
7589
|
label: "is",
|
|
7571
7590
|
value: "eq",
|
|
7572
|
-
editorType: "text"
|
|
7591
|
+
editorType: "text",
|
|
7592
|
+
expectedValueType: "single"
|
|
7573
7593
|
},
|
|
7574
7594
|
{
|
|
7575
7595
|
label: "is empty",
|
|
7576
7596
|
value: "ndef",
|
|
7577
|
-
editorType: "empty"
|
|
7597
|
+
editorType: "empty",
|
|
7598
|
+
expectedValueType: "false"
|
|
7578
7599
|
},
|
|
7579
7600
|
{
|
|
7580
7601
|
label: "starts with...",
|
|
7581
7602
|
value: "starts",
|
|
7582
|
-
editorType: "text"
|
|
7603
|
+
editorType: "text",
|
|
7604
|
+
expectedValueType: "single"
|
|
7583
7605
|
},
|
|
7584
7606
|
{
|
|
7585
7607
|
label: "is not",
|
|
7586
7608
|
value: "neq",
|
|
7587
|
-
editorType: "text"
|
|
7609
|
+
editorType: "text",
|
|
7610
|
+
expectedValueType: "single"
|
|
7588
7611
|
},
|
|
7589
7612
|
{
|
|
7590
7613
|
label: "is not empty",
|
|
7591
7614
|
value: "def",
|
|
7592
|
-
editorType: "empty"
|
|
7615
|
+
editorType: "empty",
|
|
7616
|
+
expectedValueType: "true"
|
|
7593
7617
|
}
|
|
7594
7618
|
];
|
|
7595
7619
|
var USER_OPERATORS = [
|
|
7596
7620
|
{
|
|
7597
7621
|
label: "contains...",
|
|
7598
7622
|
value: "match",
|
|
7599
|
-
editorType: "text"
|
|
7623
|
+
editorType: "text",
|
|
7624
|
+
expectedValueType: "single"
|
|
7600
7625
|
},
|
|
7601
7626
|
{
|
|
7602
7627
|
label: "is",
|
|
7603
7628
|
value: "eq",
|
|
7604
|
-
editorType: "text"
|
|
7629
|
+
editorType: "text",
|
|
7630
|
+
expectedValueType: "single"
|
|
7605
7631
|
},
|
|
7606
7632
|
{
|
|
7607
7633
|
label: "starts with...",
|
|
7608
7634
|
value: "starts",
|
|
7609
|
-
editorType: "text"
|
|
7635
|
+
editorType: "text",
|
|
7636
|
+
expectedValueType: "single"
|
|
7610
7637
|
},
|
|
7611
7638
|
{
|
|
7612
7639
|
label: "is not",
|
|
7613
7640
|
value: "neq",
|
|
7614
|
-
editorType: "text"
|
|
7641
|
+
editorType: "text",
|
|
7642
|
+
expectedValueType: "single"
|
|
7615
7643
|
}
|
|
7616
7644
|
];
|
|
7617
|
-
var
|
|
7645
|
+
var DATE_TIME_OPERATORS = [
|
|
7618
7646
|
{
|
|
7619
7647
|
label: "is",
|
|
7620
7648
|
value: "sys-date-eq",
|
|
7621
|
-
editorType: "date"
|
|
7649
|
+
editorType: "date",
|
|
7650
|
+
expectedValueType: "single"
|
|
7622
7651
|
},
|
|
7623
7652
|
{
|
|
7624
7653
|
label: "is between...",
|
|
7625
7654
|
value: "sys-date-between",
|
|
7626
|
-
editorType: "dateRange"
|
|
7655
|
+
editorType: "dateRange",
|
|
7656
|
+
expectedValueType: "between"
|
|
7627
7657
|
},
|
|
7628
7658
|
{
|
|
7629
7659
|
label: "is before...",
|
|
7630
7660
|
value: "sys-date-lt",
|
|
7631
|
-
editorType: "date"
|
|
7661
|
+
editorType: "date",
|
|
7662
|
+
expectedValueType: "single"
|
|
7632
7663
|
},
|
|
7633
7664
|
{
|
|
7634
7665
|
label: "is after...",
|
|
7635
7666
|
value: "sys-date-gt",
|
|
7636
|
-
editorType: "date"
|
|
7667
|
+
editorType: "date",
|
|
7668
|
+
expectedValueType: "single"
|
|
7637
7669
|
},
|
|
7638
7670
|
{
|
|
7639
7671
|
label: "is on or before...",
|
|
7640
7672
|
value: "sys-date-lte",
|
|
7641
|
-
editorType: "date"
|
|
7673
|
+
editorType: "date",
|
|
7674
|
+
expectedValueType: "single"
|
|
7642
7675
|
},
|
|
7643
7676
|
{
|
|
7644
7677
|
label: "is on or after...",
|
|
7645
7678
|
value: "sys-date-gte",
|
|
7646
|
-
editorType: "date"
|
|
7679
|
+
editorType: "date",
|
|
7680
|
+
expectedValueType: "single"
|
|
7681
|
+
},
|
|
7682
|
+
{
|
|
7683
|
+
label: "is empty",
|
|
7684
|
+
value: "ndef",
|
|
7685
|
+
editorType: "empty",
|
|
7686
|
+
expectedValueType: "false"
|
|
7687
|
+
},
|
|
7688
|
+
{
|
|
7689
|
+
label: "is not empty",
|
|
7690
|
+
value: "def",
|
|
7691
|
+
editorType: "empty",
|
|
7692
|
+
expectedValueType: "true"
|
|
7647
7693
|
}
|
|
7648
7694
|
];
|
|
7649
7695
|
var RICHTEXT_OPERATORS = [
|
|
7650
7696
|
{
|
|
7651
7697
|
label: "contains...",
|
|
7652
7698
|
value: "match",
|
|
7653
|
-
editorType: "text"
|
|
7699
|
+
editorType: "text",
|
|
7700
|
+
expectedValueType: "single"
|
|
7654
7701
|
},
|
|
7655
7702
|
{
|
|
7656
7703
|
label: "is empty",
|
|
7657
7704
|
value: "ndef",
|
|
7658
|
-
editorType: "empty"
|
|
7705
|
+
editorType: "empty",
|
|
7706
|
+
expectedValueType: "false"
|
|
7659
7707
|
},
|
|
7660
7708
|
{
|
|
7661
7709
|
label: "starts with...",
|
|
7662
7710
|
value: "starts",
|
|
7663
|
-
editorType: "text"
|
|
7711
|
+
editorType: "text",
|
|
7712
|
+
expectedValueType: "single"
|
|
7664
7713
|
},
|
|
7665
7714
|
{
|
|
7666
7715
|
label: "is not empty",
|
|
7667
7716
|
value: "def",
|
|
7668
|
-
editorType: "empty"
|
|
7717
|
+
editorType: "empty",
|
|
7718
|
+
expectedValueType: "true"
|
|
7669
7719
|
}
|
|
7670
7720
|
];
|
|
7671
7721
|
var CHECKBOX_OPERATORS = [
|
|
7672
7722
|
{
|
|
7673
7723
|
label: "is checked",
|
|
7674
7724
|
value: "def",
|
|
7675
|
-
editorType: "empty"
|
|
7725
|
+
editorType: "empty",
|
|
7726
|
+
expectedValueType: "true"
|
|
7676
7727
|
},
|
|
7677
7728
|
{
|
|
7678
7729
|
label: "is not checked",
|
|
7679
7730
|
value: "ndef",
|
|
7680
|
-
editorType: "empty"
|
|
7731
|
+
editorType: "empty",
|
|
7732
|
+
expectedValueType: "false"
|
|
7681
7733
|
}
|
|
7682
7734
|
];
|
|
7683
7735
|
var SYSTEM_FIELD_OPERATORS = [
|
|
7684
7736
|
{
|
|
7685
7737
|
label: "is",
|
|
7686
7738
|
value: "eq",
|
|
7687
|
-
editorType: "singleChoice"
|
|
7739
|
+
editorType: "singleChoice",
|
|
7740
|
+
expectedValueType: "single"
|
|
7688
7741
|
},
|
|
7689
7742
|
{
|
|
7690
7743
|
label: "is any of...",
|
|
7691
7744
|
value: "in",
|
|
7692
|
-
editorType: "multiChoice"
|
|
7745
|
+
editorType: "multiChoice",
|
|
7746
|
+
expectedValueType: "array"
|
|
7693
7747
|
},
|
|
7694
7748
|
{
|
|
7695
7749
|
label: "is not",
|
|
7696
7750
|
value: "neq",
|
|
7697
|
-
editorType: "singleChoice"
|
|
7751
|
+
editorType: "singleChoice",
|
|
7752
|
+
expectedValueType: "single"
|
|
7698
7753
|
},
|
|
7699
7754
|
{
|
|
7700
7755
|
label: "is none of...",
|
|
7701
7756
|
value: "nin",
|
|
7702
|
-
editorType: "multiChoice"
|
|
7757
|
+
editorType: "multiChoice",
|
|
7758
|
+
expectedValueType: "array"
|
|
7703
7759
|
}
|
|
7704
7760
|
];
|
|
7705
7761
|
var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
|
|
7706
7762
|
{
|
|
7707
7763
|
label: "is",
|
|
7708
7764
|
value: "eq",
|
|
7709
|
-
editorType: "singleChoice"
|
|
7765
|
+
editorType: "singleChoice",
|
|
7766
|
+
expectedValueType: "single"
|
|
7710
7767
|
},
|
|
7711
7768
|
{
|
|
7712
7769
|
label: "is any of...",
|
|
7713
7770
|
value: "in",
|
|
7714
|
-
editorType: "multiChoice"
|
|
7771
|
+
editorType: "multiChoice",
|
|
7772
|
+
expectedValueType: "array"
|
|
7715
7773
|
},
|
|
7716
7774
|
{
|
|
7717
7775
|
label: "is empty",
|
|
7718
7776
|
value: "ndef",
|
|
7719
|
-
editorType: "empty"
|
|
7777
|
+
editorType: "empty",
|
|
7778
|
+
expectedValueType: "false"
|
|
7720
7779
|
},
|
|
7721
7780
|
{
|
|
7722
7781
|
label: "is not",
|
|
7723
7782
|
value: "neq",
|
|
7724
|
-
editorType: "singleChoice"
|
|
7783
|
+
editorType: "singleChoice",
|
|
7784
|
+
expectedValueType: "single"
|
|
7725
7785
|
},
|
|
7726
7786
|
{
|
|
7727
7787
|
label: "is none of...",
|
|
7728
7788
|
value: "nin",
|
|
7729
|
-
editorType: "multiChoice"
|
|
7789
|
+
editorType: "multiChoice",
|
|
7790
|
+
expectedValueType: "array"
|
|
7730
7791
|
},
|
|
7731
7792
|
{
|
|
7732
7793
|
label: "is not empty",
|
|
7733
7794
|
value: "def",
|
|
7734
|
-
editorType: "empty"
|
|
7795
|
+
editorType: "empty",
|
|
7796
|
+
expectedValueType: "true"
|
|
7735
7797
|
}
|
|
7736
7798
|
];
|
|
7737
7799
|
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
7738
7800
|
{
|
|
7739
7801
|
label: "is",
|
|
7740
7802
|
value: "eq",
|
|
7741
|
-
editorType: "statusSingleChoice"
|
|
7803
|
+
editorType: "statusSingleChoice",
|
|
7804
|
+
expectedValueType: "single"
|
|
7742
7805
|
},
|
|
7743
7806
|
{
|
|
7744
7807
|
label: "is any of...",
|
|
7745
7808
|
value: "in",
|
|
7746
|
-
editorType: "statusMultiChoice"
|
|
7809
|
+
editorType: "statusMultiChoice",
|
|
7810
|
+
expectedValueType: "array"
|
|
7747
7811
|
},
|
|
7748
7812
|
{
|
|
7749
7813
|
label: "is not",
|
|
7750
7814
|
value: "neq",
|
|
7751
|
-
editorType: "statusSingleChoice"
|
|
7815
|
+
editorType: "statusSingleChoice",
|
|
7816
|
+
expectedValueType: "single"
|
|
7752
7817
|
},
|
|
7753
7818
|
{
|
|
7754
7819
|
label: "is none of...",
|
|
7755
7820
|
value: "nin",
|
|
7756
|
-
editorType: "statusMultiChoice"
|
|
7821
|
+
editorType: "statusMultiChoice",
|
|
7822
|
+
expectedValueType: "array"
|
|
7757
7823
|
}
|
|
7758
7824
|
];
|
|
7759
7825
|
var SELECT_OPERATORS = [
|
|
7760
7826
|
{
|
|
7761
7827
|
label: "is",
|
|
7762
7828
|
value: "eq",
|
|
7763
|
-
editorType: "singleChoice"
|
|
7829
|
+
editorType: "singleChoice",
|
|
7830
|
+
expectedValueType: "single"
|
|
7764
7831
|
},
|
|
7765
7832
|
{
|
|
7766
7833
|
label: "is any of...",
|
|
7767
7834
|
value: "in",
|
|
7768
|
-
editorType: "multiChoice"
|
|
7835
|
+
editorType: "multiChoice",
|
|
7836
|
+
expectedValueType: "array"
|
|
7769
7837
|
},
|
|
7770
7838
|
{
|
|
7771
7839
|
label: "is empty",
|
|
7772
7840
|
value: "ndef",
|
|
7773
|
-
editorType: "empty"
|
|
7841
|
+
editorType: "empty",
|
|
7842
|
+
expectedValueType: "false"
|
|
7774
7843
|
},
|
|
7775
7844
|
{
|
|
7776
7845
|
label: "contains...",
|
|
7777
7846
|
value: "match",
|
|
7778
|
-
editorType: "text"
|
|
7847
|
+
editorType: "text",
|
|
7848
|
+
expectedValueType: "single"
|
|
7779
7849
|
},
|
|
7780
7850
|
{
|
|
7781
7851
|
label: "starts with...",
|
|
7782
7852
|
value: "starts",
|
|
7783
|
-
editorType: "text"
|
|
7853
|
+
editorType: "text",
|
|
7854
|
+
expectedValueType: "single"
|
|
7784
7855
|
},
|
|
7785
7856
|
{
|
|
7786
7857
|
label: "is not",
|
|
7787
7858
|
value: "neq",
|
|
7788
|
-
editorType: "singleChoice"
|
|
7859
|
+
editorType: "singleChoice",
|
|
7860
|
+
expectedValueType: "single"
|
|
7789
7861
|
},
|
|
7790
7862
|
{
|
|
7791
7863
|
label: "is none of...",
|
|
7792
7864
|
value: "nin",
|
|
7793
|
-
editorType: "multiChoice"
|
|
7865
|
+
editorType: "multiChoice",
|
|
7866
|
+
expectedValueType: "array"
|
|
7794
7867
|
},
|
|
7795
7868
|
{
|
|
7796
7869
|
label: "is not empty",
|
|
7797
7870
|
value: "def",
|
|
7798
|
-
editorType: "empty"
|
|
7871
|
+
editorType: "empty",
|
|
7872
|
+
expectedValueType: "true"
|
|
7799
7873
|
}
|
|
7800
7874
|
];
|
|
7801
7875
|
var MULTI_SELECT_OPERATORS = [
|
|
7802
7876
|
{
|
|
7803
7877
|
label: "is",
|
|
7804
7878
|
value: "eq",
|
|
7805
|
-
editorType: "singleChoice"
|
|
7879
|
+
editorType: "singleChoice",
|
|
7880
|
+
expectedValueType: "single"
|
|
7806
7881
|
},
|
|
7807
7882
|
{
|
|
7808
7883
|
label: "is any of...",
|
|
7809
7884
|
value: "in",
|
|
7810
|
-
editorType: "multiChoice"
|
|
7885
|
+
editorType: "multiChoice",
|
|
7886
|
+
expectedValueType: "array"
|
|
7811
7887
|
},
|
|
7812
7888
|
{
|
|
7813
7889
|
label: "is empty",
|
|
7814
7890
|
value: "ndef",
|
|
7815
|
-
editorType: "empty"
|
|
7891
|
+
editorType: "empty",
|
|
7892
|
+
expectedValueType: "false"
|
|
7816
7893
|
},
|
|
7817
7894
|
{
|
|
7818
7895
|
label: "is not",
|
|
7819
7896
|
value: "neq",
|
|
7820
|
-
editorType: "singleChoice"
|
|
7897
|
+
editorType: "singleChoice",
|
|
7898
|
+
expectedValueType: "single"
|
|
7821
7899
|
},
|
|
7822
7900
|
{
|
|
7823
7901
|
label: "is none of...",
|
|
7824
7902
|
value: "nin",
|
|
7825
|
-
editorType: "multiChoice"
|
|
7903
|
+
editorType: "multiChoice",
|
|
7904
|
+
expectedValueType: "array"
|
|
7826
7905
|
},
|
|
7827
7906
|
{
|
|
7828
7907
|
label: "is not empty",
|
|
7829
7908
|
value: "def",
|
|
7830
|
-
editorType: "empty"
|
|
7909
|
+
editorType: "empty",
|
|
7910
|
+
expectedValueType: "true"
|
|
7831
7911
|
}
|
|
7832
7912
|
];
|
|
7833
7913
|
|
|
@@ -8459,13 +8539,16 @@ var ConditionalInputRow = import_react86.css`
|
|
|
8459
8539
|
${(0, import_design_system53.cq)("764px")} {
|
|
8460
8540
|
align-items: flex-start;
|
|
8461
8541
|
display: grid;
|
|
8462
|
-
grid-template-columns:
|
|
8542
|
+
grid-template-columns: 250px 160px 1fr 32px;
|
|
8463
8543
|
|
|
8464
8544
|
& > div:nth-child(n) {
|
|
8465
8545
|
width: auto;
|
|
8466
8546
|
}
|
|
8467
8547
|
}
|
|
8468
8548
|
`;
|
|
8549
|
+
var ConditionalInputRowEmpty = import_react86.css`
|
|
8550
|
+
flex-wrap: nowrap;
|
|
8551
|
+
`;
|
|
8469
8552
|
var SearchInput = import_react86.css`
|
|
8470
8553
|
max-height: 40px;
|
|
8471
8554
|
min-height: unset;
|
|
@@ -8508,7 +8591,8 @@ var FilterButton = import_react86.css`
|
|
|
8508
8591
|
gap: var(--spacing-sm);
|
|
8509
8592
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
8510
8593
|
max-height: 40px;
|
|
8511
|
-
transition:
|
|
8594
|
+
transition:
|
|
8595
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
8512
8596
|
background-color var(--duration-fast) var(--timing-ease-out),
|
|
8513
8597
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
8514
8598
|
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
@@ -8603,6 +8687,9 @@ var ResetConditionsBtn = import_react86.css`
|
|
|
8603
8687
|
&:focus {
|
|
8604
8688
|
color: var(--action-destructive-hover);
|
|
8605
8689
|
}
|
|
8690
|
+
&:disabled {
|
|
8691
|
+
color: var(--gray-400);
|
|
8692
|
+
}
|
|
8606
8693
|
`;
|
|
8607
8694
|
var IconBtn = import_react86.css`
|
|
8608
8695
|
align-self: center;
|
|
@@ -8633,15 +8720,26 @@ var SearchAndFilterButtonGroup = import_react86.css`
|
|
|
8633
8720
|
margin-top: var(--spacing-xs);
|
|
8634
8721
|
margin-left: calc(56px + var(--spacing-md));
|
|
8635
8722
|
`;
|
|
8723
|
+
var SearchAndFilterAdditionalContainer = import_react86.css`
|
|
8724
|
+
align-items: center;
|
|
8725
|
+
border-top: 1px solid var(--gray-300);
|
|
8726
|
+
display: flex;
|
|
8727
|
+
flex-wrap: nowrap;
|
|
8728
|
+
gap: var(--spacing-base);
|
|
8729
|
+
padding: var(--spacing-base) var(--spacing-md) 0;
|
|
8730
|
+
position: relative;
|
|
8731
|
+
z-index: 0;
|
|
8732
|
+
`;
|
|
8636
8733
|
|
|
8637
8734
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8638
8735
|
var import_jsx_runtime81 = require("@emotion/react/jsx-runtime");
|
|
8639
8736
|
var FilterButton2 = ({
|
|
8640
8737
|
text = "Filters",
|
|
8641
|
-
icon = "filter-add",
|
|
8738
|
+
icon = import_design_system54.customIcons["filter-add"],
|
|
8642
8739
|
filterCount,
|
|
8643
8740
|
hasSelectedValue,
|
|
8644
8741
|
dataTestId,
|
|
8742
|
+
showDropdownIcon,
|
|
8645
8743
|
...props
|
|
8646
8744
|
}) => {
|
|
8647
8745
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
@@ -8658,7 +8756,8 @@ var FilterButton2 = ({
|
|
|
8658
8756
|
children: [
|
|
8659
8757
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_design_system54.Icon, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
8660
8758
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { css: FilterButtonText, children: text }),
|
|
8661
|
-
filterCount ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_design_system54.Counter, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
8759
|
+
filterCount ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_design_system54.Counter, { count: filterCount, bgColor: "var(--white)" }) : null,
|
|
8760
|
+
showDropdownIcon ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_design_system54.Icon, { icon: "chevron-down", iconColor: "currentColor", size: "1rem" }) : null
|
|
8662
8761
|
]
|
|
8663
8762
|
}
|
|
8664
8763
|
);
|
|
@@ -8666,6 +8765,7 @@ var FilterButton2 = ({
|
|
|
8666
8765
|
|
|
8667
8766
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8668
8767
|
var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
|
|
8768
|
+
var import_canvas11 = require("@uniformdev/canvas");
|
|
8669
8769
|
var import_design_system56 = require("@uniformdev/design-system");
|
|
8670
8770
|
var import_lexical11 = require("lexical");
|
|
8671
8771
|
var import_react88 = require("react");
|
|
@@ -8699,7 +8799,7 @@ var filterMapper = {
|
|
|
8699
8799
|
statusSingleChoice: StatusSingleEditor,
|
|
8700
8800
|
empty: null
|
|
8701
8801
|
};
|
|
8702
|
-
function withInputVariables(WrappedComponent) {
|
|
8802
|
+
function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
8703
8803
|
const WithInputVariables = (props) => {
|
|
8704
8804
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8705
8805
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props });
|
|
@@ -8712,7 +8812,7 @@ function withInputVariables(WrappedComponent) {
|
|
|
8712
8812
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8713
8813
|
value: props.value,
|
|
8714
8814
|
disabled: props.disabled,
|
|
8715
|
-
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props })
|
|
8815
|
+
inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props })
|
|
8716
8816
|
}
|
|
8717
8817
|
);
|
|
8718
8818
|
};
|
|
@@ -8742,7 +8842,7 @@ var bindableFiltersMapper = {
|
|
|
8742
8842
|
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8743
8843
|
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8744
8844
|
date: withInputVariables(DateEditor),
|
|
8745
|
-
text: withInputVariables(TextEditor),
|
|
8845
|
+
text: withInputVariables(TextEditor, true),
|
|
8746
8846
|
number: withInputVariables(NumberEditor)
|
|
8747
8847
|
};
|
|
8748
8848
|
|
|
@@ -8774,6 +8874,7 @@ var SearchAndFilterProvider = ({
|
|
|
8774
8874
|
filters,
|
|
8775
8875
|
filterOptions,
|
|
8776
8876
|
filterVisible = false,
|
|
8877
|
+
alwaysVisible = false,
|
|
8777
8878
|
defaultSearchTerm = "",
|
|
8778
8879
|
onSearchChange,
|
|
8779
8880
|
onChange,
|
|
@@ -8785,7 +8886,7 @@ var SearchAndFilterProvider = ({
|
|
|
8785
8886
|
}) => {
|
|
8786
8887
|
const [searchTerm, setSearchTerm] = (0, import_react87.useState)(defaultSearchTerm);
|
|
8787
8888
|
const deferredSearchTerm = (0, import_react87.useDeferredValue)(searchTerm);
|
|
8788
|
-
const [filterVisibility, setFilterVisibility] = (0, import_react87.useState)(filterVisible);
|
|
8889
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react87.useState)(alwaysVisible || filterVisible);
|
|
8789
8890
|
const handleSearchTerm = (0, import_react87.useCallback)(
|
|
8790
8891
|
(term) => {
|
|
8791
8892
|
setSearchTerm(term);
|
|
@@ -8794,8 +8895,13 @@ var SearchAndFilterProvider = ({
|
|
|
8794
8895
|
[setSearchTerm, onSearchChange]
|
|
8795
8896
|
);
|
|
8796
8897
|
const handleToggleFilterVisibility = (0, import_react87.useCallback)(
|
|
8797
|
-
(visible) =>
|
|
8798
|
-
|
|
8898
|
+
(visible) => {
|
|
8899
|
+
if (alwaysVisible) {
|
|
8900
|
+
return;
|
|
8901
|
+
}
|
|
8902
|
+
setFilterVisibility(visible);
|
|
8903
|
+
},
|
|
8904
|
+
[alwaysVisible]
|
|
8799
8905
|
);
|
|
8800
8906
|
const handleAddFilter = (0, import_react87.useCallback)(() => {
|
|
8801
8907
|
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
@@ -8821,7 +8927,7 @@ var SearchAndFilterProvider = ({
|
|
|
8821
8927
|
if (filterVisibility) {
|
|
8822
8928
|
const handleEscKeyFilterClose = (e) => {
|
|
8823
8929
|
if (e.key === "Escape") {
|
|
8824
|
-
|
|
8930
|
+
handleToggleFilterVisibility(false);
|
|
8825
8931
|
}
|
|
8826
8932
|
};
|
|
8827
8933
|
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
@@ -8829,7 +8935,7 @@ var SearchAndFilterProvider = ({
|
|
|
8829
8935
|
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8830
8936
|
};
|
|
8831
8937
|
}
|
|
8832
|
-
}, [filterVisibility]);
|
|
8938
|
+
}, [filterVisibility, handleToggleFilterVisibility]);
|
|
8833
8939
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
8834
8940
|
SearchAndFilterContext.Provider,
|
|
8835
8941
|
{
|
|
@@ -8873,7 +8979,7 @@ var FilterControls = ({
|
|
|
8873
8979
|
allowBindingSearchTerm
|
|
8874
8980
|
} = useSearchAndFilter();
|
|
8875
8981
|
const editorRef = (0, import_react88.useRef)(null);
|
|
8876
|
-
const
|
|
8982
|
+
const variableRefernceCountInSearchTerm = (0, import_canvas11.hasReferencedVariables)(searchTerm);
|
|
8877
8983
|
const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react88.useState)("data-resource-search-term-input");
|
|
8878
8984
|
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react88.useState)(searchTerm);
|
|
8879
8985
|
(0, import_react_use10.useDebounce)(
|
|
@@ -8927,7 +9033,7 @@ var FilterControls = ({
|
|
|
8927
9033
|
)
|
|
8928
9034
|
}
|
|
8929
9035
|
),
|
|
8930
|
-
|
|
9036
|
+
variableRefernceCountInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
8931
9037
|
"button",
|
|
8932
9038
|
{
|
|
8933
9039
|
css: ClearSearchButtonStyles,
|
|
@@ -8950,89 +9056,28 @@ var FilterControls = ({
|
|
|
8950
9056
|
};
|
|
8951
9057
|
|
|
8952
9058
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8953
|
-
var
|
|
8954
|
-
var import_react90 = require("react");
|
|
8955
|
-
|
|
8956
|
-
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
9059
|
+
var import_CgTrash2 = require("@react-icons/all-files/cg/CgTrash");
|
|
8957
9060
|
var import_design_system57 = require("@uniformdev/design-system");
|
|
8958
|
-
var import_react89 =
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
}
|
|
8965
|
-
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8966
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8967
|
-
buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
8968
|
-
import_design_system57.HorizontalRhythm,
|
|
8969
|
-
{
|
|
8970
|
-
css: SearchAndFilterButtonGroup,
|
|
8971
|
-
gap: "sm",
|
|
8972
|
-
align: "center",
|
|
8973
|
-
justify: "space-between",
|
|
8974
|
-
children: buttonRow
|
|
8975
|
-
}
|
|
8976
|
-
) : null,
|
|
8977
|
-
additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { children: additionalFiltersContainer }) : null
|
|
8978
|
-
] });
|
|
8979
|
-
};
|
|
8980
|
-
var FilterMenu = ({
|
|
8981
|
-
id,
|
|
8982
|
-
filterTitle = "Show results",
|
|
8983
|
-
menuControls,
|
|
8984
|
-
additionalFiltersContainer,
|
|
8985
|
-
children,
|
|
8986
|
-
dataTestId,
|
|
8987
|
-
resetButtonText = "reset"
|
|
8988
|
-
}) => {
|
|
8989
|
-
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8990
|
-
const innerMenuRef = import_react89.default.useRef(null);
|
|
8991
|
-
(0, import_react89.useEffect)(() => {
|
|
8992
|
-
var _a;
|
|
8993
|
-
if (filterVisibility) {
|
|
8994
|
-
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
8995
|
-
}
|
|
8996
|
-
}, [filterVisibility]);
|
|
8997
|
-
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_design_system57.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
8998
|
-
SearchAndFilterOptionsContainer2,
|
|
8999
|
-
{
|
|
9000
|
-
buttonRow: menuControls,
|
|
9001
|
-
additionalFiltersContainer,
|
|
9002
|
-
children: [
|
|
9003
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_design_system57.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
9004
|
-
filterTitle ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
|
|
9005
|
-
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9006
|
-
"button",
|
|
9007
|
-
{
|
|
9008
|
-
type: "button",
|
|
9009
|
-
css: ResetConditionsBtn,
|
|
9010
|
-
onClick: () => {
|
|
9011
|
-
handleResetFilters();
|
|
9012
|
-
setFilterVisibility(false);
|
|
9013
|
-
},
|
|
9014
|
-
"data-testid": "reset-filters",
|
|
9015
|
-
children: resetButtonText
|
|
9016
|
-
}
|
|
9017
|
-
) : null
|
|
9018
|
-
] }),
|
|
9019
|
-
children
|
|
9020
|
-
]
|
|
9021
|
-
}
|
|
9022
|
-
) : null });
|
|
9023
|
-
};
|
|
9061
|
+
var import_react89 = require("react");
|
|
9062
|
+
|
|
9063
|
+
// src/components/SearchAndFilter/util/isFilterBindable.ts
|
|
9064
|
+
function isFilterBindable(filter, operator) {
|
|
9065
|
+
var _a, _b;
|
|
9066
|
+
return (_b = (_a = operator == null ? void 0 : operator.bindable) != null ? _a : filter == null ? void 0 : filter.bindable) != null ? _b : false;
|
|
9067
|
+
}
|
|
9024
9068
|
|
|
9025
9069
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
9026
|
-
var
|
|
9070
|
+
var import_jsx_runtime85 = require("@emotion/react/jsx-runtime");
|
|
9027
9071
|
var FilterItem = ({
|
|
9028
9072
|
index,
|
|
9029
|
-
paramOptions,
|
|
9030
9073
|
operatorOptions,
|
|
9031
9074
|
valueOptions,
|
|
9032
|
-
|
|
9075
|
+
onFilterOptionChange,
|
|
9076
|
+
onFilterDynamicChange,
|
|
9033
9077
|
onOperatorChange,
|
|
9034
9078
|
onValueChange,
|
|
9035
|
-
initialCriteriaTitle = "Where"
|
|
9079
|
+
initialCriteriaTitle = "Where",
|
|
9080
|
+
criteriaGroupOperator = "and"
|
|
9036
9081
|
}) => {
|
|
9037
9082
|
var _a, _b;
|
|
9038
9083
|
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
@@ -9040,25 +9085,26 @@ var FilterItem = ({
|
|
|
9040
9085
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
9041
9086
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
9042
9087
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
9043
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0,
|
|
9088
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react89.useMemo)(() => {
|
|
9044
9089
|
var _a2;
|
|
9045
|
-
const
|
|
9090
|
+
const currentSelectedFilterGroup = filterOptions.find((item) => {
|
|
9046
9091
|
var _a3;
|
|
9047
9092
|
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
9048
9093
|
});
|
|
9049
|
-
const
|
|
9094
|
+
const selectedFilterOption = (_a2 = currentSelectedFilterGroup == null ? void 0 : currentSelectedFilterGroup.options) == null ? void 0 : _a2.find((item) => {
|
|
9050
9095
|
return filters[index].field === item.value;
|
|
9051
9096
|
});
|
|
9052
|
-
const isCurrentFieldReadOnly =
|
|
9097
|
+
const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
|
|
9053
9098
|
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
9054
9099
|
return filters[index].operator === item.value;
|
|
9055
9100
|
});
|
|
9101
|
+
const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
|
|
9056
9102
|
return {
|
|
9057
|
-
selectedFieldValue:
|
|
9103
|
+
selectedFieldValue: selectedFilterOption,
|
|
9058
9104
|
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
9059
9105
|
selectedMetaValue: filters[index].value,
|
|
9060
9106
|
readOnly: isCurrentFieldReadOnly,
|
|
9061
|
-
bindable:
|
|
9107
|
+
bindable: bindable2
|
|
9062
9108
|
};
|
|
9063
9109
|
}, [filters, filterOptions, index, operatorOptions]);
|
|
9064
9110
|
const readOnlyProps = readOnly ? {
|
|
@@ -9067,17 +9113,29 @@ var FilterItem = ({
|
|
|
9067
9113
|
menuIsOpen: false,
|
|
9068
9114
|
isClearable: false
|
|
9069
9115
|
} : {};
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9116
|
+
const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
|
|
9117
|
+
const isEmptyOperator = metaDataPossibleOptions === "empty";
|
|
9118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
9119
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
|
|
9120
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: [ConditionalInputRow, isEmptyOperator ? ConditionalInputRowEmpty : null], children: [
|
|
9121
|
+
CustomLeftHandComponent ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9122
|
+
CustomLeftHandComponent,
|
|
9123
|
+
{
|
|
9124
|
+
filterOption: selectedFieldValue,
|
|
9125
|
+
filter: filters[index],
|
|
9126
|
+
setFilterDynamicValue: onFilterDynamicChange,
|
|
9127
|
+
deselectFilterOption: () => {
|
|
9128
|
+
onFilterOptionChange("");
|
|
9129
|
+
}
|
|
9130
|
+
}
|
|
9131
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9132
|
+
import_design_system57.InputComboBox,
|
|
9075
9133
|
{
|
|
9076
9134
|
"aria-label": label,
|
|
9077
|
-
options:
|
|
9135
|
+
options: filterOptions,
|
|
9078
9136
|
onChange: (e) => {
|
|
9079
9137
|
var _a2;
|
|
9080
|
-
|
|
9138
|
+
onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
9081
9139
|
},
|
|
9082
9140
|
isOptionDisabled: (option) => {
|
|
9083
9141
|
var _a2;
|
|
@@ -9097,8 +9155,8 @@ var FilterItem = ({
|
|
|
9097
9155
|
name: `filter-field-${index}`
|
|
9098
9156
|
}
|
|
9099
9157
|
),
|
|
9100
|
-
/* @__PURE__ */ (0,
|
|
9101
|
-
|
|
9158
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9159
|
+
import_design_system57.InputComboBox,
|
|
9102
9160
|
{
|
|
9103
9161
|
"aria-label": operatorLabel,
|
|
9104
9162
|
options: operatorOptions,
|
|
@@ -9121,7 +9179,7 @@ var FilterItem = ({
|
|
|
9121
9179
|
name: `filter-operator-${index}`
|
|
9122
9180
|
}
|
|
9123
9181
|
),
|
|
9124
|
-
/* @__PURE__ */ (0,
|
|
9182
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9125
9183
|
FilterEditorRenderer,
|
|
9126
9184
|
{
|
|
9127
9185
|
"aria-label": metaDataLabel,
|
|
@@ -9135,7 +9193,7 @@ var FilterItem = ({
|
|
|
9135
9193
|
valueTestId: "filter-value"
|
|
9136
9194
|
}
|
|
9137
9195
|
),
|
|
9138
|
-
readOnly ? null : /* @__PURE__ */ (0,
|
|
9196
|
+
readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9139
9197
|
"button",
|
|
9140
9198
|
{
|
|
9141
9199
|
type: "button",
|
|
@@ -9144,35 +9202,185 @@ var FilterItem = ({
|
|
|
9144
9202
|
css: IconBtn,
|
|
9145
9203
|
"data-testid": "delete-filter",
|
|
9146
9204
|
disabled: filters.length === 1,
|
|
9147
|
-
children: /* @__PURE__ */ (0,
|
|
9205
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_design_system57.Icon, { icon: import_CgTrash2.CgTrash, iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
|
|
9148
9206
|
}
|
|
9149
9207
|
)
|
|
9150
9208
|
] })
|
|
9151
9209
|
] });
|
|
9152
9210
|
};
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9211
|
+
|
|
9212
|
+
// src/components/SearchAndFilter/FilterItems.tsx
|
|
9213
|
+
var import_CgMathPlus = require("@react-icons/all-files/cg/CgMathPlus");
|
|
9214
|
+
var import_design_system59 = require("@uniformdev/design-system");
|
|
9215
|
+
|
|
9216
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
9217
|
+
var import_design_system58 = require("@uniformdev/design-system");
|
|
9218
|
+
var import_react90 = __toESM(require("react"));
|
|
9219
|
+
var import_jsx_runtime86 = require("@emotion/react/jsx-runtime");
|
|
9220
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
9221
|
+
buttonRow,
|
|
9222
|
+
additionalFiltersContainer,
|
|
9223
|
+
children
|
|
9224
|
+
}) => {
|
|
9225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
9226
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
9227
|
+
buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
9228
|
+
import_design_system58.HorizontalRhythm,
|
|
9229
|
+
{
|
|
9230
|
+
css: SearchAndFilterButtonGroup,
|
|
9231
|
+
gap: "sm",
|
|
9232
|
+
align: "center",
|
|
9233
|
+
justify: "space-between",
|
|
9234
|
+
children: buttonRow
|
|
9235
|
+
}
|
|
9236
|
+
) : null,
|
|
9237
|
+
additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { css: SearchAndFilterAdditionalContainer, children: additionalFiltersContainer }) : null
|
|
9238
|
+
] });
|
|
9239
|
+
};
|
|
9240
|
+
var FilterMenu = ({
|
|
9241
|
+
id,
|
|
9242
|
+
filterTitle = "Show results",
|
|
9243
|
+
menuControls,
|
|
9244
|
+
additionalFiltersContainer,
|
|
9245
|
+
children,
|
|
9246
|
+
dataTestId,
|
|
9247
|
+
resetButtonText = "reset"
|
|
9248
|
+
}) => {
|
|
9249
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
9250
|
+
const innerMenuRef = import_react90.default.useRef(null);
|
|
9251
|
+
(0, import_react90.useEffect)(() => {
|
|
9252
|
+
var _a;
|
|
9253
|
+
if (filterVisibility) {
|
|
9254
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
9255
|
+
}
|
|
9256
|
+
}, [filterVisibility]);
|
|
9257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_design_system58.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
9258
|
+
SearchAndFilterOptionsContainer2,
|
|
9259
|
+
{
|
|
9260
|
+
buttonRow: menuControls,
|
|
9261
|
+
additionalFiltersContainer,
|
|
9262
|
+
children: [
|
|
9263
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_design_system58.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
9264
|
+
filterTitle ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
|
|
9265
|
+
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
9266
|
+
"button",
|
|
9267
|
+
{
|
|
9268
|
+
type: "button",
|
|
9269
|
+
css: ResetConditionsBtn,
|
|
9270
|
+
disabled: filters.every((f) => !f.field),
|
|
9271
|
+
onClick: () => {
|
|
9272
|
+
handleResetFilters();
|
|
9273
|
+
setFilterVisibility(false);
|
|
9274
|
+
},
|
|
9275
|
+
"data-testid": "reset-filters",
|
|
9276
|
+
children: resetButtonText
|
|
9277
|
+
}
|
|
9278
|
+
) : null
|
|
9279
|
+
] }),
|
|
9280
|
+
children
|
|
9281
|
+
]
|
|
9282
|
+
}
|
|
9283
|
+
) : null });
|
|
9284
|
+
};
|
|
9285
|
+
|
|
9286
|
+
// src/components/SearchAndFilter/util/getNewFilterValueAfterOperatorChange.ts
|
|
9287
|
+
var import_canvas12 = require("@uniformdev/canvas");
|
|
9288
|
+
function getNewFilterValueAfterOperatorChange({
|
|
9289
|
+
newOperatorId,
|
|
9290
|
+
currentFilter,
|
|
9291
|
+
filterOptions
|
|
9292
|
+
}) {
|
|
9293
|
+
var _a, _b, _c;
|
|
9294
|
+
if (Array.isArray(newOperatorId)) {
|
|
9295
|
+
throw new Error("Operator value must be a single string");
|
|
9296
|
+
}
|
|
9297
|
+
const result = {
|
|
9298
|
+
...currentFilter,
|
|
9299
|
+
operator: newOperatorId,
|
|
9300
|
+
value: ""
|
|
9301
|
+
};
|
|
9302
|
+
const currentOperatorId = currentFilter.operator;
|
|
9303
|
+
let currentValue = currentFilter.value;
|
|
9304
|
+
const currentFieldDefinition = filterOptions.flatMap((group) => {
|
|
9305
|
+
var _a2;
|
|
9306
|
+
return (_a2 = group.options) != null ? _a2 : [];
|
|
9307
|
+
}).find((filter) => filter.value === currentFilter.field);
|
|
9308
|
+
const currentOperator = (_a = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _a.find(
|
|
9309
|
+
(op) => op.value === currentOperatorId
|
|
9310
|
+
);
|
|
9311
|
+
const newOperator = (_b = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _b.find((op) => op.value === newOperatorId);
|
|
9312
|
+
if (!currentOperator || !newOperator) {
|
|
9313
|
+
result.value = "";
|
|
9314
|
+
return result;
|
|
9315
|
+
} else {
|
|
9316
|
+
const currentOperatorValueType = currentOperator.expectedValueType;
|
|
9317
|
+
const newOperatorValueType = newOperator.expectedValueType;
|
|
9318
|
+
if (!isFilterBindable(currentFieldDefinition, newOperator) && hasBindings(currentValue)) {
|
|
9319
|
+
currentValue = "";
|
|
9320
|
+
}
|
|
9321
|
+
if (isHardcodedOperatorValue(currentOperatorValueType)) {
|
|
9322
|
+
result.value = isHardcodedOperatorValue(newOperatorValueType) ? newOperatorValueType : "";
|
|
9323
|
+
return result;
|
|
9324
|
+
}
|
|
9325
|
+
switch (newOperatorValueType) {
|
|
9326
|
+
case "single":
|
|
9327
|
+
if (Array.isArray(currentValue)) {
|
|
9328
|
+
if (currentOperatorValueType === "between") {
|
|
9329
|
+
result.value = "";
|
|
9330
|
+
} else {
|
|
9331
|
+
result.value = (_c = currentValue[0]) != null ? _c : "";
|
|
9332
|
+
}
|
|
9333
|
+
} else {
|
|
9334
|
+
result.value = currentValue;
|
|
9335
|
+
}
|
|
9336
|
+
return result;
|
|
9337
|
+
case "array":
|
|
9338
|
+
if (currentOperatorValueType === "between") {
|
|
9339
|
+
result.value = "";
|
|
9340
|
+
} else if (Array.isArray(currentValue)) {
|
|
9341
|
+
result.value = currentValue;
|
|
9342
|
+
} else {
|
|
9343
|
+
result.value = currentValue ? [currentValue] : [];
|
|
9344
|
+
}
|
|
9345
|
+
return result;
|
|
9346
|
+
case "between":
|
|
9347
|
+
if (Array.isArray(currentValue)) {
|
|
9348
|
+
result.value = "";
|
|
9349
|
+
} else {
|
|
9350
|
+
result.value = [currentValue, ""];
|
|
9351
|
+
}
|
|
9352
|
+
return result;
|
|
9353
|
+
case "none":
|
|
9354
|
+
result.value = "";
|
|
9355
|
+
return result;
|
|
9356
|
+
default:
|
|
9357
|
+
result.value = newOperatorValueType;
|
|
9358
|
+
return result;
|
|
9359
|
+
}
|
|
9360
|
+
}
|
|
9361
|
+
}
|
|
9362
|
+
function isHardcodedOperatorValue(valueType) {
|
|
9363
|
+
return valueType !== void 0 && valueType !== "array" && valueType !== "between" && valueType !== "none" && valueType !== "single";
|
|
9364
|
+
}
|
|
9365
|
+
function hasBindings(currentValue) {
|
|
9366
|
+
if (currentValue === void 0) {
|
|
9367
|
+
return false;
|
|
9368
|
+
}
|
|
9369
|
+
if (Array.isArray(currentValue)) {
|
|
9370
|
+
return currentValue.some((value) => (0, import_canvas12.hasReferencedVariables)(value));
|
|
9371
|
+
}
|
|
9372
|
+
return (0, import_canvas12.hasReferencedVariables)(currentValue) > 0;
|
|
9373
|
+
}
|
|
9374
|
+
|
|
9375
|
+
// src/components/SearchAndFilter/FilterItems.tsx
|
|
9376
|
+
var import_jsx_runtime87 = require("@emotion/react/jsx-runtime");
|
|
9170
9377
|
var FilterItems = ({
|
|
9171
9378
|
addButtonText = "add condition",
|
|
9172
9379
|
additionalFiltersContainer,
|
|
9173
9380
|
filterTitle,
|
|
9174
9381
|
resetButtonText,
|
|
9175
|
-
initialCriteriaTitle
|
|
9382
|
+
initialCriteriaTitle,
|
|
9383
|
+
criteriaGroupOperator
|
|
9176
9384
|
}) => {
|
|
9177
9385
|
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
9178
9386
|
const handleUpdateFilter = (index, prop, value) => {
|
|
@@ -9180,32 +9388,16 @@ var FilterItems = ({
|
|
|
9180
9388
|
const next = [...filters];
|
|
9181
9389
|
next[index] = { ...next[index], [prop]: value };
|
|
9182
9390
|
if (prop === "operator") {
|
|
9183
|
-
const
|
|
9184
|
-
const
|
|
9185
|
-
if (
|
|
9186
|
-
throw new Error("
|
|
9187
|
-
}
|
|
9188
|
-
if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
|
|
9189
|
-
next[index].value = next[index].value[0];
|
|
9190
|
-
}
|
|
9191
|
-
if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
|
|
9192
|
-
next[index].value = currentValue ? [currentValue] : [];
|
|
9193
|
-
}
|
|
9194
|
-
if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
|
|
9195
|
-
next[index].value = "";
|
|
9196
|
-
}
|
|
9197
|
-
if (noValueOperators.has(newOperator)) {
|
|
9198
|
-
next[index].value = "";
|
|
9199
|
-
}
|
|
9200
|
-
if (newOperator === "between" && Array.isArray(currentValue) === false) {
|
|
9201
|
-
next[index].value = [currentValue, ""];
|
|
9202
|
-
}
|
|
9203
|
-
if (value === "def" || value === "true") {
|
|
9204
|
-
next[index].value = "true";
|
|
9205
|
-
}
|
|
9206
|
-
if (value === "ndef" || value === "false") {
|
|
9207
|
-
next[index].value = "false";
|
|
9391
|
+
const newOperatorId = value;
|
|
9392
|
+
const currentFilter = next[index];
|
|
9393
|
+
if (!newOperatorId) {
|
|
9394
|
+
throw new Error("you bad");
|
|
9208
9395
|
}
|
|
9396
|
+
next[index] = getNewFilterValueAfterOperatorChange({
|
|
9397
|
+
newOperatorId,
|
|
9398
|
+
currentFilter,
|
|
9399
|
+
filterOptions
|
|
9400
|
+
});
|
|
9209
9401
|
}
|
|
9210
9402
|
if (prop === "field") {
|
|
9211
9403
|
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
@@ -9214,15 +9406,16 @@ var FilterItems = ({
|
|
|
9214
9406
|
})) == 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";
|
|
9215
9407
|
next[index].operator = firstOperatorInAvailableOperators;
|
|
9216
9408
|
next[index].value = "";
|
|
9409
|
+
next[index].dynamicField = void 0;
|
|
9217
9410
|
}
|
|
9218
9411
|
setFilters(next);
|
|
9219
9412
|
};
|
|
9220
|
-
return /* @__PURE__ */ (0,
|
|
9413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9221
9414
|
FilterMenu,
|
|
9222
9415
|
{
|
|
9223
9416
|
id: "search-and-filter-options",
|
|
9224
9417
|
dataTestId: "search-and-filter-options",
|
|
9225
|
-
menuControls: /* @__PURE__ */ (0,
|
|
9418
|
+
menuControls: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
9226
9419
|
"button",
|
|
9227
9420
|
{
|
|
9228
9421
|
type: "button",
|
|
@@ -9230,7 +9423,7 @@ var FilterItems = ({
|
|
|
9230
9423
|
onClick: handleAddFilter,
|
|
9231
9424
|
"data-testid": "add-filter",
|
|
9232
9425
|
children: [
|
|
9233
|
-
/* @__PURE__ */ (0,
|
|
9426
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_design_system59.Icon, { icon: import_CgMathPlus.CgMathPlus, iconColor: "currentColor", size: "1rem" }),
|
|
9234
9427
|
addButtonText
|
|
9235
9428
|
]
|
|
9236
9429
|
}
|
|
@@ -9246,17 +9439,18 @@ var FilterItems = ({
|
|
|
9246
9439
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
9247
9440
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
9248
9441
|
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
9249
|
-
return /* @__PURE__ */ (0,
|
|
9442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9250
9443
|
FilterItem,
|
|
9251
9444
|
{
|
|
9252
9445
|
index: i,
|
|
9253
|
-
|
|
9254
|
-
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
9446
|
+
onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
|
|
9255
9447
|
operatorOptions: possibleOperators,
|
|
9256
9448
|
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
9257
9449
|
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
9450
|
+
onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
|
|
9258
9451
|
valueOptions: possibleValueOptions,
|
|
9259
|
-
initialCriteriaTitle
|
|
9452
|
+
initialCriteriaTitle,
|
|
9453
|
+
criteriaGroupOperator
|
|
9260
9454
|
},
|
|
9261
9455
|
i
|
|
9262
9456
|
);
|
|
@@ -9266,11 +9460,11 @@ var FilterItems = ({
|
|
|
9266
9460
|
};
|
|
9267
9461
|
|
|
9268
9462
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9269
|
-
var
|
|
9463
|
+
var import_design_system61 = require("@uniformdev/design-system");
|
|
9270
9464
|
|
|
9271
9465
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
9272
|
-
var
|
|
9273
|
-
var
|
|
9466
|
+
var import_design_system60 = require("@uniformdev/design-system");
|
|
9467
|
+
var import_jsx_runtime88 = require("@emotion/react/jsx-runtime");
|
|
9274
9468
|
var SearchAndFilterResultContainer = ({
|
|
9275
9469
|
buttonText,
|
|
9276
9470
|
clearButtonLabel = "clear",
|
|
@@ -9300,19 +9494,19 @@ var SearchAndFilterResultContainer = ({
|
|
|
9300
9494
|
handleResetFilters();
|
|
9301
9495
|
}
|
|
9302
9496
|
};
|
|
9303
|
-
return /* @__PURE__ */ (0,
|
|
9304
|
-
/* @__PURE__ */ (0,
|
|
9305
|
-
/* @__PURE__ */ (0,
|
|
9497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
9498
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system60.HorizontalRhythm, { children: [
|
|
9499
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { children: [
|
|
9306
9500
|
totalResults,
|
|
9307
9501
|
" results ",
|
|
9308
9502
|
searchTerm ? `for "${searchTerm}"` : null
|
|
9309
9503
|
] }),
|
|
9310
|
-
!searchTerm || hideClearButton ? null : /* @__PURE__ */ (0,
|
|
9504
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_design_system60.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
9311
9505
|
] }),
|
|
9312
|
-
totalResults === 0 ? /* @__PURE__ */ (0,
|
|
9313
|
-
calloutText ? /* @__PURE__ */ (0,
|
|
9314
|
-
hideClearButton ? null : /* @__PURE__ */ (0,
|
|
9315
|
-
|
|
9506
|
+
totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system60.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
9507
|
+
calloutText ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_design_system60.Paragraph, { children: calloutText }) : null,
|
|
9508
|
+
hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
9509
|
+
import_design_system60.Button,
|
|
9316
9510
|
{
|
|
9317
9511
|
buttonType: "tertiaryOutline",
|
|
9318
9512
|
size: "xs",
|
|
@@ -9326,14 +9520,14 @@ var SearchAndFilterResultContainer = ({
|
|
|
9326
9520
|
};
|
|
9327
9521
|
|
|
9328
9522
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9329
|
-
var
|
|
9523
|
+
var import_jsx_runtime89 = require("@emotion/react/jsx-runtime");
|
|
9330
9524
|
var SearchAndFilter = ({
|
|
9331
9525
|
filters,
|
|
9332
9526
|
filterOptions,
|
|
9333
9527
|
filterVisible,
|
|
9334
9528
|
filterControls,
|
|
9335
9529
|
viewSwitchControls,
|
|
9336
|
-
resultsContainerView = /* @__PURE__ */ (0,
|
|
9530
|
+
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SearchAndFilterResultContainer, {}),
|
|
9337
9531
|
filterMapper: filterMapper2 = filterMapper,
|
|
9338
9532
|
additionalFiltersContainer,
|
|
9339
9533
|
onChange,
|
|
@@ -9343,7 +9537,7 @@ var SearchAndFilter = ({
|
|
|
9343
9537
|
allowBindingSearchTerm = false,
|
|
9344
9538
|
resetFilterValues = []
|
|
9345
9539
|
}) => {
|
|
9346
|
-
return /* @__PURE__ */ (0,
|
|
9540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
9347
9541
|
SearchAndFilterProvider,
|
|
9348
9542
|
{
|
|
9349
9543
|
filters,
|
|
@@ -9356,18 +9550,18 @@ var SearchAndFilter = ({
|
|
|
9356
9550
|
resetFilterValues,
|
|
9357
9551
|
filterMapper: filterMapper2,
|
|
9358
9552
|
allowBindingSearchTerm,
|
|
9359
|
-
children: /* @__PURE__ */ (0,
|
|
9360
|
-
/* @__PURE__ */ (0,
|
|
9361
|
-
/* @__PURE__ */ (0,
|
|
9553
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_design_system61.VerticalRhythm, { "data-testid": "search-and-filter", children: [
|
|
9554
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
9555
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
9362
9556
|
"div",
|
|
9363
9557
|
{
|
|
9364
9558
|
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
9365
|
-
children: !filterControls ? /* @__PURE__ */ (0,
|
|
9559
|
+
children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
9366
9560
|
}
|
|
9367
9561
|
),
|
|
9368
9562
|
viewSwitchControls
|
|
9369
9563
|
] }),
|
|
9370
|
-
/* @__PURE__ */ (0,
|
|
9564
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FilterItems, { additionalFiltersContainer }),
|
|
9371
9565
|
resultsContainerView
|
|
9372
9566
|
] })
|
|
9373
9567
|
}
|
|
@@ -9375,10 +9569,10 @@ var SearchAndFilter = ({
|
|
|
9375
9569
|
};
|
|
9376
9570
|
|
|
9377
9571
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
9378
|
-
var
|
|
9572
|
+
var import_design_system62 = require("@uniformdev/design-system");
|
|
9379
9573
|
var import_react91 = require("react");
|
|
9380
9574
|
var import_react_use11 = require("react-use");
|
|
9381
|
-
var
|
|
9575
|
+
var import_jsx_runtime90 = require("@emotion/react/jsx-runtime");
|
|
9382
9576
|
var SearchOnlyContext = (0, import_react91.createContext)({
|
|
9383
9577
|
searchTerm: "",
|
|
9384
9578
|
setSearchTerm: () => {
|
|
@@ -9395,15 +9589,15 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9395
9589
|
300,
|
|
9396
9590
|
[localeSearchTerm]
|
|
9397
9591
|
);
|
|
9398
|
-
return /* @__PURE__ */ (0,
|
|
9592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
9399
9593
|
SearchOnlyContext.Provider,
|
|
9400
9594
|
{
|
|
9401
9595
|
value: {
|
|
9402
9596
|
searchTerm,
|
|
9403
9597
|
setSearchTerm: setLocaleSearchTerm
|
|
9404
9598
|
},
|
|
9405
|
-
children: /* @__PURE__ */ (0,
|
|
9406
|
-
|
|
9599
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
9600
|
+
import_design_system62.InputKeywordSearch,
|
|
9407
9601
|
{
|
|
9408
9602
|
placeholder: "Search...",
|
|
9409
9603
|
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
@@ -9417,18 +9611,18 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9417
9611
|
};
|
|
9418
9612
|
|
|
9419
9613
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9420
|
-
var
|
|
9614
|
+
var import_design_system64 = require("@uniformdev/design-system");
|
|
9421
9615
|
|
|
9422
9616
|
// src/components/SearchAndFilter/styles/SortItems.styles.ts
|
|
9423
9617
|
var import_react92 = require("@emotion/react");
|
|
9424
|
-
var
|
|
9618
|
+
var import_design_system63 = require("@uniformdev/design-system");
|
|
9425
9619
|
var ConditionalFilterRow2 = import_react92.css`
|
|
9426
9620
|
display: grid;
|
|
9427
9621
|
grid-template-columns: 35px 1fr;
|
|
9428
9622
|
gap: var(--spacing-sm);
|
|
9429
9623
|
margin-left: var(--spacing-base);
|
|
9430
9624
|
|
|
9431
|
-
${(0,
|
|
9625
|
+
${(0, import_design_system63.cq)("380px")} {
|
|
9432
9626
|
align-items: center;
|
|
9433
9627
|
|
|
9434
9628
|
&:after {
|
|
@@ -9449,14 +9643,14 @@ var ConditionalFilterRow2 = import_react92.css`
|
|
|
9449
9643
|
grid-template-columns: 50px 1fr;
|
|
9450
9644
|
}
|
|
9451
9645
|
|
|
9452
|
-
${(0,
|
|
9646
|
+
${(0, import_design_system63.cq)("580px")} {
|
|
9453
9647
|
&:after {
|
|
9454
9648
|
display: none;
|
|
9455
9649
|
}
|
|
9456
9650
|
}
|
|
9457
9651
|
|
|
9458
9652
|
@media (prefers-reduced-motion: no-preference) {
|
|
9459
|
-
animation: ${
|
|
9653
|
+
animation: ${import_design_system63.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
9460
9654
|
}
|
|
9461
9655
|
`;
|
|
9462
9656
|
var ConditionalInputRow2 = import_react92.css`
|
|
@@ -9464,7 +9658,7 @@ var ConditionalInputRow2 = import_react92.css`
|
|
|
9464
9658
|
gap: var(--spacing-sm);
|
|
9465
9659
|
flex-wrap: wrap;
|
|
9466
9660
|
|
|
9467
|
-
${(0,
|
|
9661
|
+
${(0, import_design_system63.cq)("380px")} {
|
|
9468
9662
|
& > div:nth-child(-n + 2) {
|
|
9469
9663
|
width: calc(50% - var(--spacing-sm));
|
|
9470
9664
|
}
|
|
@@ -9473,7 +9667,7 @@ var ConditionalInputRow2 = import_react92.css`
|
|
|
9473
9667
|
width: calc(100% - 48px);
|
|
9474
9668
|
}
|
|
9475
9669
|
}
|
|
9476
|
-
${(0,
|
|
9670
|
+
${(0, import_design_system63.cq)("580px")} {
|
|
9477
9671
|
display: grid;
|
|
9478
9672
|
grid-template-columns: 200px 160px 1fr 32px;
|
|
9479
9673
|
|
|
@@ -9497,7 +9691,8 @@ var FilterButton3 = import_react92.css`
|
|
|
9497
9691
|
gap: var(--spacing-sm);
|
|
9498
9692
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
9499
9693
|
max-height: 40px;
|
|
9500
|
-
transition:
|
|
9694
|
+
transition:
|
|
9695
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
9501
9696
|
background-color var(--duration-fast) var(--timing-ease-out),
|
|
9502
9697
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
9503
9698
|
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
@@ -9623,15 +9818,11 @@ var SearchAndFilterButtonGroup2 = import_react92.css`
|
|
|
9623
9818
|
`;
|
|
9624
9819
|
var SortFilterWrapper = (hiddenLocaleInput) => import_react92.css`
|
|
9625
9820
|
align-items: center;
|
|
9626
|
-
border-top: 1px solid var(--gray-300);
|
|
9627
9821
|
display: flex;
|
|
9628
|
-
flex-wrap: wrap;
|
|
9629
9822
|
gap: var(--spacing-base);
|
|
9630
|
-
|
|
9631
|
-
position: relative;
|
|
9632
|
-
z-index: 0;
|
|
9823
|
+
flex-grow: 1;
|
|
9633
9824
|
|
|
9634
|
-
${(0,
|
|
9825
|
+
${(0, import_design_system63.cq)("420px")} {
|
|
9635
9826
|
display: grid;
|
|
9636
9827
|
grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
|
|
9637
9828
|
}
|
|
@@ -9653,7 +9844,7 @@ var InputVariableWrapper = import_react92.css`
|
|
|
9653
9844
|
`;
|
|
9654
9845
|
|
|
9655
9846
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9656
|
-
var
|
|
9847
|
+
var import_jsx_runtime91 = require("@emotion/react/jsx-runtime");
|
|
9657
9848
|
var SortItems = ({
|
|
9658
9849
|
sortByLabel = "Sort by",
|
|
9659
9850
|
localeLabel = "Show locale",
|
|
@@ -9675,11 +9866,11 @@ var SortItems = ({
|
|
|
9675
9866
|
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
9676
9867
|
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
9677
9868
|
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9678
|
-
return /* @__PURE__ */ (0,
|
|
9679
|
-
/* @__PURE__ */ (0,
|
|
9680
|
-
/* @__PURE__ */ (0,
|
|
9681
|
-
/* @__PURE__ */ (0,
|
|
9682
|
-
/* @__PURE__ */ (0,
|
|
9869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9870
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_design_system64.VerticalRhythm, { gap: "xs", children: [
|
|
9871
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { css: Title2, children: sortByLabel }),
|
|
9872
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { css: SortFilterInputRow, children: [
|
|
9873
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9683
9874
|
InputVariables,
|
|
9684
9875
|
{
|
|
9685
9876
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9687,8 +9878,8 @@ var SortItems = ({
|
|
|
9687
9878
|
value: sortField,
|
|
9688
9879
|
valueToResetTo: "created_at",
|
|
9689
9880
|
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9690
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
9691
|
-
|
|
9881
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9882
|
+
import_design_system64.InputComboBox,
|
|
9692
9883
|
{
|
|
9693
9884
|
id: "sort-by-field",
|
|
9694
9885
|
"aria-label": "Sort by",
|
|
@@ -9710,7 +9901,7 @@ var SortItems = ({
|
|
|
9710
9901
|
)
|
|
9711
9902
|
}
|
|
9712
9903
|
),
|
|
9713
|
-
/* @__PURE__ */ (0,
|
|
9904
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9714
9905
|
InputVariables,
|
|
9715
9906
|
{
|
|
9716
9907
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9718,8 +9909,8 @@ var SortItems = ({
|
|
|
9718
9909
|
valueToResetTo: "DESC",
|
|
9719
9910
|
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9720
9911
|
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9721
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
9722
|
-
|
|
9912
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9913
|
+
import_design_system64.SegmentedControl,
|
|
9723
9914
|
{
|
|
9724
9915
|
noCheckmark: true,
|
|
9725
9916
|
name: "sortBy",
|
|
@@ -9750,15 +9941,15 @@ var SortItems = ({
|
|
|
9750
9941
|
)
|
|
9751
9942
|
] })
|
|
9752
9943
|
] }),
|
|
9753
|
-
hideLocaleOptions ? null : /* @__PURE__ */ (0,
|
|
9944
|
+
hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system64.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9754
9945
|
InputVariables,
|
|
9755
9946
|
{
|
|
9756
9947
|
label: localeLabelValue,
|
|
9757
9948
|
value: localeValue,
|
|
9758
9949
|
showMenuPosition: "inline-right",
|
|
9759
9950
|
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9760
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
9761
|
-
|
|
9951
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9952
|
+
import_design_system64.InputSelect,
|
|
9762
9953
|
{
|
|
9763
9954
|
name: "localeReturned",
|
|
9764
9955
|
"aria-label": localeLabelValue,
|
|
@@ -9787,7 +9978,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
9787
9978
|
}
|
|
9788
9979
|
|
|
9789
9980
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
9790
|
-
var
|
|
9981
|
+
var import_canvas13 = require("@uniformdev/canvas");
|
|
9791
9982
|
var import_react93 = require("react");
|
|
9792
9983
|
function useContentDataResourceLocaleInfo({
|
|
9793
9984
|
locale,
|
|
@@ -9798,18 +9989,18 @@ function useContentDataResourceLocaleInfo({
|
|
|
9798
9989
|
const setLocaleRef = (0, import_react93.useRef)(setLocale);
|
|
9799
9990
|
setLocaleRef.current = setLocale;
|
|
9800
9991
|
const { flatVariables } = useVariables();
|
|
9801
|
-
const effectiveLocale = locale != null ? locale : dynamicInputs[
|
|
9802
|
-
const boundLocale = (_a = (0,
|
|
9992
|
+
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas13.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas13.createVariableReference)(import_canvas13.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
9993
|
+
const boundLocale = (_a = (0, import_canvas13.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
9803
9994
|
(0, import_react93.useEffect)(() => {
|
|
9804
9995
|
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
9805
|
-
setLocaleRef.current((0,
|
|
9996
|
+
setLocaleRef.current((0, import_canvas13.createVariableReference)(import_canvas13.LOCALE_DYNAMIC_INPUT_NAME));
|
|
9806
9997
|
}
|
|
9807
9998
|
}, [locale, effectiveLocale]);
|
|
9808
9999
|
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
9809
10000
|
}
|
|
9810
10001
|
|
|
9811
10002
|
// src/index.ts
|
|
9812
|
-
var
|
|
10003
|
+
var import_design_system65 = require("@uniformdev/design-system");
|
|
9813
10004
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
9814
10005
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9815
10006
|
0 && (module.exports = {
|
|
@@ -9821,6 +10012,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
9821
10012
|
Callout,
|
|
9822
10013
|
ControlledValuePlugin,
|
|
9823
10014
|
DATE_OPERATORS,
|
|
10015
|
+
DATE_TIME_OPERATORS,
|
|
9824
10016
|
DISCONNECT_VARIABLE_COMMAND,
|
|
9825
10017
|
DamSelectedItem,
|
|
9826
10018
|
DataRefreshButton,
|
|
@@ -9914,7 +10106,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
9914
10106
|
RequestUrlInput,
|
|
9915
10107
|
ResolvableLoadingValue,
|
|
9916
10108
|
SELECT_OPERATORS,
|
|
9917
|
-
SYSTEM_DATE_OPERATORS,
|
|
9918
10109
|
SYSTEM_FIELD_OPERATORS,
|
|
9919
10110
|
ScrollableList,
|
|
9920
10111
|
ScrollableListItem,
|
|
@@ -10011,6 +10202,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
10011
10202
|
selectedItemIcon,
|
|
10012
10203
|
selectedItemInner,
|
|
10013
10204
|
selectedItemTitle,
|
|
10205
|
+
serializeVariablesEditorSerializedState,
|
|
10014
10206
|
serializeVariablesEditorState,
|
|
10015
10207
|
setVariablesEditorValue,
|
|
10016
10208
|
urlEncodeRequestParameter,
|