@uniformdev/mesh-sdk-react 19.179.1-alpha.1 → 19.179.2-alpha.25
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 +199 -123
- package/dist/index.d.ts +199 -123
- package/dist/index.esm.js +551 -364
- package/dist/index.js +640 -457
- package/dist/index.mjs +551 -364
- package/package.json +14 -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,52 @@ 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
|
+
serializeRecursive(serializedEditorState, buf);
|
|
3059
|
+
const result = buf.join("");
|
|
3060
|
+
return result.length > 0 ? result : void 0;
|
|
3061
|
+
}
|
|
3062
|
+
function serializeRecursive(node, buffer) {
|
|
3063
|
+
if (node.type === import_lexical.TextNode.getType()) {
|
|
3064
|
+
buffer.push(node.text.replace(variablePrefix, "\\${"));
|
|
3065
|
+
}
|
|
3066
|
+
if (node.type === VariableNode.getType()) {
|
|
3067
|
+
buffer.push((0, import_canvas2.createVariableReference)(node.reference));
|
|
3068
|
+
}
|
|
3069
|
+
if (node.type === import_lexical.LineBreakNode.getType()) {
|
|
3070
|
+
buffer.push("\n");
|
|
3071
|
+
}
|
|
3072
|
+
if ("children" in node && node.children) {
|
|
3073
|
+
for (const child of node.children) {
|
|
3074
|
+
serializeRecursive(child, buffer);
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
// src/components/Variables/util/deserializeVariablesEditorState.ts
|
|
3080
|
+
var import_canvas3 = require("@uniformdev/canvas");
|
|
3081
|
+
var import_lexical2 = require("lexical");
|
|
3045
3082
|
function deserializeVariablesEditorState(serialized) {
|
|
3046
3083
|
const result = [];
|
|
3047
|
-
(0,
|
|
3084
|
+
(0, import_canvas3.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
|
|
3048
3085
|
if (type === "text") {
|
|
3049
3086
|
const node = {
|
|
3050
|
-
type:
|
|
3087
|
+
type: import_lexical2.TextNode.getType(),
|
|
3051
3088
|
text: token,
|
|
3052
3089
|
mode: "normal",
|
|
3053
3090
|
version: 1,
|
|
@@ -3089,11 +3126,11 @@ function deserializeVariablesEditorState(serialized) {
|
|
|
3089
3126
|
}
|
|
3090
3127
|
|
|
3091
3128
|
// src/components/Variables/util/refreshVariableNodeMetadata.ts
|
|
3092
|
-
var
|
|
3129
|
+
var import_lexical3 = require("lexical");
|
|
3093
3130
|
function refreshVariableNodeMetadata(editor) {
|
|
3094
3131
|
setTimeout(() => {
|
|
3095
3132
|
editor.update(() => {
|
|
3096
|
-
(0,
|
|
3133
|
+
(0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
3097
3134
|
variableNode.markDirty();
|
|
3098
3135
|
});
|
|
3099
3136
|
});
|
|
@@ -3131,7 +3168,8 @@ function setVariablesEditorValue(editor, newValue) {
|
|
|
3131
3168
|
indent: 0,
|
|
3132
3169
|
direction: null,
|
|
3133
3170
|
children: [],
|
|
3134
|
-
textFormat: 0
|
|
3171
|
+
textFormat: 0,
|
|
3172
|
+
textStyle: ""
|
|
3135
3173
|
}
|
|
3136
3174
|
]
|
|
3137
3175
|
}
|
|
@@ -3149,17 +3187,18 @@ function ControlledValuePlugin({
|
|
|
3149
3187
|
extraDependencies
|
|
3150
3188
|
}) {
|
|
3151
3189
|
const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
|
|
3152
|
-
const lastValueRef = (0, import_react31.useRef)(value);
|
|
3153
3190
|
(0, import_react31.useEffect)(() => {
|
|
3191
|
+
var _a, _b;
|
|
3154
3192
|
if (!enabled) {
|
|
3155
3193
|
return;
|
|
3156
3194
|
}
|
|
3157
|
-
|
|
3195
|
+
const currentValue = (_a = serializeVariablesEditorState(editor.getEditorState())) != null ? _a : "";
|
|
3196
|
+
const newValue = (_b = value !== void 0 && typeof value !== "string" ? serializeVariablesEditorSerializedState(value.root) : value) != null ? _b : "";
|
|
3197
|
+
if (currentValue === newValue) {
|
|
3158
3198
|
return;
|
|
3159
3199
|
}
|
|
3160
3200
|
setTimeout(() => {
|
|
3161
3201
|
if (editor) {
|
|
3162
|
-
lastValueRef.current = value;
|
|
3163
3202
|
setVariablesEditorValue(editor, value);
|
|
3164
3203
|
}
|
|
3165
3204
|
});
|
|
@@ -3248,9 +3287,9 @@ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerCont
|
|
|
3248
3287
|
var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
|
|
3249
3288
|
var import_selection = require("@lexical/selection");
|
|
3250
3289
|
var import_utils2 = require("@lexical/utils");
|
|
3251
|
-
var
|
|
3290
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
3252
3291
|
var import_design_system18 = require("@uniformdev/design-system");
|
|
3253
|
-
var
|
|
3292
|
+
var import_lexical5 = require("lexical");
|
|
3254
3293
|
var import_react40 = require("react");
|
|
3255
3294
|
|
|
3256
3295
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
@@ -3265,10 +3304,10 @@ var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerCont
|
|
|
3265
3304
|
var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
|
|
3266
3305
|
var import_utils = require("@lexical/utils");
|
|
3267
3306
|
var import_AiFillPlusCircle = require("@react-icons/all-files/ai/AiFillPlusCircle");
|
|
3268
|
-
var
|
|
3307
|
+
var import_canvas4 = require("@uniformdev/canvas");
|
|
3269
3308
|
var import_design_system17 = require("@uniformdev/design-system");
|
|
3270
|
-
var
|
|
3271
|
-
var
|
|
3309
|
+
var import_lite = require("dequal/lite");
|
|
3310
|
+
var import_lexical4 = require("lexical");
|
|
3272
3311
|
var import_react39 = require("react");
|
|
3273
3312
|
var import_react_dom = require("react-dom");
|
|
3274
3313
|
|
|
@@ -3723,12 +3762,12 @@ function variablesToGroupedList(variables, filterFn, context) {
|
|
|
3723
3762
|
|
|
3724
3763
|
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3725
3764
|
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,
|
|
3765
|
+
var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:open-insert-variable");
|
|
3766
|
+
var EDIT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:edit-variable");
|
|
3767
|
+
var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)(
|
|
3729
3768
|
"uniform:disconnect-variable"
|
|
3730
3769
|
);
|
|
3731
|
-
var INSERT_VARIABLE_COMMAND = (0,
|
|
3770
|
+
var INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:insert-variable");
|
|
3732
3771
|
var TRIGGER = "\\$\\$";
|
|
3733
3772
|
var LENGTH_LIMIT = 20;
|
|
3734
3773
|
var DollarSignVariablesRegex = new RegExp(`(^.*)(${TRIGGER}(.{0,${LENGTH_LIMIT}}))$`);
|
|
@@ -3798,7 +3837,7 @@ function useVariablesMenu({
|
|
|
3798
3837
|
var _a;
|
|
3799
3838
|
const targetVariable = variables[value];
|
|
3800
3839
|
if (overwriteExistingValue) {
|
|
3801
|
-
setVariablesEditorValue(editor, (0,
|
|
3840
|
+
setVariablesEditorValue(editor, (0, import_canvas4.createVariableReference)(value));
|
|
3802
3841
|
return true;
|
|
3803
3842
|
}
|
|
3804
3843
|
const variableNode = $createVariableNode(value, {
|
|
@@ -3812,7 +3851,7 @@ function useVariablesMenu({
|
|
|
3812
3851
|
if (nodeToReplace) {
|
|
3813
3852
|
nodeToReplace.replace(variableNode);
|
|
3814
3853
|
} else {
|
|
3815
|
-
(0,
|
|
3854
|
+
(0, import_lexical4.$insertNodes)([variableNode]);
|
|
3816
3855
|
}
|
|
3817
3856
|
});
|
|
3818
3857
|
}
|
|
@@ -3895,11 +3934,11 @@ function VariablesPlugin({
|
|
|
3895
3934
|
return;
|
|
3896
3935
|
}
|
|
3897
3936
|
editor.update(() => {
|
|
3898
|
-
const selection = (0,
|
|
3899
|
-
if ((0,
|
|
3937
|
+
const selection = (0, import_lexical4.$getSelection)();
|
|
3938
|
+
if ((0, import_lexical4.$isNodeSelection)(selection)) {
|
|
3900
3939
|
const selectedNodes = selection.getNodes();
|
|
3901
3940
|
if (selectedNodes.every((node) => $isVariableNode(node))) {
|
|
3902
|
-
(0,
|
|
3941
|
+
(0, import_lexical4.$setSelection)(null);
|
|
3903
3942
|
}
|
|
3904
3943
|
}
|
|
3905
3944
|
});
|
|
@@ -3915,7 +3954,7 @@ function VariablesPlugin({
|
|
|
3915
3954
|
}
|
|
3916
3955
|
return true;
|
|
3917
3956
|
},
|
|
3918
|
-
|
|
3957
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
3919
3958
|
),
|
|
3920
3959
|
// disconnects a variable node from its variable value and leaves the variable's default value
|
|
3921
3960
|
// as a string literal in its place. Note that single-valued binding UIs override this so that it
|
|
@@ -3925,17 +3964,17 @@ function VariablesPlugin({
|
|
|
3925
3964
|
({ sourceKey }) => {
|
|
3926
3965
|
editor.update(() => {
|
|
3927
3966
|
var _a;
|
|
3928
|
-
const currentNode = (0,
|
|
3967
|
+
const currentNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
|
|
3929
3968
|
if (!$isVariableNode(currentNode)) {
|
|
3930
3969
|
throw new Error("Cannot disconnect a non-variable node");
|
|
3931
3970
|
}
|
|
3932
3971
|
const currentVariableDefinition = variablesRef.current.variables[currentNode.reference];
|
|
3933
|
-
const variableTextNode = (0,
|
|
3972
|
+
const variableTextNode = (0, import_lexical4.$createTextNode)(
|
|
3934
3973
|
variableDefaultTextValue(
|
|
3935
3974
|
(_a = currentVariableDefinition == null ? void 0 : currentVariableDefinition.default) != null ? _a : currentNode.getState().displayName
|
|
3936
3975
|
)
|
|
3937
3976
|
);
|
|
3938
|
-
const variableNode = (0,
|
|
3977
|
+
const variableNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
|
|
3939
3978
|
if (!variableNode) {
|
|
3940
3979
|
console.error("Disconnected from unknown node.");
|
|
3941
3980
|
return true;
|
|
@@ -3945,7 +3984,7 @@ function VariablesPlugin({
|
|
|
3945
3984
|
});
|
|
3946
3985
|
return true;
|
|
3947
3986
|
},
|
|
3948
|
-
|
|
3987
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
3949
3988
|
),
|
|
3950
3989
|
editor.registerCommand(
|
|
3951
3990
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
@@ -3965,7 +4004,7 @@ function VariablesPlugin({
|
|
|
3965
4004
|
}
|
|
3966
4005
|
return true;
|
|
3967
4006
|
},
|
|
3968
|
-
|
|
4007
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
3969
4008
|
),
|
|
3970
4009
|
// register the insert variable command, used to handle inserting
|
|
3971
4010
|
// a variable reference from non-autocomplete menus at the current selection,
|
|
@@ -3976,27 +4015,33 @@ function VariablesPlugin({
|
|
|
3976
4015
|
var _a, _b;
|
|
3977
4016
|
if (!disableVariables) {
|
|
3978
4017
|
const targetVariable = variablesRef.current.variables[reference];
|
|
3979
|
-
if (overwriteExistingValue) {
|
|
3980
|
-
setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(reference));
|
|
3981
|
-
return true;
|
|
3982
|
-
}
|
|
3983
4018
|
const variableNode = $createVariableNode(reference, {
|
|
3984
|
-
displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
|
|
4019
|
+
displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
|
|
3985
4020
|
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
3986
4021
|
referenceIsValid: true,
|
|
3987
4022
|
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
3988
4023
|
isFresh: true,
|
|
3989
4024
|
isLoading: false
|
|
3990
4025
|
});
|
|
4026
|
+
if (overwriteExistingValue) {
|
|
4027
|
+
const pNode = (0, import_lexical4.$createParagraphNode)();
|
|
4028
|
+
pNode.append(variableNode);
|
|
4029
|
+
editor.update(() => {
|
|
4030
|
+
const root = (0, import_lexical4.$getRoot)();
|
|
4031
|
+
root.clear();
|
|
4032
|
+
root.append(pNode);
|
|
4033
|
+
});
|
|
4034
|
+
return true;
|
|
4035
|
+
}
|
|
3991
4036
|
if (targetKey) {
|
|
3992
|
-
(_b = (0,
|
|
4037
|
+
(_b = (0, import_lexical4.$getNodeByKey)(targetKey)) == null ? void 0 : _b.replace(variableNode);
|
|
3993
4038
|
} else {
|
|
3994
|
-
(0,
|
|
4039
|
+
(0, import_lexical4.$insertNodes)([variableNode]);
|
|
3995
4040
|
}
|
|
3996
4041
|
}
|
|
3997
4042
|
return true;
|
|
3998
4043
|
},
|
|
3999
|
-
|
|
4044
|
+
import_lexical4.COMMAND_PRIORITY_NORMAL
|
|
4000
4045
|
)
|
|
4001
4046
|
);
|
|
4002
4047
|
}, [
|
|
@@ -4023,14 +4068,14 @@ function VariablesPlugin({
|
|
|
4023
4068
|
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
4069
|
const newState = {
|
|
4025
4070
|
...currentState,
|
|
4026
|
-
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
|
|
4071
|
+
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
|
|
4027
4072
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
4028
4073
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
4029
4074
|
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
4075
|
tooltip,
|
|
4031
4076
|
isFresh: false
|
|
4032
4077
|
};
|
|
4033
|
-
if (!(0,
|
|
4078
|
+
if (!(0, import_lite.dequal)(currentState, newState)) {
|
|
4034
4079
|
variableNode.setState(newState);
|
|
4035
4080
|
}
|
|
4036
4081
|
},
|
|
@@ -4038,7 +4083,7 @@ function VariablesPlugin({
|
|
|
4038
4083
|
);
|
|
4039
4084
|
(0, import_react39.useEffect)(() => {
|
|
4040
4085
|
editor.update(() => {
|
|
4041
|
-
(0,
|
|
4086
|
+
(0, import_lexical4.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
4042
4087
|
updateExistingNodeIfChanged(variableNode);
|
|
4043
4088
|
});
|
|
4044
4089
|
});
|
|
@@ -4128,7 +4173,7 @@ function VariablesPlugin({
|
|
|
4128
4173
|
|
|
4129
4174
|
// src/components/Variables/composer/VariableNode.tsx
|
|
4130
4175
|
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
4131
|
-
var VariableNode = class _VariableNode extends
|
|
4176
|
+
var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
|
|
4132
4177
|
constructor(reference, state, key) {
|
|
4133
4178
|
super(key);
|
|
4134
4179
|
this.reference = reference;
|
|
@@ -4177,7 +4222,7 @@ var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
|
|
|
4177
4222
|
* (albeit it won't get the fancy chip-node)
|
|
4178
4223
|
*/
|
|
4179
4224
|
getTextContent() {
|
|
4180
|
-
return (0,
|
|
4225
|
+
return (0, import_canvas5.createVariableReference)(this.reference);
|
|
4181
4226
|
}
|
|
4182
4227
|
/** Creates the DOM wrapper that hosts the node */
|
|
4183
4228
|
createDOM() {
|
|
@@ -4211,9 +4256,9 @@ function VariableNodeComponent({
|
|
|
4211
4256
|
const readOnly = !editor.isEditable();
|
|
4212
4257
|
const onDelete = (0, import_react40.useCallback)(
|
|
4213
4258
|
(event) => {
|
|
4214
|
-
if (isSelected && (0,
|
|
4259
|
+
if (isSelected && (0, import_lexical5.$isNodeSelection)((0, import_lexical5.$getSelection)())) {
|
|
4215
4260
|
event.preventDefault();
|
|
4216
|
-
const node = (0,
|
|
4261
|
+
const node = (0, import_lexical5.$getNodeByKey)(nodeKey);
|
|
4217
4262
|
if ($isVariableNode(node)) {
|
|
4218
4263
|
node.remove();
|
|
4219
4264
|
}
|
|
@@ -4224,18 +4269,18 @@ function VariableNodeComponent({
|
|
|
4224
4269
|
);
|
|
4225
4270
|
(0, import_react40.useEffect)(() => {
|
|
4226
4271
|
return (0, import_utils2.mergeRegister)(
|
|
4227
|
-
editor.registerCommand(
|
|
4228
|
-
editor.registerCommand(
|
|
4272
|
+
editor.registerCommand(import_lexical5.KEY_DELETE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
|
|
4273
|
+
editor.registerCommand(import_lexical5.KEY_BACKSPACE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
|
|
4229
4274
|
// HACK: see https://github.com/facebook/lexical/issues/4214
|
|
4230
4275
|
// Copied from https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L775
|
|
4231
4276
|
// Fixes selection moving into and out of this node with arrow keys and plain text plugin.
|
|
4232
4277
|
// If the above bug is fixed this may be removable. It's been tested when this is used within the RTE,
|
|
4233
4278
|
// and seems to work ok there. It should also unregister itself when not in the context of the node. I think?
|
|
4234
4279
|
editor.registerCommand(
|
|
4235
|
-
|
|
4280
|
+
import_lexical5.KEY_ARROW_LEFT_COMMAND,
|
|
4236
4281
|
(event) => {
|
|
4237
|
-
const selection = (0,
|
|
4238
|
-
if ((0,
|
|
4282
|
+
const selection = (0, import_lexical5.$getSelection)();
|
|
4283
|
+
if ((0, import_lexical5.$isNodeSelection)(selection)) {
|
|
4239
4284
|
const nodes = selection.getNodes();
|
|
4240
4285
|
if (nodes.length > 0) {
|
|
4241
4286
|
event.preventDefault();
|
|
@@ -4243,7 +4288,7 @@ function VariableNodeComponent({
|
|
|
4243
4288
|
return true;
|
|
4244
4289
|
}
|
|
4245
4290
|
}
|
|
4246
|
-
if (!(0,
|
|
4291
|
+
if (!(0, import_lexical5.$isRangeSelection)(selection)) {
|
|
4247
4292
|
return false;
|
|
4248
4293
|
}
|
|
4249
4294
|
if ((0, import_selection.$shouldOverrideDefaultCharacterSelection)(selection, true)) {
|
|
@@ -4254,15 +4299,15 @@ function VariableNodeComponent({
|
|
|
4254
4299
|
}
|
|
4255
4300
|
return false;
|
|
4256
4301
|
},
|
|
4257
|
-
|
|
4302
|
+
import_lexical5.COMMAND_PRIORITY_EDITOR
|
|
4258
4303
|
),
|
|
4259
4304
|
// HACK: as above
|
|
4260
4305
|
// Source: https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L802C5-L831C7
|
|
4261
4306
|
editor.registerCommand(
|
|
4262
|
-
|
|
4307
|
+
import_lexical5.KEY_ARROW_RIGHT_COMMAND,
|
|
4263
4308
|
(event) => {
|
|
4264
|
-
const selection = (0,
|
|
4265
|
-
if ((0,
|
|
4309
|
+
const selection = (0, import_lexical5.$getSelection)();
|
|
4310
|
+
if ((0, import_lexical5.$isNodeSelection)(selection) && !$isTargetWithinDecorator(event.target)) {
|
|
4266
4311
|
const nodes = selection.getNodes();
|
|
4267
4312
|
if (nodes.length > 0) {
|
|
4268
4313
|
event.preventDefault();
|
|
@@ -4270,7 +4315,7 @@ function VariableNodeComponent({
|
|
|
4270
4315
|
return true;
|
|
4271
4316
|
}
|
|
4272
4317
|
}
|
|
4273
|
-
if (!(0,
|
|
4318
|
+
if (!(0, import_lexical5.$isRangeSelection)(selection)) {
|
|
4274
4319
|
return false;
|
|
4275
4320
|
}
|
|
4276
4321
|
const isHoldingShift = event.shiftKey;
|
|
@@ -4281,7 +4326,7 @@ function VariableNodeComponent({
|
|
|
4281
4326
|
}
|
|
4282
4327
|
return false;
|
|
4283
4328
|
},
|
|
4284
|
-
|
|
4329
|
+
import_lexical5.COMMAND_PRIORITY_EDITOR
|
|
4285
4330
|
)
|
|
4286
4331
|
);
|
|
4287
4332
|
}, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
|
|
@@ -4305,8 +4350,8 @@ function VariableNodeComponent({
|
|
|
4305
4350
|
);
|
|
4306
4351
|
}
|
|
4307
4352
|
function $isTargetWithinDecorator(target) {
|
|
4308
|
-
const node = (0,
|
|
4309
|
-
return (0,
|
|
4353
|
+
const node = (0, import_lexical5.$getNearestNodeFromDOMNode)(target);
|
|
4354
|
+
return (0, import_lexical5.$isDecoratorNode)(node);
|
|
4310
4355
|
}
|
|
4311
4356
|
|
|
4312
4357
|
// src/components/Variables/InputVariables.tsx
|
|
@@ -4332,19 +4377,19 @@ function EditorRefPlugin({
|
|
|
4332
4377
|
// src/components/Variables/composer/PasteTransformerPlugin.tsx
|
|
4333
4378
|
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
4334
4379
|
var import_utils3 = require("@lexical/utils");
|
|
4335
|
-
var
|
|
4380
|
+
var import_lexical6 = require("lexical");
|
|
4336
4381
|
var import_react41 = require("react");
|
|
4337
4382
|
function PasteTransformerPlugin({ transformPaste }) {
|
|
4338
4383
|
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
4339
4384
|
(0, import_react41.useEffect)(() => {
|
|
4340
4385
|
return (0, import_utils3.mergeRegister)(
|
|
4341
4386
|
editor.registerCommand(
|
|
4342
|
-
|
|
4387
|
+
import_lexical6.PASTE_COMMAND,
|
|
4343
4388
|
(event) => {
|
|
4344
4389
|
var _a;
|
|
4345
|
-
const selection = (0,
|
|
4390
|
+
const selection = (0, import_lexical6.$getSelection)();
|
|
4346
4391
|
const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
|
|
4347
|
-
if (pastedText && transformPaste && (0,
|
|
4392
|
+
if (pastedText && transformPaste && (0, import_lexical6.$isRangeSelection)(selection)) {
|
|
4348
4393
|
const result = transformPaste(pastedText);
|
|
4349
4394
|
if (result !== void 0) {
|
|
4350
4395
|
selection.insertText(result);
|
|
@@ -4353,7 +4398,7 @@ function PasteTransformerPlugin({ transformPaste }) {
|
|
|
4353
4398
|
}
|
|
4354
4399
|
return false;
|
|
4355
4400
|
},
|
|
4356
|
-
|
|
4401
|
+
import_lexical6.COMMAND_PRIORITY_HIGH
|
|
4357
4402
|
)
|
|
4358
4403
|
);
|
|
4359
4404
|
}, [editor, transformPaste]);
|
|
@@ -4382,9 +4427,11 @@ var input = import_react42.css`
|
|
|
4382
4427
|
min-height: 50px;
|
|
4383
4428
|
width: 100%;
|
|
4384
4429
|
position: relative;
|
|
4385
|
-
transition:
|
|
4430
|
+
transition:
|
|
4431
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4386
4432
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
4387
|
-
color var(--duration-fast) var(--timing-ease-out),
|
|
4433
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
4434
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
4388
4435
|
|
|
4389
4436
|
&::placeholder {
|
|
4390
4437
|
color: var(--gray-400);
|
|
@@ -4448,7 +4495,8 @@ var variableBindButton = import_react43.css`
|
|
|
4448
4495
|
display: flex;
|
|
4449
4496
|
height: 1.2rem;
|
|
4450
4497
|
padding: var(--spacing-2xs);
|
|
4451
|
-
transition:
|
|
4498
|
+
transition:
|
|
4499
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4452
4500
|
color var(--duration-fast) var(--timing-ease-out);
|
|
4453
4501
|
width: 1.2rem;
|
|
4454
4502
|
|
|
@@ -4531,23 +4579,9 @@ var inputMultiLine = (lines) => import_react43.css`
|
|
|
4531
4579
|
`;
|
|
4532
4580
|
|
|
4533
4581
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4582
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
4534
4583
|
var React10 = __toESM(require("react"));
|
|
4535
4584
|
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
4585
|
function useInputVariablesState({
|
|
4552
4586
|
value,
|
|
4553
4587
|
onChange,
|
|
@@ -4562,20 +4596,20 @@ function useInputVariablesState({
|
|
|
4562
4596
|
renderMenuInPortal
|
|
4563
4597
|
}) {
|
|
4564
4598
|
const { variables } = useVariables(true);
|
|
4565
|
-
const
|
|
4599
|
+
const variableReferenceCountInValue = (0, import_canvas6.hasReferencedVariables)(value != null ? value : "");
|
|
4566
4600
|
const [lastKnownId] = React10.useState(id);
|
|
4567
|
-
const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(
|
|
4601
|
+
const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
|
|
4568
4602
|
React10.useEffect(() => {
|
|
4569
|
-
if (
|
|
4603
|
+
if (variableReferenceCountInValue) {
|
|
4570
4604
|
setHadVariablesInValue(true);
|
|
4571
4605
|
}
|
|
4572
|
-
}, [
|
|
4606
|
+
}, [variableReferenceCountInValue]);
|
|
4573
4607
|
React10.useEffect(() => {
|
|
4574
4608
|
if (id !== lastKnownId) {
|
|
4575
|
-
setHadVariablesInValue(
|
|
4609
|
+
setHadVariablesInValue(variableReferenceCountInValue > 0);
|
|
4576
4610
|
}
|
|
4577
|
-
}, [
|
|
4578
|
-
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue :
|
|
4611
|
+
}, [variableReferenceCountInValue, id, lastKnownId]);
|
|
4612
|
+
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
|
|
4579
4613
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4580
4614
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
4581
4615
|
const sharedMenuProps = (0, import_react44.useMemo)(
|
|
@@ -4604,7 +4638,7 @@ function useInputVariablesState({
|
|
|
4604
4638
|
return {
|
|
4605
4639
|
sharedMenuProps,
|
|
4606
4640
|
disableVariablesForReals,
|
|
4607
|
-
hasVariablesInValue,
|
|
4641
|
+
hasVariablesInValue: variableReferenceCountInValue > 0,
|
|
4608
4642
|
hadVariablesInValue: hadVariablesInValueForReals,
|
|
4609
4643
|
setHadVariablesInValue
|
|
4610
4644
|
};
|
|
@@ -4627,7 +4661,8 @@ var variableBindButton2 = import_react45.css`
|
|
|
4627
4661
|
display: flex;
|
|
4628
4662
|
height: 1.2rem;
|
|
4629
4663
|
padding: var(--spacing-2xs);
|
|
4630
|
-
transition:
|
|
4664
|
+
transition:
|
|
4665
|
+
background var(--duration-fast) var(--timing-ease-out),
|
|
4631
4666
|
color var(--duration-fast) var(--timing-ease-out);
|
|
4632
4667
|
width: 1.2rem;
|
|
4633
4668
|
|
|
@@ -4645,7 +4680,7 @@ var variableBindButton2 = import_react45.css`
|
|
|
4645
4680
|
|
|
4646
4681
|
// src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
|
|
4647
4682
|
var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
|
|
4648
|
-
var
|
|
4683
|
+
var import_lexical7 = require("lexical");
|
|
4649
4684
|
|
|
4650
4685
|
// src/components/Variables/toolbox/SelectVariableMenu.tsx
|
|
4651
4686
|
var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
|
|
@@ -4753,7 +4788,7 @@ function VariablesComposerVariableMenu(props) {
|
|
|
4753
4788
|
};
|
|
4754
4789
|
const onResetVariable = () => {
|
|
4755
4790
|
var _a;
|
|
4756
|
-
editor.dispatchCommand(
|
|
4791
|
+
editor.dispatchCommand(import_lexical7.CLEAR_EDITOR_COMMAND, void 0);
|
|
4757
4792
|
(_a = props.onResetVariables) == null ? void 0 : _a.call(props);
|
|
4758
4793
|
};
|
|
4759
4794
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -4815,50 +4850,18 @@ function DisablePlugin({ disabled }) {
|
|
|
4815
4850
|
|
|
4816
4851
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4817
4852
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
4818
|
-
var
|
|
4853
|
+
var import_lexical8 = require("lexical");
|
|
4819
4854
|
var import_react48 = require("react");
|
|
4820
4855
|
function SingleLineTextPlugin() {
|
|
4821
4856
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
4822
4857
|
(0, import_react48.useEffect)(() => {
|
|
4823
|
-
editor.registerNodeTransform(
|
|
4858
|
+
editor.registerNodeTransform(import_lexical8.LineBreakNode, (node) => {
|
|
4824
4859
|
node.remove();
|
|
4825
4860
|
});
|
|
4826
4861
|
}, [editor]);
|
|
4827
4862
|
return null;
|
|
4828
4863
|
}
|
|
4829
4864
|
|
|
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
4865
|
// src/components/Variables/toolbox/VariablesComposer.tsx
|
|
4863
4866
|
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
4864
4867
|
function VariablesComposer(props) {
|
|
@@ -5053,7 +5056,8 @@ function InputVariables(props) {
|
|
|
5053
5056
|
filterVariable,
|
|
5054
5057
|
styleVariant = "default",
|
|
5055
5058
|
renderMenuInPortal,
|
|
5056
|
-
disableDismissEditorOnChange
|
|
5059
|
+
disableDismissEditorOnChange,
|
|
5060
|
+
singleTokenMode
|
|
5057
5061
|
} = props;
|
|
5058
5062
|
const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
5059
5063
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -5118,7 +5122,7 @@ function InputVariables(props) {
|
|
|
5118
5122
|
buttonCss: variableBindButton,
|
|
5119
5123
|
tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5120
5124
|
buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5121
|
-
replaceValueOnVariableInsert: useInputWithNoVariables
|
|
5125
|
+
replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
|
|
5122
5126
|
}
|
|
5123
5127
|
)
|
|
5124
5128
|
]
|
|
@@ -5158,13 +5162,13 @@ function InputVariables(props) {
|
|
|
5158
5162
|
showAddVariableMenuOption,
|
|
5159
5163
|
enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
|
|
5160
5164
|
getEditorContext,
|
|
5161
|
-
disabled,
|
|
5165
|
+
disabled: disabled || singleTokenMode,
|
|
5162
5166
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
5163
5167
|
autoFocus,
|
|
5164
5168
|
filterVariable,
|
|
5165
5169
|
children: [
|
|
5166
5170
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PasteTransformerPlugin, { transformPaste }),
|
|
5167
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
5168
5172
|
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
5169
5173
|
body
|
|
5170
5174
|
]
|
|
@@ -5460,6 +5464,12 @@ ${prettifyBindExpression(bindExpression)}`
|
|
|
5460
5464
|
};
|
|
5461
5465
|
}
|
|
5462
5466
|
|
|
5467
|
+
// src/components/Variables/util/hasReferencedVariables.ts
|
|
5468
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
5469
|
+
function hasReferencedVariables2(value) {
|
|
5470
|
+
return (0, import_canvas8.hasReferencedVariables)(value) > 0;
|
|
5471
|
+
}
|
|
5472
|
+
|
|
5463
5473
|
// src/components/Variables/VariablesList.tsx
|
|
5464
5474
|
var import_react58 = require("@emotion/react");
|
|
5465
5475
|
var import_design_system25 = require("@uniformdev/design-system");
|
|
@@ -6488,11 +6498,11 @@ var DataRefreshButton = ({
|
|
|
6488
6498
|
|
|
6489
6499
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6490
6500
|
var import_react68 = require("@emotion/react");
|
|
6491
|
-
var
|
|
6501
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
6492
6502
|
var import_design_system35 = require("@uniformdev/design-system");
|
|
6493
6503
|
|
|
6494
6504
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6495
|
-
var
|
|
6505
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
6496
6506
|
var import_react66 = require("react");
|
|
6497
6507
|
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6498
6508
|
var ObjectSearchContext = (0, import_react66.createContext)({
|
|
@@ -6591,7 +6601,7 @@ function useObjectSearchContext() {
|
|
|
6591
6601
|
return (0, import_react66.useContext)(ObjectSearchContext);
|
|
6592
6602
|
}
|
|
6593
6603
|
function bindQuery(query, inputs) {
|
|
6594
|
-
const { result, errors } = (0,
|
|
6604
|
+
const { result, errors } = (0, import_canvas9.bindVariablesToObject)({
|
|
6595
6605
|
value: query,
|
|
6596
6606
|
variables: inputs,
|
|
6597
6607
|
errorPrefix: "Dynamic input"
|
|
@@ -6780,7 +6790,7 @@ var ObjectSearchContainer = ({
|
|
|
6780
6790
|
onSelectItem([]);
|
|
6781
6791
|
return;
|
|
6782
6792
|
}
|
|
6783
|
-
const { result, errors } = (0,
|
|
6793
|
+
const { result, errors } = (0, import_canvas10.bindVariables)({
|
|
6784
6794
|
value: selectedValue,
|
|
6785
6795
|
variables: flatVariables,
|
|
6786
6796
|
errorPrefix: "Dynamic input"
|
|
@@ -6947,7 +6957,8 @@ var ButtonStyles = import_react71.css`
|
|
|
6947
6957
|
font-size: var(--fs-sm);
|
|
6948
6958
|
line-height: 1;
|
|
6949
6959
|
gap: var(--spacing-xs);
|
|
6950
|
-
transition:
|
|
6960
|
+
transition:
|
|
6961
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
6951
6962
|
background-color var(--duration-fast) var(--timing-ease-out);
|
|
6952
6963
|
|
|
6953
6964
|
&:hover {
|
|
@@ -7463,371 +7474,445 @@ var JsonMeshVariableEditor = ({
|
|
|
7463
7474
|
var NUMBER_OPERATORS = [
|
|
7464
7475
|
{
|
|
7465
7476
|
label: "equals...",
|
|
7466
|
-
symbol: "=",
|
|
7467
7477
|
value: "eq",
|
|
7468
|
-
editorType: "number"
|
|
7478
|
+
editorType: "number",
|
|
7479
|
+
expectedValueType: "single"
|
|
7469
7480
|
},
|
|
7470
7481
|
{
|
|
7471
7482
|
label: "does not equal...",
|
|
7472
|
-
symbol: "\u2260",
|
|
7473
7483
|
value: "neq",
|
|
7474
|
-
editorType: "number"
|
|
7484
|
+
editorType: "number",
|
|
7485
|
+
expectedValueType: "single"
|
|
7475
7486
|
},
|
|
7476
7487
|
{
|
|
7477
7488
|
label: "greater than...",
|
|
7478
|
-
symbol: ">",
|
|
7479
7489
|
value: "gt",
|
|
7480
|
-
editorType: "number"
|
|
7490
|
+
editorType: "number",
|
|
7491
|
+
expectedValueType: "single"
|
|
7481
7492
|
},
|
|
7482
7493
|
{
|
|
7483
7494
|
label: "greater than or equal to...",
|
|
7484
|
-
symbol: "\u2265",
|
|
7485
7495
|
value: "gte",
|
|
7486
|
-
editorType: "number"
|
|
7496
|
+
editorType: "number",
|
|
7497
|
+
expectedValueType: "single"
|
|
7487
7498
|
},
|
|
7488
7499
|
{
|
|
7489
7500
|
label: "less than...",
|
|
7490
|
-
symbol: "<",
|
|
7491
7501
|
value: "lt",
|
|
7492
|
-
editorType: "number"
|
|
7502
|
+
editorType: "number",
|
|
7503
|
+
expectedValueType: "single"
|
|
7493
7504
|
},
|
|
7494
7505
|
{
|
|
7495
7506
|
label: "less than or equal to...",
|
|
7496
|
-
symbol: "\u2264",
|
|
7497
7507
|
value: "lte",
|
|
7498
|
-
editorType: "number"
|
|
7508
|
+
editorType: "number",
|
|
7509
|
+
expectedValueType: "single"
|
|
7499
7510
|
},
|
|
7500
7511
|
{
|
|
7501
7512
|
label: "is empty",
|
|
7502
7513
|
value: "ndef",
|
|
7503
|
-
editorType: "empty"
|
|
7514
|
+
editorType: "empty",
|
|
7515
|
+
expectedValueType: "false"
|
|
7504
7516
|
},
|
|
7505
7517
|
{
|
|
7506
7518
|
label: "is between...",
|
|
7507
7519
|
value: "between",
|
|
7508
|
-
editorType: "numberRange"
|
|
7520
|
+
editorType: "numberRange",
|
|
7521
|
+
expectedValueType: "between"
|
|
7509
7522
|
},
|
|
7510
7523
|
{
|
|
7511
7524
|
label: "is not empty",
|
|
7512
7525
|
value: "def",
|
|
7513
|
-
editorType: "empty"
|
|
7526
|
+
editorType: "empty",
|
|
7527
|
+
expectedValueType: "true"
|
|
7514
7528
|
}
|
|
7515
7529
|
];
|
|
7516
7530
|
var DATE_OPERATORS = [
|
|
7517
7531
|
{
|
|
7518
7532
|
label: "is",
|
|
7519
7533
|
value: "eq",
|
|
7520
|
-
editorType: "date"
|
|
7534
|
+
editorType: "date",
|
|
7535
|
+
expectedValueType: "single"
|
|
7521
7536
|
},
|
|
7522
7537
|
{
|
|
7523
7538
|
label: "is between...",
|
|
7524
7539
|
value: "between",
|
|
7525
|
-
editorType: "dateRange"
|
|
7540
|
+
editorType: "dateRange",
|
|
7541
|
+
expectedValueType: "between"
|
|
7526
7542
|
},
|
|
7527
7543
|
{
|
|
7528
7544
|
label: "is before...",
|
|
7529
7545
|
value: "lt",
|
|
7530
|
-
editorType: "date"
|
|
7546
|
+
editorType: "date",
|
|
7547
|
+
expectedValueType: "single"
|
|
7531
7548
|
},
|
|
7532
7549
|
{
|
|
7533
7550
|
label: "is after...",
|
|
7534
7551
|
value: "gt",
|
|
7535
|
-
editorType: "date"
|
|
7552
|
+
editorType: "date",
|
|
7553
|
+
expectedValueType: "single"
|
|
7536
7554
|
},
|
|
7537
7555
|
{
|
|
7538
7556
|
label: "is on or before...",
|
|
7539
7557
|
value: "lte",
|
|
7540
|
-
editorType: "date"
|
|
7558
|
+
editorType: "date",
|
|
7559
|
+
expectedValueType: "single"
|
|
7541
7560
|
},
|
|
7542
7561
|
{
|
|
7543
7562
|
label: "is on or after...",
|
|
7544
7563
|
value: "gte",
|
|
7545
|
-
editorType: "date"
|
|
7564
|
+
editorType: "date",
|
|
7565
|
+
expectedValueType: "single"
|
|
7546
7566
|
},
|
|
7547
7567
|
{
|
|
7548
7568
|
label: "is empty",
|
|
7549
7569
|
value: "ndef",
|
|
7550
|
-
editorType: "empty"
|
|
7570
|
+
editorType: "empty",
|
|
7571
|
+
expectedValueType: "false"
|
|
7551
7572
|
},
|
|
7552
7573
|
{
|
|
7553
7574
|
label: "is not",
|
|
7554
7575
|
value: "neq",
|
|
7555
|
-
editorType: "date"
|
|
7576
|
+
editorType: "date",
|
|
7577
|
+
expectedValueType: "single"
|
|
7556
7578
|
},
|
|
7557
7579
|
{
|
|
7558
7580
|
label: "is not empty",
|
|
7559
7581
|
value: "def",
|
|
7560
|
-
editorType: "empty"
|
|
7582
|
+
editorType: "empty",
|
|
7583
|
+
expectedValueType: "true"
|
|
7561
7584
|
}
|
|
7562
7585
|
];
|
|
7563
7586
|
var TEXTBOX_OPERATORS = [
|
|
7564
7587
|
{
|
|
7565
7588
|
label: "contains...",
|
|
7566
7589
|
value: "match",
|
|
7567
|
-
editorType: "text"
|
|
7590
|
+
editorType: "text",
|
|
7591
|
+
expectedValueType: "single"
|
|
7568
7592
|
},
|
|
7569
7593
|
{
|
|
7570
7594
|
label: "is",
|
|
7571
7595
|
value: "eq",
|
|
7572
|
-
editorType: "text"
|
|
7596
|
+
editorType: "text",
|
|
7597
|
+
expectedValueType: "single"
|
|
7573
7598
|
},
|
|
7574
7599
|
{
|
|
7575
7600
|
label: "is empty",
|
|
7576
7601
|
value: "ndef",
|
|
7577
|
-
editorType: "empty"
|
|
7602
|
+
editorType: "empty",
|
|
7603
|
+
expectedValueType: "false"
|
|
7578
7604
|
},
|
|
7579
7605
|
{
|
|
7580
7606
|
label: "starts with...",
|
|
7581
7607
|
value: "starts",
|
|
7582
|
-
editorType: "text"
|
|
7608
|
+
editorType: "text",
|
|
7609
|
+
expectedValueType: "single"
|
|
7583
7610
|
},
|
|
7584
7611
|
{
|
|
7585
7612
|
label: "is not",
|
|
7586
7613
|
value: "neq",
|
|
7587
|
-
editorType: "text"
|
|
7614
|
+
editorType: "text",
|
|
7615
|
+
expectedValueType: "single"
|
|
7588
7616
|
},
|
|
7589
7617
|
{
|
|
7590
7618
|
label: "is not empty",
|
|
7591
7619
|
value: "def",
|
|
7592
|
-
editorType: "empty"
|
|
7620
|
+
editorType: "empty",
|
|
7621
|
+
expectedValueType: "true"
|
|
7593
7622
|
}
|
|
7594
7623
|
];
|
|
7595
7624
|
var USER_OPERATORS = [
|
|
7596
7625
|
{
|
|
7597
7626
|
label: "contains...",
|
|
7598
7627
|
value: "match",
|
|
7599
|
-
editorType: "text"
|
|
7628
|
+
editorType: "text",
|
|
7629
|
+
expectedValueType: "single"
|
|
7600
7630
|
},
|
|
7601
7631
|
{
|
|
7602
7632
|
label: "is",
|
|
7603
7633
|
value: "eq",
|
|
7604
|
-
editorType: "text"
|
|
7634
|
+
editorType: "text",
|
|
7635
|
+
expectedValueType: "single"
|
|
7605
7636
|
},
|
|
7606
7637
|
{
|
|
7607
7638
|
label: "starts with...",
|
|
7608
7639
|
value: "starts",
|
|
7609
|
-
editorType: "text"
|
|
7640
|
+
editorType: "text",
|
|
7641
|
+
expectedValueType: "single"
|
|
7610
7642
|
},
|
|
7611
7643
|
{
|
|
7612
7644
|
label: "is not",
|
|
7613
7645
|
value: "neq",
|
|
7614
|
-
editorType: "text"
|
|
7646
|
+
editorType: "text",
|
|
7647
|
+
expectedValueType: "single"
|
|
7615
7648
|
}
|
|
7616
7649
|
];
|
|
7617
|
-
var
|
|
7650
|
+
var DATE_TIME_OPERATORS = [
|
|
7618
7651
|
{
|
|
7619
7652
|
label: "is",
|
|
7620
7653
|
value: "sys-date-eq",
|
|
7621
|
-
editorType: "date"
|
|
7654
|
+
editorType: "date",
|
|
7655
|
+
expectedValueType: "single"
|
|
7622
7656
|
},
|
|
7623
7657
|
{
|
|
7624
7658
|
label: "is between...",
|
|
7625
7659
|
value: "sys-date-between",
|
|
7626
|
-
editorType: "dateRange"
|
|
7660
|
+
editorType: "dateRange",
|
|
7661
|
+
expectedValueType: "between"
|
|
7627
7662
|
},
|
|
7628
7663
|
{
|
|
7629
7664
|
label: "is before...",
|
|
7630
7665
|
value: "sys-date-lt",
|
|
7631
|
-
editorType: "date"
|
|
7666
|
+
editorType: "date",
|
|
7667
|
+
expectedValueType: "single"
|
|
7632
7668
|
},
|
|
7633
7669
|
{
|
|
7634
7670
|
label: "is after...",
|
|
7635
7671
|
value: "sys-date-gt",
|
|
7636
|
-
editorType: "date"
|
|
7672
|
+
editorType: "date",
|
|
7673
|
+
expectedValueType: "single"
|
|
7637
7674
|
},
|
|
7638
7675
|
{
|
|
7639
7676
|
label: "is on or before...",
|
|
7640
7677
|
value: "sys-date-lte",
|
|
7641
|
-
editorType: "date"
|
|
7678
|
+
editorType: "date",
|
|
7679
|
+
expectedValueType: "single"
|
|
7642
7680
|
},
|
|
7643
7681
|
{
|
|
7644
7682
|
label: "is on or after...",
|
|
7645
7683
|
value: "sys-date-gte",
|
|
7646
|
-
editorType: "date"
|
|
7684
|
+
editorType: "date",
|
|
7685
|
+
expectedValueType: "single"
|
|
7686
|
+
},
|
|
7687
|
+
{
|
|
7688
|
+
label: "is empty",
|
|
7689
|
+
value: "ndef",
|
|
7690
|
+
editorType: "empty",
|
|
7691
|
+
expectedValueType: "false"
|
|
7692
|
+
},
|
|
7693
|
+
{
|
|
7694
|
+
label: "is not empty",
|
|
7695
|
+
value: "def",
|
|
7696
|
+
editorType: "empty",
|
|
7697
|
+
expectedValueType: "true"
|
|
7647
7698
|
}
|
|
7648
7699
|
];
|
|
7649
7700
|
var RICHTEXT_OPERATORS = [
|
|
7650
7701
|
{
|
|
7651
7702
|
label: "contains...",
|
|
7652
7703
|
value: "match",
|
|
7653
|
-
editorType: "text"
|
|
7704
|
+
editorType: "text",
|
|
7705
|
+
expectedValueType: "single"
|
|
7654
7706
|
},
|
|
7655
7707
|
{
|
|
7656
7708
|
label: "is empty",
|
|
7657
7709
|
value: "ndef",
|
|
7658
|
-
editorType: "empty"
|
|
7710
|
+
editorType: "empty",
|
|
7711
|
+
expectedValueType: "false"
|
|
7659
7712
|
},
|
|
7660
7713
|
{
|
|
7661
7714
|
label: "starts with...",
|
|
7662
7715
|
value: "starts",
|
|
7663
|
-
editorType: "text"
|
|
7716
|
+
editorType: "text",
|
|
7717
|
+
expectedValueType: "single"
|
|
7664
7718
|
},
|
|
7665
7719
|
{
|
|
7666
7720
|
label: "is not empty",
|
|
7667
7721
|
value: "def",
|
|
7668
|
-
editorType: "empty"
|
|
7722
|
+
editorType: "empty",
|
|
7723
|
+
expectedValueType: "true"
|
|
7669
7724
|
}
|
|
7670
7725
|
];
|
|
7671
7726
|
var CHECKBOX_OPERATORS = [
|
|
7672
7727
|
{
|
|
7673
7728
|
label: "is checked",
|
|
7674
7729
|
value: "def",
|
|
7675
|
-
editorType: "empty"
|
|
7730
|
+
editorType: "empty",
|
|
7731
|
+
expectedValueType: "true"
|
|
7676
7732
|
},
|
|
7677
7733
|
{
|
|
7678
7734
|
label: "is not checked",
|
|
7679
7735
|
value: "ndef",
|
|
7680
|
-
editorType: "empty"
|
|
7736
|
+
editorType: "empty",
|
|
7737
|
+
expectedValueType: "false"
|
|
7681
7738
|
}
|
|
7682
7739
|
];
|
|
7683
7740
|
var SYSTEM_FIELD_OPERATORS = [
|
|
7684
7741
|
{
|
|
7685
7742
|
label: "is",
|
|
7686
7743
|
value: "eq",
|
|
7687
|
-
editorType: "singleChoice"
|
|
7744
|
+
editorType: "singleChoice",
|
|
7745
|
+
expectedValueType: "single"
|
|
7688
7746
|
},
|
|
7689
7747
|
{
|
|
7690
7748
|
label: "is any of...",
|
|
7691
7749
|
value: "in",
|
|
7692
|
-
editorType: "multiChoice"
|
|
7750
|
+
editorType: "multiChoice",
|
|
7751
|
+
expectedValueType: "array"
|
|
7693
7752
|
},
|
|
7694
7753
|
{
|
|
7695
7754
|
label: "is not",
|
|
7696
7755
|
value: "neq",
|
|
7697
|
-
editorType: "singleChoice"
|
|
7756
|
+
editorType: "singleChoice",
|
|
7757
|
+
expectedValueType: "single"
|
|
7698
7758
|
},
|
|
7699
7759
|
{
|
|
7700
7760
|
label: "is none of...",
|
|
7701
7761
|
value: "nin",
|
|
7702
|
-
editorType: "multiChoice"
|
|
7762
|
+
editorType: "multiChoice",
|
|
7763
|
+
expectedValueType: "array"
|
|
7703
7764
|
}
|
|
7704
7765
|
];
|
|
7705
7766
|
var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
|
|
7706
7767
|
{
|
|
7707
7768
|
label: "is",
|
|
7708
7769
|
value: "eq",
|
|
7709
|
-
editorType: "singleChoice"
|
|
7770
|
+
editorType: "singleChoice",
|
|
7771
|
+
expectedValueType: "single"
|
|
7710
7772
|
},
|
|
7711
7773
|
{
|
|
7712
7774
|
label: "is any of...",
|
|
7713
7775
|
value: "in",
|
|
7714
|
-
editorType: "multiChoice"
|
|
7776
|
+
editorType: "multiChoice",
|
|
7777
|
+
expectedValueType: "array"
|
|
7715
7778
|
},
|
|
7716
7779
|
{
|
|
7717
7780
|
label: "is empty",
|
|
7718
7781
|
value: "ndef",
|
|
7719
|
-
editorType: "empty"
|
|
7782
|
+
editorType: "empty",
|
|
7783
|
+
expectedValueType: "false"
|
|
7720
7784
|
},
|
|
7721
7785
|
{
|
|
7722
7786
|
label: "is not",
|
|
7723
7787
|
value: "neq",
|
|
7724
|
-
editorType: "singleChoice"
|
|
7788
|
+
editorType: "singleChoice",
|
|
7789
|
+
expectedValueType: "single"
|
|
7725
7790
|
},
|
|
7726
7791
|
{
|
|
7727
7792
|
label: "is none of...",
|
|
7728
7793
|
value: "nin",
|
|
7729
|
-
editorType: "multiChoice"
|
|
7794
|
+
editorType: "multiChoice",
|
|
7795
|
+
expectedValueType: "array"
|
|
7730
7796
|
},
|
|
7731
7797
|
{
|
|
7732
7798
|
label: "is not empty",
|
|
7733
7799
|
value: "def",
|
|
7734
|
-
editorType: "empty"
|
|
7800
|
+
editorType: "empty",
|
|
7801
|
+
expectedValueType: "true"
|
|
7735
7802
|
}
|
|
7736
7803
|
];
|
|
7737
7804
|
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
7738
7805
|
{
|
|
7739
7806
|
label: "is",
|
|
7740
7807
|
value: "eq",
|
|
7741
|
-
editorType: "statusSingleChoice"
|
|
7808
|
+
editorType: "statusSingleChoice",
|
|
7809
|
+
expectedValueType: "single"
|
|
7742
7810
|
},
|
|
7743
7811
|
{
|
|
7744
7812
|
label: "is any of...",
|
|
7745
7813
|
value: "in",
|
|
7746
|
-
editorType: "statusMultiChoice"
|
|
7814
|
+
editorType: "statusMultiChoice",
|
|
7815
|
+
expectedValueType: "array"
|
|
7747
7816
|
},
|
|
7748
7817
|
{
|
|
7749
7818
|
label: "is not",
|
|
7750
7819
|
value: "neq",
|
|
7751
|
-
editorType: "statusSingleChoice"
|
|
7820
|
+
editorType: "statusSingleChoice",
|
|
7821
|
+
expectedValueType: "single"
|
|
7752
7822
|
},
|
|
7753
7823
|
{
|
|
7754
7824
|
label: "is none of...",
|
|
7755
7825
|
value: "nin",
|
|
7756
|
-
editorType: "statusMultiChoice"
|
|
7826
|
+
editorType: "statusMultiChoice",
|
|
7827
|
+
expectedValueType: "array"
|
|
7757
7828
|
}
|
|
7758
7829
|
];
|
|
7759
7830
|
var SELECT_OPERATORS = [
|
|
7760
7831
|
{
|
|
7761
7832
|
label: "is",
|
|
7762
7833
|
value: "eq",
|
|
7763
|
-
editorType: "singleChoice"
|
|
7834
|
+
editorType: "singleChoice",
|
|
7835
|
+
expectedValueType: "single"
|
|
7764
7836
|
},
|
|
7765
7837
|
{
|
|
7766
7838
|
label: "is any of...",
|
|
7767
7839
|
value: "in",
|
|
7768
|
-
editorType: "multiChoice"
|
|
7840
|
+
editorType: "multiChoice",
|
|
7841
|
+
expectedValueType: "array"
|
|
7769
7842
|
},
|
|
7770
7843
|
{
|
|
7771
7844
|
label: "is empty",
|
|
7772
7845
|
value: "ndef",
|
|
7773
|
-
editorType: "empty"
|
|
7846
|
+
editorType: "empty",
|
|
7847
|
+
expectedValueType: "false"
|
|
7774
7848
|
},
|
|
7775
7849
|
{
|
|
7776
7850
|
label: "contains...",
|
|
7777
7851
|
value: "match",
|
|
7778
|
-
editorType: "text"
|
|
7852
|
+
editorType: "text",
|
|
7853
|
+
expectedValueType: "single"
|
|
7779
7854
|
},
|
|
7780
7855
|
{
|
|
7781
7856
|
label: "starts with...",
|
|
7782
7857
|
value: "starts",
|
|
7783
|
-
editorType: "text"
|
|
7858
|
+
editorType: "text",
|
|
7859
|
+
expectedValueType: "single"
|
|
7784
7860
|
},
|
|
7785
7861
|
{
|
|
7786
7862
|
label: "is not",
|
|
7787
7863
|
value: "neq",
|
|
7788
|
-
editorType: "singleChoice"
|
|
7864
|
+
editorType: "singleChoice",
|
|
7865
|
+
expectedValueType: "single"
|
|
7789
7866
|
},
|
|
7790
7867
|
{
|
|
7791
7868
|
label: "is none of...",
|
|
7792
7869
|
value: "nin",
|
|
7793
|
-
editorType: "multiChoice"
|
|
7870
|
+
editorType: "multiChoice",
|
|
7871
|
+
expectedValueType: "array"
|
|
7794
7872
|
},
|
|
7795
7873
|
{
|
|
7796
7874
|
label: "is not empty",
|
|
7797
7875
|
value: "def",
|
|
7798
|
-
editorType: "empty"
|
|
7876
|
+
editorType: "empty",
|
|
7877
|
+
expectedValueType: "true"
|
|
7799
7878
|
}
|
|
7800
7879
|
];
|
|
7801
7880
|
var MULTI_SELECT_OPERATORS = [
|
|
7802
7881
|
{
|
|
7803
7882
|
label: "is",
|
|
7804
7883
|
value: "eq",
|
|
7805
|
-
editorType: "singleChoice"
|
|
7884
|
+
editorType: "singleChoice",
|
|
7885
|
+
expectedValueType: "single"
|
|
7806
7886
|
},
|
|
7807
7887
|
{
|
|
7808
7888
|
label: "is any of...",
|
|
7809
7889
|
value: "in",
|
|
7810
|
-
editorType: "multiChoice"
|
|
7890
|
+
editorType: "multiChoice",
|
|
7891
|
+
expectedValueType: "array"
|
|
7811
7892
|
},
|
|
7812
7893
|
{
|
|
7813
7894
|
label: "is empty",
|
|
7814
7895
|
value: "ndef",
|
|
7815
|
-
editorType: "empty"
|
|
7896
|
+
editorType: "empty",
|
|
7897
|
+
expectedValueType: "false"
|
|
7816
7898
|
},
|
|
7817
7899
|
{
|
|
7818
7900
|
label: "is not",
|
|
7819
7901
|
value: "neq",
|
|
7820
|
-
editorType: "singleChoice"
|
|
7902
|
+
editorType: "singleChoice",
|
|
7903
|
+
expectedValueType: "single"
|
|
7821
7904
|
},
|
|
7822
7905
|
{
|
|
7823
7906
|
label: "is none of...",
|
|
7824
7907
|
value: "nin",
|
|
7825
|
-
editorType: "multiChoice"
|
|
7908
|
+
editorType: "multiChoice",
|
|
7909
|
+
expectedValueType: "array"
|
|
7826
7910
|
},
|
|
7827
7911
|
{
|
|
7828
7912
|
label: "is not empty",
|
|
7829
7913
|
value: "def",
|
|
7830
|
-
editorType: "empty"
|
|
7914
|
+
editorType: "empty",
|
|
7915
|
+
expectedValueType: "true"
|
|
7831
7916
|
}
|
|
7832
7917
|
];
|
|
7833
7918
|
|
|
@@ -8459,7 +8544,7 @@ var ConditionalInputRow = import_react86.css`
|
|
|
8459
8544
|
${(0, import_design_system53.cq)("764px")} {
|
|
8460
8545
|
align-items: flex-start;
|
|
8461
8546
|
display: grid;
|
|
8462
|
-
grid-template-columns:
|
|
8547
|
+
grid-template-columns: 250px 160px 1fr 32px;
|
|
8463
8548
|
|
|
8464
8549
|
& > div:nth-child(n) {
|
|
8465
8550
|
width: auto;
|
|
@@ -8508,7 +8593,8 @@ var FilterButton = import_react86.css`
|
|
|
8508
8593
|
gap: var(--spacing-sm);
|
|
8509
8594
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
8510
8595
|
max-height: 40px;
|
|
8511
|
-
transition:
|
|
8596
|
+
transition:
|
|
8597
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
8512
8598
|
background-color var(--duration-fast) var(--timing-ease-out),
|
|
8513
8599
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
8514
8600
|
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
@@ -8603,6 +8689,9 @@ var ResetConditionsBtn = import_react86.css`
|
|
|
8603
8689
|
&:focus {
|
|
8604
8690
|
color: var(--action-destructive-hover);
|
|
8605
8691
|
}
|
|
8692
|
+
&:disabled {
|
|
8693
|
+
color: var(--gray-400);
|
|
8694
|
+
}
|
|
8606
8695
|
`;
|
|
8607
8696
|
var IconBtn = import_react86.css`
|
|
8608
8697
|
align-self: center;
|
|
@@ -8666,6 +8755,7 @@ var FilterButton2 = ({
|
|
|
8666
8755
|
|
|
8667
8756
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8668
8757
|
var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
|
|
8758
|
+
var import_canvas11 = require("@uniformdev/canvas");
|
|
8669
8759
|
var import_design_system56 = require("@uniformdev/design-system");
|
|
8670
8760
|
var import_lexical11 = require("lexical");
|
|
8671
8761
|
var import_react88 = require("react");
|
|
@@ -8699,7 +8789,7 @@ var filterMapper = {
|
|
|
8699
8789
|
statusSingleChoice: StatusSingleEditor,
|
|
8700
8790
|
empty: null
|
|
8701
8791
|
};
|
|
8702
|
-
function withInputVariables(WrappedComponent) {
|
|
8792
|
+
function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
8703
8793
|
const WithInputVariables = (props) => {
|
|
8704
8794
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8705
8795
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props });
|
|
@@ -8712,7 +8802,7 @@ function withInputVariables(WrappedComponent) {
|
|
|
8712
8802
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8713
8803
|
value: props.value,
|
|
8714
8804
|
disabled: props.disabled,
|
|
8715
|
-
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props })
|
|
8805
|
+
inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props })
|
|
8716
8806
|
}
|
|
8717
8807
|
);
|
|
8718
8808
|
};
|
|
@@ -8742,7 +8832,7 @@ var bindableFiltersMapper = {
|
|
|
8742
8832
|
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8743
8833
|
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8744
8834
|
date: withInputVariables(DateEditor),
|
|
8745
|
-
text: withInputVariables(TextEditor),
|
|
8835
|
+
text: withInputVariables(TextEditor, true),
|
|
8746
8836
|
number: withInputVariables(NumberEditor)
|
|
8747
8837
|
};
|
|
8748
8838
|
|
|
@@ -8774,6 +8864,7 @@ var SearchAndFilterProvider = ({
|
|
|
8774
8864
|
filters,
|
|
8775
8865
|
filterOptions,
|
|
8776
8866
|
filterVisible = false,
|
|
8867
|
+
alwaysVisible = false,
|
|
8777
8868
|
defaultSearchTerm = "",
|
|
8778
8869
|
onSearchChange,
|
|
8779
8870
|
onChange,
|
|
@@ -8785,7 +8876,7 @@ var SearchAndFilterProvider = ({
|
|
|
8785
8876
|
}) => {
|
|
8786
8877
|
const [searchTerm, setSearchTerm] = (0, import_react87.useState)(defaultSearchTerm);
|
|
8787
8878
|
const deferredSearchTerm = (0, import_react87.useDeferredValue)(searchTerm);
|
|
8788
|
-
const [filterVisibility, setFilterVisibility] = (0, import_react87.useState)(filterVisible);
|
|
8879
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react87.useState)(alwaysVisible || filterVisible);
|
|
8789
8880
|
const handleSearchTerm = (0, import_react87.useCallback)(
|
|
8790
8881
|
(term) => {
|
|
8791
8882
|
setSearchTerm(term);
|
|
@@ -8794,8 +8885,13 @@ var SearchAndFilterProvider = ({
|
|
|
8794
8885
|
[setSearchTerm, onSearchChange]
|
|
8795
8886
|
);
|
|
8796
8887
|
const handleToggleFilterVisibility = (0, import_react87.useCallback)(
|
|
8797
|
-
(visible) =>
|
|
8798
|
-
|
|
8888
|
+
(visible) => {
|
|
8889
|
+
if (alwaysVisible) {
|
|
8890
|
+
return;
|
|
8891
|
+
}
|
|
8892
|
+
setFilterVisibility(visible);
|
|
8893
|
+
},
|
|
8894
|
+
[alwaysVisible]
|
|
8799
8895
|
);
|
|
8800
8896
|
const handleAddFilter = (0, import_react87.useCallback)(() => {
|
|
8801
8897
|
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
@@ -8821,7 +8917,7 @@ var SearchAndFilterProvider = ({
|
|
|
8821
8917
|
if (filterVisibility) {
|
|
8822
8918
|
const handleEscKeyFilterClose = (e) => {
|
|
8823
8919
|
if (e.key === "Escape") {
|
|
8824
|
-
|
|
8920
|
+
handleToggleFilterVisibility(false);
|
|
8825
8921
|
}
|
|
8826
8922
|
};
|
|
8827
8923
|
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
@@ -8829,7 +8925,7 @@ var SearchAndFilterProvider = ({
|
|
|
8829
8925
|
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8830
8926
|
};
|
|
8831
8927
|
}
|
|
8832
|
-
}, [filterVisibility]);
|
|
8928
|
+
}, [filterVisibility, handleToggleFilterVisibility]);
|
|
8833
8929
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
8834
8930
|
SearchAndFilterContext.Provider,
|
|
8835
8931
|
{
|
|
@@ -8873,7 +8969,7 @@ var FilterControls = ({
|
|
|
8873
8969
|
allowBindingSearchTerm
|
|
8874
8970
|
} = useSearchAndFilter();
|
|
8875
8971
|
const editorRef = (0, import_react88.useRef)(null);
|
|
8876
|
-
const
|
|
8972
|
+
const variableRefernceCountInSearchTerm = (0, import_canvas11.hasReferencedVariables)(searchTerm);
|
|
8877
8973
|
const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react88.useState)("data-resource-search-term-input");
|
|
8878
8974
|
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react88.useState)(searchTerm);
|
|
8879
8975
|
(0, import_react_use10.useDebounce)(
|
|
@@ -8927,7 +9023,7 @@ var FilterControls = ({
|
|
|
8927
9023
|
)
|
|
8928
9024
|
}
|
|
8929
9025
|
),
|
|
8930
|
-
|
|
9026
|
+
variableRefernceCountInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
8931
9027
|
"button",
|
|
8932
9028
|
{
|
|
8933
9029
|
css: ClearSearchButtonStyles,
|
|
@@ -8950,89 +9046,27 @@ var FilterControls = ({
|
|
|
8950
9046
|
};
|
|
8951
9047
|
|
|
8952
9048
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8953
|
-
var import_design_system58 = require("@uniformdev/design-system");
|
|
8954
|
-
var import_react90 = require("react");
|
|
8955
|
-
|
|
8956
|
-
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8957
9049
|
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
|
-
};
|
|
9050
|
+
var import_react89 = require("react");
|
|
9051
|
+
|
|
9052
|
+
// src/components/SearchAndFilter/util/isFilterBindable.ts
|
|
9053
|
+
function isFilterBindable(filter, operator) {
|
|
9054
|
+
var _a, _b;
|
|
9055
|
+
return (_b = (_a = operator == null ? void 0 : operator.bindable) != null ? _a : filter == null ? void 0 : filter.bindable) != null ? _b : false;
|
|
9056
|
+
}
|
|
9024
9057
|
|
|
9025
9058
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
9026
|
-
var
|
|
9059
|
+
var import_jsx_runtime85 = require("@emotion/react/jsx-runtime");
|
|
9027
9060
|
var FilterItem = ({
|
|
9028
9061
|
index,
|
|
9029
|
-
paramOptions,
|
|
9030
9062
|
operatorOptions,
|
|
9031
9063
|
valueOptions,
|
|
9032
|
-
|
|
9064
|
+
onFilterOptionChange,
|
|
9065
|
+
onFilterDynamicChange,
|
|
9033
9066
|
onOperatorChange,
|
|
9034
9067
|
onValueChange,
|
|
9035
|
-
initialCriteriaTitle = "Where"
|
|
9068
|
+
initialCriteriaTitle = "Where",
|
|
9069
|
+
criteriaGroupOperator = "and"
|
|
9036
9070
|
}) => {
|
|
9037
9071
|
var _a, _b;
|
|
9038
9072
|
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
@@ -9040,25 +9074,26 @@ var FilterItem = ({
|
|
|
9040
9074
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
9041
9075
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
9042
9076
|
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,
|
|
9077
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react89.useMemo)(() => {
|
|
9044
9078
|
var _a2;
|
|
9045
|
-
const
|
|
9079
|
+
const currentSelectedFilterGroup = filterOptions.find((item) => {
|
|
9046
9080
|
var _a3;
|
|
9047
9081
|
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
9048
9082
|
});
|
|
9049
|
-
const
|
|
9083
|
+
const selectedFilterOption = (_a2 = currentSelectedFilterGroup == null ? void 0 : currentSelectedFilterGroup.options) == null ? void 0 : _a2.find((item) => {
|
|
9050
9084
|
return filters[index].field === item.value;
|
|
9051
9085
|
});
|
|
9052
|
-
const isCurrentFieldReadOnly =
|
|
9086
|
+
const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
|
|
9053
9087
|
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
9054
9088
|
return filters[index].operator === item.value;
|
|
9055
9089
|
});
|
|
9090
|
+
const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
|
|
9056
9091
|
return {
|
|
9057
|
-
selectedFieldValue:
|
|
9092
|
+
selectedFieldValue: selectedFilterOption,
|
|
9058
9093
|
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
9059
9094
|
selectedMetaValue: filters[index].value,
|
|
9060
9095
|
readOnly: isCurrentFieldReadOnly,
|
|
9061
|
-
bindable:
|
|
9096
|
+
bindable: bindable2
|
|
9062
9097
|
};
|
|
9063
9098
|
}, [filters, filterOptions, index, operatorOptions]);
|
|
9064
9099
|
const readOnlyProps = readOnly ? {
|
|
@@ -9067,17 +9102,28 @@ var FilterItem = ({
|
|
|
9067
9102
|
menuIsOpen: false,
|
|
9068
9103
|
isClearable: false
|
|
9069
9104
|
} : {};
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
/* @__PURE__ */ (0,
|
|
9073
|
-
|
|
9074
|
-
|
|
9105
|
+
const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
|
|
9106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
9107
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
|
|
9108
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: ConditionalInputRow, children: [
|
|
9109
|
+
CustomLeftHandComponent ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9110
|
+
CustomLeftHandComponent,
|
|
9111
|
+
{
|
|
9112
|
+
filterOption: selectedFieldValue,
|
|
9113
|
+
filter: filters[index],
|
|
9114
|
+
setFilterDynamicValue: onFilterDynamicChange,
|
|
9115
|
+
deselectFilterOption: () => {
|
|
9116
|
+
onFilterOptionChange("");
|
|
9117
|
+
}
|
|
9118
|
+
}
|
|
9119
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9120
|
+
import_design_system57.InputComboBox,
|
|
9075
9121
|
{
|
|
9076
9122
|
"aria-label": label,
|
|
9077
|
-
options:
|
|
9123
|
+
options: filterOptions,
|
|
9078
9124
|
onChange: (e) => {
|
|
9079
9125
|
var _a2;
|
|
9080
|
-
|
|
9126
|
+
onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
9081
9127
|
},
|
|
9082
9128
|
isOptionDisabled: (option) => {
|
|
9083
9129
|
var _a2;
|
|
@@ -9097,8 +9143,8 @@ var FilterItem = ({
|
|
|
9097
9143
|
name: `filter-field-${index}`
|
|
9098
9144
|
}
|
|
9099
9145
|
),
|
|
9100
|
-
/* @__PURE__ */ (0,
|
|
9101
|
-
|
|
9146
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9147
|
+
import_design_system57.InputComboBox,
|
|
9102
9148
|
{
|
|
9103
9149
|
"aria-label": operatorLabel,
|
|
9104
9150
|
options: operatorOptions,
|
|
@@ -9121,7 +9167,7 @@ var FilterItem = ({
|
|
|
9121
9167
|
name: `filter-operator-${index}`
|
|
9122
9168
|
}
|
|
9123
9169
|
),
|
|
9124
|
-
/* @__PURE__ */ (0,
|
|
9170
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9125
9171
|
FilterEditorRenderer,
|
|
9126
9172
|
{
|
|
9127
9173
|
"aria-label": metaDataLabel,
|
|
@@ -9135,7 +9181,7 @@ var FilterItem = ({
|
|
|
9135
9181
|
valueTestId: "filter-value"
|
|
9136
9182
|
}
|
|
9137
9183
|
),
|
|
9138
|
-
readOnly ? null : /* @__PURE__ */ (0,
|
|
9184
|
+
readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9139
9185
|
"button",
|
|
9140
9186
|
{
|
|
9141
9187
|
type: "button",
|
|
@@ -9144,35 +9190,184 @@ var FilterItem = ({
|
|
|
9144
9190
|
css: IconBtn,
|
|
9145
9191
|
"data-testid": "delete-filter",
|
|
9146
9192
|
disabled: filters.length === 1,
|
|
9147
|
-
children: /* @__PURE__ */ (0,
|
|
9193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_design_system57.Icon, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
|
|
9148
9194
|
}
|
|
9149
9195
|
)
|
|
9150
9196
|
] })
|
|
9151
9197
|
] });
|
|
9152
9198
|
};
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9199
|
+
|
|
9200
|
+
// src/components/SearchAndFilter/FilterItems.tsx
|
|
9201
|
+
var import_design_system59 = require("@uniformdev/design-system");
|
|
9202
|
+
|
|
9203
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
9204
|
+
var import_design_system58 = require("@uniformdev/design-system");
|
|
9205
|
+
var import_react90 = __toESM(require("react"));
|
|
9206
|
+
var import_jsx_runtime86 = require("@emotion/react/jsx-runtime");
|
|
9207
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
9208
|
+
buttonRow,
|
|
9209
|
+
additionalFiltersContainer,
|
|
9210
|
+
children
|
|
9211
|
+
}) => {
|
|
9212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
9213
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
9214
|
+
buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
9215
|
+
import_design_system58.HorizontalRhythm,
|
|
9216
|
+
{
|
|
9217
|
+
css: SearchAndFilterButtonGroup,
|
|
9218
|
+
gap: "sm",
|
|
9219
|
+
align: "center",
|
|
9220
|
+
justify: "space-between",
|
|
9221
|
+
children: buttonRow
|
|
9222
|
+
}
|
|
9223
|
+
) : null,
|
|
9224
|
+
additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { children: additionalFiltersContainer }) : null
|
|
9225
|
+
] });
|
|
9226
|
+
};
|
|
9227
|
+
var FilterMenu = ({
|
|
9228
|
+
id,
|
|
9229
|
+
filterTitle = "Show results",
|
|
9230
|
+
menuControls,
|
|
9231
|
+
additionalFiltersContainer,
|
|
9232
|
+
children,
|
|
9233
|
+
dataTestId,
|
|
9234
|
+
resetButtonText = "reset"
|
|
9235
|
+
}) => {
|
|
9236
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
9237
|
+
const innerMenuRef = import_react90.default.useRef(null);
|
|
9238
|
+
(0, import_react90.useEffect)(() => {
|
|
9239
|
+
var _a;
|
|
9240
|
+
if (filterVisibility) {
|
|
9241
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
9242
|
+
}
|
|
9243
|
+
}, [filterVisibility]);
|
|
9244
|
+
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)(
|
|
9245
|
+
SearchAndFilterOptionsContainer2,
|
|
9246
|
+
{
|
|
9247
|
+
buttonRow: menuControls,
|
|
9248
|
+
additionalFiltersContainer,
|
|
9249
|
+
children: [
|
|
9250
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_design_system58.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
9251
|
+
filterTitle ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
|
|
9252
|
+
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
9253
|
+
"button",
|
|
9254
|
+
{
|
|
9255
|
+
type: "button",
|
|
9256
|
+
css: ResetConditionsBtn,
|
|
9257
|
+
disabled: filters.every((f) => !f.field),
|
|
9258
|
+
onClick: () => {
|
|
9259
|
+
handleResetFilters();
|
|
9260
|
+
setFilterVisibility(false);
|
|
9261
|
+
},
|
|
9262
|
+
"data-testid": "reset-filters",
|
|
9263
|
+
children: resetButtonText
|
|
9264
|
+
}
|
|
9265
|
+
) : null
|
|
9266
|
+
] }),
|
|
9267
|
+
children
|
|
9268
|
+
]
|
|
9269
|
+
}
|
|
9270
|
+
) : null });
|
|
9271
|
+
};
|
|
9272
|
+
|
|
9273
|
+
// src/components/SearchAndFilter/util/getNewFilterValueAfterOperatorChange.ts
|
|
9274
|
+
var import_canvas12 = require("@uniformdev/canvas");
|
|
9275
|
+
function getNewFilterValueAfterOperatorChange({
|
|
9276
|
+
newOperatorId,
|
|
9277
|
+
currentFilter,
|
|
9278
|
+
filterOptions
|
|
9279
|
+
}) {
|
|
9280
|
+
var _a, _b, _c;
|
|
9281
|
+
if (Array.isArray(newOperatorId)) {
|
|
9282
|
+
throw new Error("Operator value must be a single string");
|
|
9283
|
+
}
|
|
9284
|
+
const result = {
|
|
9285
|
+
...currentFilter,
|
|
9286
|
+
operator: newOperatorId,
|
|
9287
|
+
value: ""
|
|
9288
|
+
};
|
|
9289
|
+
const currentOperatorId = currentFilter.operator;
|
|
9290
|
+
let currentValue = currentFilter.value;
|
|
9291
|
+
const currentFieldDefinition = filterOptions.flatMap((group) => {
|
|
9292
|
+
var _a2;
|
|
9293
|
+
return (_a2 = group.options) != null ? _a2 : [];
|
|
9294
|
+
}).find((filter) => filter.value === currentFilter.field);
|
|
9295
|
+
const currentOperator = (_a = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _a.find(
|
|
9296
|
+
(op) => op.value === currentOperatorId
|
|
9297
|
+
);
|
|
9298
|
+
const newOperator = (_b = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _b.find((op) => op.value === newOperatorId);
|
|
9299
|
+
if (!currentOperator || !newOperator) {
|
|
9300
|
+
result.value = "";
|
|
9301
|
+
return result;
|
|
9302
|
+
} else {
|
|
9303
|
+
const currentOperatorValueType = currentOperator.expectedValueType;
|
|
9304
|
+
const newOperatorValueType = newOperator.expectedValueType;
|
|
9305
|
+
if (!isFilterBindable(currentFieldDefinition, newOperator) && hasBindings(currentValue)) {
|
|
9306
|
+
currentValue = "";
|
|
9307
|
+
}
|
|
9308
|
+
if (isHardcodedOperatorValue(currentOperatorValueType)) {
|
|
9309
|
+
result.value = isHardcodedOperatorValue(newOperatorValueType) ? newOperatorValueType : "";
|
|
9310
|
+
return result;
|
|
9311
|
+
}
|
|
9312
|
+
switch (newOperatorValueType) {
|
|
9313
|
+
case "single":
|
|
9314
|
+
if (Array.isArray(currentValue)) {
|
|
9315
|
+
if (currentOperatorValueType === "between") {
|
|
9316
|
+
result.value = "";
|
|
9317
|
+
} else {
|
|
9318
|
+
result.value = (_c = currentValue[0]) != null ? _c : "";
|
|
9319
|
+
}
|
|
9320
|
+
} else {
|
|
9321
|
+
result.value = currentValue;
|
|
9322
|
+
}
|
|
9323
|
+
return result;
|
|
9324
|
+
case "array":
|
|
9325
|
+
if (currentOperatorValueType === "between") {
|
|
9326
|
+
result.value = "";
|
|
9327
|
+
} else if (Array.isArray(currentValue)) {
|
|
9328
|
+
result.value = currentValue;
|
|
9329
|
+
} else {
|
|
9330
|
+
result.value = currentValue ? [currentValue] : [];
|
|
9331
|
+
}
|
|
9332
|
+
return result;
|
|
9333
|
+
case "between":
|
|
9334
|
+
if (Array.isArray(currentValue)) {
|
|
9335
|
+
result.value = "";
|
|
9336
|
+
} else {
|
|
9337
|
+
result.value = [currentValue, ""];
|
|
9338
|
+
}
|
|
9339
|
+
return result;
|
|
9340
|
+
case "none":
|
|
9341
|
+
result.value = "";
|
|
9342
|
+
return result;
|
|
9343
|
+
default:
|
|
9344
|
+
result.value = newOperatorValueType;
|
|
9345
|
+
return result;
|
|
9346
|
+
}
|
|
9347
|
+
}
|
|
9348
|
+
}
|
|
9349
|
+
function isHardcodedOperatorValue(valueType) {
|
|
9350
|
+
return valueType !== void 0 && valueType !== "array" && valueType !== "between" && valueType !== "none" && valueType !== "single";
|
|
9351
|
+
}
|
|
9352
|
+
function hasBindings(currentValue) {
|
|
9353
|
+
if (currentValue === void 0) {
|
|
9354
|
+
return false;
|
|
9355
|
+
}
|
|
9356
|
+
if (Array.isArray(currentValue)) {
|
|
9357
|
+
return currentValue.some((value) => (0, import_canvas12.hasReferencedVariables)(value));
|
|
9358
|
+
}
|
|
9359
|
+
return (0, import_canvas12.hasReferencedVariables)(currentValue) > 0;
|
|
9360
|
+
}
|
|
9361
|
+
|
|
9362
|
+
// src/components/SearchAndFilter/FilterItems.tsx
|
|
9363
|
+
var import_jsx_runtime87 = require("@emotion/react/jsx-runtime");
|
|
9170
9364
|
var FilterItems = ({
|
|
9171
9365
|
addButtonText = "add condition",
|
|
9172
9366
|
additionalFiltersContainer,
|
|
9173
9367
|
filterTitle,
|
|
9174
9368
|
resetButtonText,
|
|
9175
|
-
initialCriteriaTitle
|
|
9369
|
+
initialCriteriaTitle,
|
|
9370
|
+
criteriaGroupOperator
|
|
9176
9371
|
}) => {
|
|
9177
9372
|
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
9178
9373
|
const handleUpdateFilter = (index, prop, value) => {
|
|
@@ -9180,32 +9375,16 @@ var FilterItems = ({
|
|
|
9180
9375
|
const next = [...filters];
|
|
9181
9376
|
next[index] = { ...next[index], [prop]: value };
|
|
9182
9377
|
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";
|
|
9378
|
+
const newOperatorId = value;
|
|
9379
|
+
const currentFilter = next[index];
|
|
9380
|
+
if (!newOperatorId) {
|
|
9381
|
+
throw new Error("you bad");
|
|
9208
9382
|
}
|
|
9383
|
+
next[index] = getNewFilterValueAfterOperatorChange({
|
|
9384
|
+
newOperatorId,
|
|
9385
|
+
currentFilter,
|
|
9386
|
+
filterOptions
|
|
9387
|
+
});
|
|
9209
9388
|
}
|
|
9210
9389
|
if (prop === "field") {
|
|
9211
9390
|
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
@@ -9214,15 +9393,16 @@ var FilterItems = ({
|
|
|
9214
9393
|
})) == 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
9394
|
next[index].operator = firstOperatorInAvailableOperators;
|
|
9216
9395
|
next[index].value = "";
|
|
9396
|
+
next[index].dynamicField = void 0;
|
|
9217
9397
|
}
|
|
9218
9398
|
setFilters(next);
|
|
9219
9399
|
};
|
|
9220
|
-
return /* @__PURE__ */ (0,
|
|
9400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9221
9401
|
FilterMenu,
|
|
9222
9402
|
{
|
|
9223
9403
|
id: "search-and-filter-options",
|
|
9224
9404
|
dataTestId: "search-and-filter-options",
|
|
9225
|
-
menuControls: /* @__PURE__ */ (0,
|
|
9405
|
+
menuControls: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
9226
9406
|
"button",
|
|
9227
9407
|
{
|
|
9228
9408
|
type: "button",
|
|
@@ -9230,7 +9410,7 @@ var FilterItems = ({
|
|
|
9230
9410
|
onClick: handleAddFilter,
|
|
9231
9411
|
"data-testid": "add-filter",
|
|
9232
9412
|
children: [
|
|
9233
|
-
/* @__PURE__ */ (0,
|
|
9413
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_design_system59.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
9234
9414
|
addButtonText
|
|
9235
9415
|
]
|
|
9236
9416
|
}
|
|
@@ -9246,17 +9426,18 @@ var FilterItems = ({
|
|
|
9246
9426
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
9247
9427
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
9248
9428
|
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,
|
|
9429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9250
9430
|
FilterItem,
|
|
9251
9431
|
{
|
|
9252
9432
|
index: i,
|
|
9253
|
-
|
|
9254
|
-
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
9433
|
+
onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
|
|
9255
9434
|
operatorOptions: possibleOperators,
|
|
9256
9435
|
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
9257
9436
|
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
9437
|
+
onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
|
|
9258
9438
|
valueOptions: possibleValueOptions,
|
|
9259
|
-
initialCriteriaTitle
|
|
9439
|
+
initialCriteriaTitle,
|
|
9440
|
+
criteriaGroupOperator
|
|
9260
9441
|
},
|
|
9261
9442
|
i
|
|
9262
9443
|
);
|
|
@@ -9266,11 +9447,11 @@ var FilterItems = ({
|
|
|
9266
9447
|
};
|
|
9267
9448
|
|
|
9268
9449
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9269
|
-
var
|
|
9450
|
+
var import_design_system61 = require("@uniformdev/design-system");
|
|
9270
9451
|
|
|
9271
9452
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
9272
|
-
var
|
|
9273
|
-
var
|
|
9453
|
+
var import_design_system60 = require("@uniformdev/design-system");
|
|
9454
|
+
var import_jsx_runtime88 = require("@emotion/react/jsx-runtime");
|
|
9274
9455
|
var SearchAndFilterResultContainer = ({
|
|
9275
9456
|
buttonText,
|
|
9276
9457
|
clearButtonLabel = "clear",
|
|
@@ -9300,19 +9481,19 @@ var SearchAndFilterResultContainer = ({
|
|
|
9300
9481
|
handleResetFilters();
|
|
9301
9482
|
}
|
|
9302
9483
|
};
|
|
9303
|
-
return /* @__PURE__ */ (0,
|
|
9304
|
-
/* @__PURE__ */ (0,
|
|
9305
|
-
/* @__PURE__ */ (0,
|
|
9484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
9485
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system60.HorizontalRhythm, { children: [
|
|
9486
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { children: [
|
|
9306
9487
|
totalResults,
|
|
9307
9488
|
" results ",
|
|
9308
9489
|
searchTerm ? `for "${searchTerm}"` : null
|
|
9309
9490
|
] }),
|
|
9310
|
-
!searchTerm || hideClearButton ? null : /* @__PURE__ */ (0,
|
|
9491
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_design_system60.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
9311
9492
|
] }),
|
|
9312
|
-
totalResults === 0 ? /* @__PURE__ */ (0,
|
|
9313
|
-
calloutText ? /* @__PURE__ */ (0,
|
|
9314
|
-
hideClearButton ? null : /* @__PURE__ */ (0,
|
|
9315
|
-
|
|
9493
|
+
totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system60.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
9494
|
+
calloutText ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_design_system60.Paragraph, { children: calloutText }) : null,
|
|
9495
|
+
hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
9496
|
+
import_design_system60.Button,
|
|
9316
9497
|
{
|
|
9317
9498
|
buttonType: "tertiaryOutline",
|
|
9318
9499
|
size: "xs",
|
|
@@ -9326,14 +9507,14 @@ var SearchAndFilterResultContainer = ({
|
|
|
9326
9507
|
};
|
|
9327
9508
|
|
|
9328
9509
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9329
|
-
var
|
|
9510
|
+
var import_jsx_runtime89 = require("@emotion/react/jsx-runtime");
|
|
9330
9511
|
var SearchAndFilter = ({
|
|
9331
9512
|
filters,
|
|
9332
9513
|
filterOptions,
|
|
9333
9514
|
filterVisible,
|
|
9334
9515
|
filterControls,
|
|
9335
9516
|
viewSwitchControls,
|
|
9336
|
-
resultsContainerView = /* @__PURE__ */ (0,
|
|
9517
|
+
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SearchAndFilterResultContainer, {}),
|
|
9337
9518
|
filterMapper: filterMapper2 = filterMapper,
|
|
9338
9519
|
additionalFiltersContainer,
|
|
9339
9520
|
onChange,
|
|
@@ -9343,7 +9524,7 @@ var SearchAndFilter = ({
|
|
|
9343
9524
|
allowBindingSearchTerm = false,
|
|
9344
9525
|
resetFilterValues = []
|
|
9345
9526
|
}) => {
|
|
9346
|
-
return /* @__PURE__ */ (0,
|
|
9527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
9347
9528
|
SearchAndFilterProvider,
|
|
9348
9529
|
{
|
|
9349
9530
|
filters,
|
|
@@ -9356,18 +9537,18 @@ var SearchAndFilter = ({
|
|
|
9356
9537
|
resetFilterValues,
|
|
9357
9538
|
filterMapper: filterMapper2,
|
|
9358
9539
|
allowBindingSearchTerm,
|
|
9359
|
-
children: /* @__PURE__ */ (0,
|
|
9360
|
-
/* @__PURE__ */ (0,
|
|
9361
|
-
/* @__PURE__ */ (0,
|
|
9540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_design_system61.VerticalRhythm, { "data-testid": "search-and-filter", children: [
|
|
9541
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
9542
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
9362
9543
|
"div",
|
|
9363
9544
|
{
|
|
9364
9545
|
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
9365
|
-
children: !filterControls ? /* @__PURE__ */ (0,
|
|
9546
|
+
children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
9366
9547
|
}
|
|
9367
9548
|
),
|
|
9368
9549
|
viewSwitchControls
|
|
9369
9550
|
] }),
|
|
9370
|
-
/* @__PURE__ */ (0,
|
|
9551
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FilterItems, { additionalFiltersContainer }),
|
|
9371
9552
|
resultsContainerView
|
|
9372
9553
|
] })
|
|
9373
9554
|
}
|
|
@@ -9375,10 +9556,10 @@ var SearchAndFilter = ({
|
|
|
9375
9556
|
};
|
|
9376
9557
|
|
|
9377
9558
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
9378
|
-
var
|
|
9559
|
+
var import_design_system62 = require("@uniformdev/design-system");
|
|
9379
9560
|
var import_react91 = require("react");
|
|
9380
9561
|
var import_react_use11 = require("react-use");
|
|
9381
|
-
var
|
|
9562
|
+
var import_jsx_runtime90 = require("@emotion/react/jsx-runtime");
|
|
9382
9563
|
var SearchOnlyContext = (0, import_react91.createContext)({
|
|
9383
9564
|
searchTerm: "",
|
|
9384
9565
|
setSearchTerm: () => {
|
|
@@ -9395,15 +9576,15 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9395
9576
|
300,
|
|
9396
9577
|
[localeSearchTerm]
|
|
9397
9578
|
);
|
|
9398
|
-
return /* @__PURE__ */ (0,
|
|
9579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
9399
9580
|
SearchOnlyContext.Provider,
|
|
9400
9581
|
{
|
|
9401
9582
|
value: {
|
|
9402
9583
|
searchTerm,
|
|
9403
9584
|
setSearchTerm: setLocaleSearchTerm
|
|
9404
9585
|
},
|
|
9405
|
-
children: /* @__PURE__ */ (0,
|
|
9406
|
-
|
|
9586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
9587
|
+
import_design_system62.InputKeywordSearch,
|
|
9407
9588
|
{
|
|
9408
9589
|
placeholder: "Search...",
|
|
9409
9590
|
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
@@ -9417,18 +9598,18 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9417
9598
|
};
|
|
9418
9599
|
|
|
9419
9600
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9420
|
-
var
|
|
9601
|
+
var import_design_system64 = require("@uniformdev/design-system");
|
|
9421
9602
|
|
|
9422
9603
|
// src/components/SearchAndFilter/styles/SortItems.styles.ts
|
|
9423
9604
|
var import_react92 = require("@emotion/react");
|
|
9424
|
-
var
|
|
9605
|
+
var import_design_system63 = require("@uniformdev/design-system");
|
|
9425
9606
|
var ConditionalFilterRow2 = import_react92.css`
|
|
9426
9607
|
display: grid;
|
|
9427
9608
|
grid-template-columns: 35px 1fr;
|
|
9428
9609
|
gap: var(--spacing-sm);
|
|
9429
9610
|
margin-left: var(--spacing-base);
|
|
9430
9611
|
|
|
9431
|
-
${(0,
|
|
9612
|
+
${(0, import_design_system63.cq)("380px")} {
|
|
9432
9613
|
align-items: center;
|
|
9433
9614
|
|
|
9434
9615
|
&:after {
|
|
@@ -9449,14 +9630,14 @@ var ConditionalFilterRow2 = import_react92.css`
|
|
|
9449
9630
|
grid-template-columns: 50px 1fr;
|
|
9450
9631
|
}
|
|
9451
9632
|
|
|
9452
|
-
${(0,
|
|
9633
|
+
${(0, import_design_system63.cq)("580px")} {
|
|
9453
9634
|
&:after {
|
|
9454
9635
|
display: none;
|
|
9455
9636
|
}
|
|
9456
9637
|
}
|
|
9457
9638
|
|
|
9458
9639
|
@media (prefers-reduced-motion: no-preference) {
|
|
9459
|
-
animation: ${
|
|
9640
|
+
animation: ${import_design_system63.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
9460
9641
|
}
|
|
9461
9642
|
`;
|
|
9462
9643
|
var ConditionalInputRow2 = import_react92.css`
|
|
@@ -9464,7 +9645,7 @@ var ConditionalInputRow2 = import_react92.css`
|
|
|
9464
9645
|
gap: var(--spacing-sm);
|
|
9465
9646
|
flex-wrap: wrap;
|
|
9466
9647
|
|
|
9467
|
-
${(0,
|
|
9648
|
+
${(0, import_design_system63.cq)("380px")} {
|
|
9468
9649
|
& > div:nth-child(-n + 2) {
|
|
9469
9650
|
width: calc(50% - var(--spacing-sm));
|
|
9470
9651
|
}
|
|
@@ -9473,7 +9654,7 @@ var ConditionalInputRow2 = import_react92.css`
|
|
|
9473
9654
|
width: calc(100% - 48px);
|
|
9474
9655
|
}
|
|
9475
9656
|
}
|
|
9476
|
-
${(0,
|
|
9657
|
+
${(0, import_design_system63.cq)("580px")} {
|
|
9477
9658
|
display: grid;
|
|
9478
9659
|
grid-template-columns: 200px 160px 1fr 32px;
|
|
9479
9660
|
|
|
@@ -9497,7 +9678,8 @@ var FilterButton3 = import_react92.css`
|
|
|
9497
9678
|
gap: var(--spacing-sm);
|
|
9498
9679
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
9499
9680
|
max-height: 40px;
|
|
9500
|
-
transition:
|
|
9681
|
+
transition:
|
|
9682
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
9501
9683
|
background-color var(--duration-fast) var(--timing-ease-out),
|
|
9502
9684
|
border-color var(--duration-fast) var(--timing-ease-out),
|
|
9503
9685
|
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
@@ -9631,7 +9813,7 @@ var SortFilterWrapper = (hiddenLocaleInput) => import_react92.css`
|
|
|
9631
9813
|
position: relative;
|
|
9632
9814
|
z-index: 0;
|
|
9633
9815
|
|
|
9634
|
-
${(0,
|
|
9816
|
+
${(0, import_design_system63.cq)("420px")} {
|
|
9635
9817
|
display: grid;
|
|
9636
9818
|
grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
|
|
9637
9819
|
}
|
|
@@ -9653,7 +9835,7 @@ var InputVariableWrapper = import_react92.css`
|
|
|
9653
9835
|
`;
|
|
9654
9836
|
|
|
9655
9837
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9656
|
-
var
|
|
9838
|
+
var import_jsx_runtime91 = require("@emotion/react/jsx-runtime");
|
|
9657
9839
|
var SortItems = ({
|
|
9658
9840
|
sortByLabel = "Sort by",
|
|
9659
9841
|
localeLabel = "Show locale",
|
|
@@ -9675,11 +9857,11 @@ var SortItems = ({
|
|
|
9675
9857
|
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
9676
9858
|
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
9677
9859
|
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9678
|
-
return /* @__PURE__ */ (0,
|
|
9679
|
-
/* @__PURE__ */ (0,
|
|
9680
|
-
/* @__PURE__ */ (0,
|
|
9681
|
-
/* @__PURE__ */ (0,
|
|
9682
|
-
/* @__PURE__ */ (0,
|
|
9860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9861
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_design_system64.VerticalRhythm, { gap: "xs", children: [
|
|
9862
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { css: Title2, children: sortByLabel }),
|
|
9863
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { css: SortFilterInputRow, children: [
|
|
9864
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9683
9865
|
InputVariables,
|
|
9684
9866
|
{
|
|
9685
9867
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9687,8 +9869,8 @@ var SortItems = ({
|
|
|
9687
9869
|
value: sortField,
|
|
9688
9870
|
valueToResetTo: "created_at",
|
|
9689
9871
|
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9690
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
9691
|
-
|
|
9872
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9873
|
+
import_design_system64.InputComboBox,
|
|
9692
9874
|
{
|
|
9693
9875
|
id: "sort-by-field",
|
|
9694
9876
|
"aria-label": "Sort by",
|
|
@@ -9710,7 +9892,7 @@ var SortItems = ({
|
|
|
9710
9892
|
)
|
|
9711
9893
|
}
|
|
9712
9894
|
),
|
|
9713
|
-
/* @__PURE__ */ (0,
|
|
9895
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9714
9896
|
InputVariables,
|
|
9715
9897
|
{
|
|
9716
9898
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9718,8 +9900,8 @@ var SortItems = ({
|
|
|
9718
9900
|
valueToResetTo: "DESC",
|
|
9719
9901
|
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9720
9902
|
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9721
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
9722
|
-
|
|
9903
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9904
|
+
import_design_system64.SegmentedControl,
|
|
9723
9905
|
{
|
|
9724
9906
|
noCheckmark: true,
|
|
9725
9907
|
name: "sortBy",
|
|
@@ -9750,15 +9932,15 @@ var SortItems = ({
|
|
|
9750
9932
|
)
|
|
9751
9933
|
] })
|
|
9752
9934
|
] }),
|
|
9753
|
-
hideLocaleOptions ? null : /* @__PURE__ */ (0,
|
|
9935
|
+
hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system64.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9754
9936
|
InputVariables,
|
|
9755
9937
|
{
|
|
9756
9938
|
label: localeLabelValue,
|
|
9757
9939
|
value: localeValue,
|
|
9758
9940
|
showMenuPosition: "inline-right",
|
|
9759
9941
|
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9760
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
9761
|
-
|
|
9942
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
9943
|
+
import_design_system64.InputSelect,
|
|
9762
9944
|
{
|
|
9763
9945
|
name: "localeReturned",
|
|
9764
9946
|
"aria-label": localeLabelValue,
|
|
@@ -9787,7 +9969,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
9787
9969
|
}
|
|
9788
9970
|
|
|
9789
9971
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
9790
|
-
var
|
|
9972
|
+
var import_canvas13 = require("@uniformdev/canvas");
|
|
9791
9973
|
var import_react93 = require("react");
|
|
9792
9974
|
function useContentDataResourceLocaleInfo({
|
|
9793
9975
|
locale,
|
|
@@ -9798,18 +9980,18 @@ function useContentDataResourceLocaleInfo({
|
|
|
9798
9980
|
const setLocaleRef = (0, import_react93.useRef)(setLocale);
|
|
9799
9981
|
setLocaleRef.current = setLocale;
|
|
9800
9982
|
const { flatVariables } = useVariables();
|
|
9801
|
-
const effectiveLocale = locale != null ? locale : dynamicInputs[
|
|
9802
|
-
const boundLocale = (_a = (0,
|
|
9983
|
+
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas13.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas13.createVariableReference)(import_canvas13.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
9984
|
+
const boundLocale = (_a = (0, import_canvas13.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
9803
9985
|
(0, import_react93.useEffect)(() => {
|
|
9804
9986
|
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
9805
|
-
setLocaleRef.current((0,
|
|
9987
|
+
setLocaleRef.current((0, import_canvas13.createVariableReference)(import_canvas13.LOCALE_DYNAMIC_INPUT_NAME));
|
|
9806
9988
|
}
|
|
9807
9989
|
}, [locale, effectiveLocale]);
|
|
9808
9990
|
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
9809
9991
|
}
|
|
9810
9992
|
|
|
9811
9993
|
// src/index.ts
|
|
9812
|
-
var
|
|
9994
|
+
var import_design_system65 = require("@uniformdev/design-system");
|
|
9813
9995
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
9814
9996
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9815
9997
|
0 && (module.exports = {
|
|
@@ -9821,6 +10003,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
9821
10003
|
Callout,
|
|
9822
10004
|
ControlledValuePlugin,
|
|
9823
10005
|
DATE_OPERATORS,
|
|
10006
|
+
DATE_TIME_OPERATORS,
|
|
9824
10007
|
DISCONNECT_VARIABLE_COMMAND,
|
|
9825
10008
|
DamSelectedItem,
|
|
9826
10009
|
DataRefreshButton,
|
|
@@ -9914,7 +10097,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
9914
10097
|
RequestUrlInput,
|
|
9915
10098
|
ResolvableLoadingValue,
|
|
9916
10099
|
SELECT_OPERATORS,
|
|
9917
|
-
SYSTEM_DATE_OPERATORS,
|
|
9918
10100
|
SYSTEM_FIELD_OPERATORS,
|
|
9919
10101
|
ScrollableList,
|
|
9920
10102
|
ScrollableListItem,
|
|
@@ -10011,6 +10193,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
10011
10193
|
selectedItemIcon,
|
|
10012
10194
|
selectedItemInner,
|
|
10013
10195
|
selectedItemTitle,
|
|
10196
|
+
serializeVariablesEditorSerializedState,
|
|
10014
10197
|
serializeVariablesEditorState,
|
|
10015
10198
|
setVariablesEditorValue,
|
|
10016
10199
|
urlEncodeRequestParameter,
|