@uniformdev/mesh-sdk-react 19.24.0 → 19.25.1-alpha.8
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.ts +52 -16
- package/dist/index.esm.js +1148 -511
- package/dist/index.js +1209 -579
- package/dist/index.mjs +1148 -511
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -166,9 +166,9 @@ var require_p_limit = __commonJS({
|
|
|
166
166
|
// src/index.ts
|
|
167
167
|
var src_exports = {};
|
|
168
168
|
__export(src_exports, {
|
|
169
|
-
AddListButton: () =>
|
|
170
|
-
Button: () =>
|
|
171
|
-
Callout: () =>
|
|
169
|
+
AddListButton: () => import_design_system36.AddListButton,
|
|
170
|
+
Button: () => import_design_system36.Button,
|
|
171
|
+
Callout: () => import_design_system36.Callout,
|
|
172
172
|
DamSelectedItem: () => DamSelectedItem,
|
|
173
173
|
DataRefreshButton: () => DataRefreshButton,
|
|
174
174
|
DataResourceDynamicInputProvider: () => DataResourceDynamicInputProvider,
|
|
@@ -179,20 +179,20 @@ __export(src_exports, {
|
|
|
179
179
|
DefaultSearchRow: () => DefaultSearchRow,
|
|
180
180
|
DefaultSelectedItem: () => DefaultSelectedItem,
|
|
181
181
|
EntrySearch: () => EntrySearch,
|
|
182
|
-
Heading: () =>
|
|
182
|
+
Heading: () => import_design_system36.Heading,
|
|
183
183
|
Icons: () => icons_exports,
|
|
184
|
-
Input: () =>
|
|
185
|
-
InputComboBox: () =>
|
|
186
|
-
InputKeywordSearch: () =>
|
|
187
|
-
InputSelect: () =>
|
|
188
|
-
InputToggle: () =>
|
|
184
|
+
Input: () => import_design_system36.Input,
|
|
185
|
+
InputComboBox: () => import_design_system36.InputComboBox,
|
|
186
|
+
InputKeywordSearch: () => import_design_system36.InputKeywordSearch,
|
|
187
|
+
InputSelect: () => import_design_system36.InputSelect,
|
|
188
|
+
InputToggle: () => import_design_system36.InputToggle,
|
|
189
189
|
InputVariables: () => InputVariables,
|
|
190
|
-
Label: () =>
|
|
190
|
+
Label: () => import_design_system36.Label,
|
|
191
191
|
LinkButton: () => LinkButton,
|
|
192
|
-
LoadingIndicator: () =>
|
|
193
|
-
LoadingOverlay: () =>
|
|
194
|
-
Menu: () =>
|
|
195
|
-
MenuItem: () =>
|
|
192
|
+
LoadingIndicator: () => import_design_system36.LoadingIndicator,
|
|
193
|
+
LoadingOverlay: () => import_design_system36.LoadingOverlay,
|
|
194
|
+
Menu: () => import_design_system36.Menu,
|
|
195
|
+
MenuItem: () => import_design_system36.MenuItem,
|
|
196
196
|
MeshApp: () => MeshApp,
|
|
197
197
|
ObjectSearchContainer: () => ObjectSearchContainer,
|
|
198
198
|
ObjectSearchFilter: () => ObjectSearchFilter,
|
|
@@ -203,21 +203,21 @@ __export(src_exports, {
|
|
|
203
203
|
ObjectSearchResultItem: () => ObjectSearchResultItem,
|
|
204
204
|
ObjectSearchResultItemButton: () => ObjectSearchResultItemButton,
|
|
205
205
|
ObjectSearchResultList: () => ObjectSearchResultList,
|
|
206
|
-
ParameterGroup: () =>
|
|
207
|
-
ParameterImage: () =>
|
|
208
|
-
ParameterImageInner: () =>
|
|
209
|
-
ParameterInput: () =>
|
|
210
|
-
ParameterInputInner: () =>
|
|
211
|
-
ParameterLabel: () =>
|
|
212
|
-
ParameterMenuButton: () =>
|
|
213
|
-
ParameterSelect: () =>
|
|
214
|
-
ParameterSelectInner: () =>
|
|
215
|
-
ParameterShell: () =>
|
|
216
|
-
ParameterShellContext: () =>
|
|
217
|
-
ParameterTextarea: () =>
|
|
218
|
-
ParameterTextareaInner: () =>
|
|
219
|
-
ParameterToggle: () =>
|
|
220
|
-
ParameterToggleInner: () =>
|
|
206
|
+
ParameterGroup: () => import_design_system36.ParameterGroup,
|
|
207
|
+
ParameterImage: () => import_design_system36.ParameterImage,
|
|
208
|
+
ParameterImageInner: () => import_design_system36.ParameterImageInner,
|
|
209
|
+
ParameterInput: () => import_design_system36.ParameterInput,
|
|
210
|
+
ParameterInputInner: () => import_design_system36.ParameterInputInner,
|
|
211
|
+
ParameterLabel: () => import_design_system36.ParameterLabel,
|
|
212
|
+
ParameterMenuButton: () => import_design_system36.ParameterMenuButton,
|
|
213
|
+
ParameterSelect: () => import_design_system36.ParameterSelect,
|
|
214
|
+
ParameterSelectInner: () => import_design_system36.ParameterSelectInner,
|
|
215
|
+
ParameterShell: () => import_design_system36.ParameterShell,
|
|
216
|
+
ParameterShellContext: () => import_design_system35.ParameterShellContext,
|
|
217
|
+
ParameterTextarea: () => import_design_system36.ParameterTextarea,
|
|
218
|
+
ParameterTextareaInner: () => import_design_system36.ParameterTextareaInner,
|
|
219
|
+
ParameterToggle: () => import_design_system36.ParameterToggle,
|
|
220
|
+
ParameterToggleInner: () => import_design_system36.ParameterToggleInner,
|
|
221
221
|
ProductPreviewList: () => ProductPreviewList,
|
|
222
222
|
ProductQuery: () => ProductQuery,
|
|
223
223
|
ProductQueryContext: () => ProductQueryContext,
|
|
@@ -235,13 +235,13 @@ __export(src_exports, {
|
|
|
235
235
|
RequestUrl: () => RequestUrl,
|
|
236
236
|
RequestUrlInput: () => RequestUrlInput,
|
|
237
237
|
ResolvableLoadingValue: () => ResolvableLoadingValue,
|
|
238
|
-
ScrollableList: () =>
|
|
239
|
-
ScrollableListItem: () =>
|
|
238
|
+
ScrollableList: () => import_design_system36.ScrollableList,
|
|
239
|
+
ScrollableListItem: () => import_design_system36.ScrollableListItem,
|
|
240
240
|
SelectionField: () => SelectionField,
|
|
241
|
-
Switch: () =>
|
|
241
|
+
Switch: () => import_design_system36.Switch,
|
|
242
242
|
TextVariableRenderer: () => TextVariableRenderer,
|
|
243
|
-
Textarea: () =>
|
|
244
|
-
Theme: () =>
|
|
243
|
+
Textarea: () => import_design_system36.Textarea,
|
|
244
|
+
Theme: () => import_design_system36.Theme,
|
|
245
245
|
VariableEditor: () => VariableEditor,
|
|
246
246
|
VariablesList: () => VariablesList,
|
|
247
247
|
VariablesProvider: () => VariablesProvider,
|
|
@@ -312,7 +312,7 @@ __export(src_exports, {
|
|
|
312
312
|
urlEncodeRequestUrl: () => urlEncodeRequestUrl,
|
|
313
313
|
useMeshLocation: () => useMeshLocation,
|
|
314
314
|
useObjectSearchContext: () => useObjectSearchContext,
|
|
315
|
-
useParameterShell: () =>
|
|
315
|
+
useParameterShell: () => import_design_system35.useParameterShell,
|
|
316
316
|
useProductQueryContext: () => useProductQueryContext,
|
|
317
317
|
useProductSearchContext: () => useProductSearchContext,
|
|
318
318
|
useRequest: () => useRequest,
|
|
@@ -320,7 +320,6 @@ __export(src_exports, {
|
|
|
320
320
|
useRequestParameter: () => useRequestParameter,
|
|
321
321
|
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
322
322
|
useVariables: () => useVariables,
|
|
323
|
-
variableExpression: () => variableExpression,
|
|
324
323
|
variablePrefix: () => variablePrefix,
|
|
325
324
|
variableSuffix: () => variableSuffix,
|
|
326
325
|
variablesToList: () => variablesToList
|
|
@@ -3077,34 +3076,221 @@ function useMeshLocation(expectedLocation) {
|
|
|
3077
3076
|
|
|
3078
3077
|
// src/components/Variables/InputVariables.tsx
|
|
3079
3078
|
init_emotion_jsx_shim();
|
|
3080
|
-
var
|
|
3079
|
+
var import_design_system18 = require("@uniformdev/design-system");
|
|
3081
3080
|
var React11 = __toESM(require("react"));
|
|
3082
|
-
var
|
|
3081
|
+
var import_react41 = require("react");
|
|
3082
|
+
var import_uuid3 = require("uuid");
|
|
3083
3083
|
|
|
3084
|
-
// src/components/Variables/
|
|
3084
|
+
// src/components/Variables/composer/PasteTransformerPlugin.tsx
|
|
3085
3085
|
init_emotion_jsx_shim();
|
|
3086
|
-
var
|
|
3087
|
-
var
|
|
3088
|
-
var
|
|
3086
|
+
var import_LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
3087
|
+
var import_lexical = require("lexical");
|
|
3088
|
+
var import_react28 = require("react");
|
|
3089
|
+
function PasteTransformerPlugin({ transformPaste }) {
|
|
3090
|
+
const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
|
|
3091
|
+
(0, import_react28.useEffect)(() => {
|
|
3092
|
+
editor.registerCommand(
|
|
3093
|
+
import_lexical.PASTE_COMMAND,
|
|
3094
|
+
(event) => {
|
|
3095
|
+
var _a;
|
|
3096
|
+
const selection = (0, import_lexical.$getSelection)();
|
|
3097
|
+
const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
|
|
3098
|
+
if (pastedText && transformPaste && (0, import_lexical.$isRangeSelection)(selection)) {
|
|
3099
|
+
const result = transformPaste(pastedText);
|
|
3100
|
+
if (result !== void 0) {
|
|
3101
|
+
selection.insertText(result);
|
|
3102
|
+
return true;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
return false;
|
|
3106
|
+
},
|
|
3107
|
+
import_lexical.COMMAND_PRIORITY_HIGH
|
|
3108
|
+
);
|
|
3109
|
+
}, [editor, transformPaste]);
|
|
3110
|
+
return null;
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
// src/components/Variables/styles/InputVariables.styles.ts
|
|
3114
|
+
init_emotion_jsx_shim();
|
|
3115
|
+
var import_react29 = require("@emotion/react");
|
|
3116
|
+
var menuContainer = import_react29.css`
|
|
3117
|
+
position: relative;
|
|
3118
|
+
`;
|
|
3119
|
+
var menuBtn = import_react29.css`
|
|
3120
|
+
position: absolute;
|
|
3121
|
+
top: 50%;
|
|
3122
|
+
right: var(--spacing-sm);
|
|
3123
|
+
transform: translateY(-50%);
|
|
3124
|
+
`;
|
|
3125
|
+
var input = import_react29.css`
|
|
3126
|
+
appearance: none;
|
|
3127
|
+
background-color: var(--white);
|
|
3128
|
+
border: 1px solid var(--gray-400);
|
|
3129
|
+
border-radius: var(--rounded-md);
|
|
3130
|
+
color: var(--gray-700);
|
|
3131
|
+
padding-block: var(--spacing-sm);
|
|
3132
|
+
padding-left: var(--spacing-base);
|
|
3133
|
+
padding-right: var(--spacing-lg);
|
|
3134
|
+
line-height: 2.5;
|
|
3135
|
+
width: 100%;
|
|
3136
|
+
position: relative;
|
|
3137
|
+
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3138
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
3139
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
3140
|
+
|
|
3141
|
+
&:focus,
|
|
3142
|
+
&:focus-within {
|
|
3143
|
+
border-color: var(--brand-secondary-1);
|
|
3144
|
+
box-shadow: none;
|
|
3145
|
+
outline: none;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
&:disabled,
|
|
3149
|
+
&:disabled::placeholder {
|
|
3150
|
+
cursor: not-allowed;
|
|
3151
|
+
color: var(--gray-300);
|
|
3152
|
+
border-color: var(--gray-300);
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
> p {
|
|
3156
|
+
margin: 0;
|
|
3157
|
+
}
|
|
3158
|
+
`;
|
|
3159
|
+
|
|
3160
|
+
// src/components/Variables/util/getReferencedVariables.ts
|
|
3161
|
+
init_emotion_jsx_shim();
|
|
3162
|
+
|
|
3163
|
+
// src/components/Variables/util/parseVariableExpression.ts
|
|
3164
|
+
init_emotion_jsx_shim();
|
|
3165
|
+
|
|
3166
|
+
// src/components/Variables/util/variableExpression.ts
|
|
3167
|
+
init_emotion_jsx_shim();
|
|
3168
|
+
var variablePrefix = "${";
|
|
3169
|
+
var variableSuffix = "}";
|
|
3170
|
+
|
|
3171
|
+
// src/components/Variables/util/parseVariableExpression.ts
|
|
3172
|
+
function parseVariableExpression(serialized, onToken) {
|
|
3173
|
+
let buf = [];
|
|
3174
|
+
let state = "text";
|
|
3175
|
+
for (let index = 0; index < serialized.length; index++) {
|
|
3176
|
+
const char = serialized[index];
|
|
3177
|
+
if (char === "$" && serialized.at(index + 1) === "{") {
|
|
3178
|
+
if (serialized.at(index - 1) === "\\") {
|
|
3179
|
+
buf.pop();
|
|
3180
|
+
buf.push(char);
|
|
3181
|
+
continue;
|
|
3182
|
+
}
|
|
3183
|
+
state = "variable";
|
|
3184
|
+
if (buf.length) {
|
|
3185
|
+
onToken(buf.join(""), "text");
|
|
3186
|
+
buf = [];
|
|
3187
|
+
}
|
|
3188
|
+
index++;
|
|
3189
|
+
continue;
|
|
3190
|
+
}
|
|
3191
|
+
if (char === "}" && state === "variable") {
|
|
3192
|
+
state = "text";
|
|
3193
|
+
if (buf.length) {
|
|
3194
|
+
onToken(buf.join(""), "variable");
|
|
3195
|
+
buf = [];
|
|
3196
|
+
}
|
|
3197
|
+
continue;
|
|
3198
|
+
}
|
|
3199
|
+
buf.push(char);
|
|
3200
|
+
}
|
|
3201
|
+
if (buf.length) {
|
|
3202
|
+
if (state === "variable") {
|
|
3203
|
+
state = "text";
|
|
3204
|
+
buf.unshift(variablePrefix);
|
|
3205
|
+
}
|
|
3206
|
+
onToken(buf.join(""), state);
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
// src/components/Variables/util/getReferencedVariables.ts
|
|
3211
|
+
function getReferencedVariables(value) {
|
|
3212
|
+
const result = [];
|
|
3213
|
+
parseVariableExpression(value, (token, type) => {
|
|
3214
|
+
if (type === "variable") {
|
|
3215
|
+
result.push(token);
|
|
3216
|
+
}
|
|
3217
|
+
});
|
|
3218
|
+
return result;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
// src/components/Variables/VariableField.tsx
|
|
3222
|
+
init_emotion_jsx_shim();
|
|
3223
|
+
|
|
3224
|
+
// src/components/Variables/styles/VariableField.styles.ts
|
|
3225
|
+
init_emotion_jsx_shim();
|
|
3226
|
+
var import_react30 = require("@emotion/react");
|
|
3227
|
+
var labelText = import_react30.css`
|
|
3228
|
+
align-items: center;
|
|
3229
|
+
display: flex;
|
|
3230
|
+
gap: var(--spacing-xs);
|
|
3231
|
+
font-weight: var(--fw-regular);
|
|
3232
|
+
margin: 0 0 var(--spacing-xs);
|
|
3233
|
+
`;
|
|
3234
|
+
var variableBindButton = import_react30.css`
|
|
3235
|
+
align-items: center;
|
|
3236
|
+
border: none;
|
|
3237
|
+
border-radius: var(--rounded-base);
|
|
3238
|
+
background: none;
|
|
3239
|
+
display: flex;
|
|
3240
|
+
height: 1.2rem;
|
|
3241
|
+
padding: var(--spacing-2xs);
|
|
3242
|
+
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3243
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
3244
|
+
width: 1.2rem;
|
|
3245
|
+
|
|
3246
|
+
&:hover,
|
|
3247
|
+
&[aria-pressed='true']:not(:disabled) {
|
|
3248
|
+
background: var(--brand-secondary-3);
|
|
3249
|
+
color: var(--white);
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
&[aria-disabled='true'] {
|
|
3253
|
+
background: none;
|
|
3254
|
+
color: currentColor;
|
|
3255
|
+
}
|
|
3256
|
+
`;
|
|
3257
|
+
|
|
3258
|
+
// src/components/Variables/VariablesComposerVariableMenu.tsx
|
|
3259
|
+
init_emotion_jsx_shim();
|
|
3260
|
+
var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
|
|
3261
|
+
var import_lexical4 = require("lexical");
|
|
3262
|
+
|
|
3263
|
+
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3264
|
+
init_emotion_jsx_shim();
|
|
3265
|
+
var import_react35 = require("@emotion/react");
|
|
3266
|
+
var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerContext");
|
|
3267
|
+
var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
|
|
3268
|
+
var import_design_system16 = require("@uniformdev/design-system");
|
|
3269
|
+
var import_lexical3 = require("lexical");
|
|
3270
|
+
var import_react36 = require("react");
|
|
3271
|
+
var import_react_dom = require("react-dom");
|
|
3089
3272
|
|
|
3090
3273
|
// src/components/Variables/styles/InsertVariableMenu.styles.ts
|
|
3091
3274
|
init_emotion_jsx_shim();
|
|
3092
|
-
var
|
|
3093
|
-
var
|
|
3275
|
+
var import_react31 = require("@emotion/react");
|
|
3276
|
+
var menuBtn2 = import_react31.css`
|
|
3094
3277
|
background: none;
|
|
3095
3278
|
border: none;
|
|
3096
3279
|
color: var(--gray-500);
|
|
3097
3280
|
padding: 0;
|
|
3098
3281
|
`;
|
|
3099
|
-
var menuItemTextGroup =
|
|
3282
|
+
var menuItemTextGroup = import_react31.css`
|
|
3100
3283
|
align-items: flex-start;
|
|
3101
3284
|
display: flex;
|
|
3102
3285
|
flex-direction: column;
|
|
3286
|
+
gap: 0;
|
|
3287
|
+
line-height: 1em;
|
|
3103
3288
|
`;
|
|
3104
|
-
var smallText =
|
|
3289
|
+
var smallText = import_react31.css`
|
|
3105
3290
|
font-size: var(--fs-xs);
|
|
3291
|
+
color: var(--gray-500);
|
|
3106
3292
|
`;
|
|
3107
|
-
var variablesTipText =
|
|
3293
|
+
var variablesTipText = import_react31.css`
|
|
3108
3294
|
${smallText}
|
|
3109
3295
|
color: var(--gray-500);
|
|
3110
3296
|
padding: 0 var(--spacing-sm);
|
|
@@ -3112,7 +3298,7 @@ var variablesTipText = import_react28.css`
|
|
|
3112
3298
|
|
|
3113
3299
|
// src/components/Variables/useOnVariableUpdated.ts
|
|
3114
3300
|
init_emotion_jsx_shim();
|
|
3115
|
-
var
|
|
3301
|
+
var import_react33 = require("react");
|
|
3116
3302
|
|
|
3117
3303
|
// src/components/Variables/VariablesProvider.tsx
|
|
3118
3304
|
init_emotion_jsx_shim();
|
|
@@ -3128,13 +3314,13 @@ var import_zod2 = require("zod");
|
|
|
3128
3314
|
|
|
3129
3315
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
3130
3316
|
init_emotion_jsx_shim();
|
|
3131
|
-
var
|
|
3132
|
-
var variablesFormContainer =
|
|
3317
|
+
var import_react32 = require("@emotion/react");
|
|
3318
|
+
var variablesFormContainer = import_react32.css`
|
|
3133
3319
|
> * {
|
|
3134
3320
|
margin: var(--spacing-base) 0 0;
|
|
3135
3321
|
}
|
|
3136
3322
|
`;
|
|
3137
|
-
var variablesFormBtnGroup =
|
|
3323
|
+
var variablesFormBtnGroup = import_react32.css`
|
|
3138
3324
|
display: flex;
|
|
3139
3325
|
gap: var(--spacing-sm);
|
|
3140
3326
|
`;
|
|
@@ -3235,17 +3421,27 @@ function VariablesProvider({
|
|
|
3235
3421
|
value,
|
|
3236
3422
|
onChange,
|
|
3237
3423
|
editVariableComponent,
|
|
3424
|
+
readOnly,
|
|
3238
3425
|
children
|
|
3239
3426
|
}) {
|
|
3240
3427
|
const [editing, setEditing] = React10.useState();
|
|
3241
3428
|
const events = React10.useMemo(() => (0, import_mitt.default)(), []);
|
|
3429
|
+
if (!readOnly && !onChange) {
|
|
3430
|
+
throw new Error("onChange must be provided when readOnly is false");
|
|
3431
|
+
}
|
|
3242
3432
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
3243
3433
|
const contextValue = {
|
|
3244
3434
|
flatVariables: flattenVariables(value),
|
|
3245
3435
|
dispatch: (event) => {
|
|
3436
|
+
if (readOnly) {
|
|
3437
|
+
console.warn(
|
|
3438
|
+
`Received ignored mutation event in read-only variables context: ${JSON.stringify(event)}`
|
|
3439
|
+
);
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3246
3442
|
if (event.type === "set") {
|
|
3247
3443
|
const { name, ...varValue } = event.variable;
|
|
3248
|
-
onChange({ ...contextValue.variables, [event.variable.name]: varValue });
|
|
3444
|
+
onChange == null ? void 0 : onChange({ ...contextValue.variables, [event.variable.name]: varValue });
|
|
3249
3445
|
if (event.openEditor) {
|
|
3250
3446
|
setEditing(event.variable.name);
|
|
3251
3447
|
}
|
|
@@ -3254,9 +3450,9 @@ function VariablesProvider({
|
|
|
3254
3450
|
} else if (event.type === "remove") {
|
|
3255
3451
|
const newValue = { ...value };
|
|
3256
3452
|
delete newValue[event.variable];
|
|
3257
|
-
onChange(newValue);
|
|
3453
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
3258
3454
|
} else if (event.type === "reorder") {
|
|
3259
|
-
onChange(event.result);
|
|
3455
|
+
onChange == null ? void 0 : onChange(event.result);
|
|
3260
3456
|
} else {
|
|
3261
3457
|
throw new Error(`Unknown event ${JSON.stringify(event)}`);
|
|
3262
3458
|
}
|
|
@@ -3264,7 +3460,8 @@ function VariablesProvider({
|
|
|
3264
3460
|
variables: value,
|
|
3265
3461
|
isEditing: typeof editing !== "undefined",
|
|
3266
3462
|
events,
|
|
3267
|
-
canDispatch: true
|
|
3463
|
+
canDispatch: true,
|
|
3464
|
+
readOnly
|
|
3268
3465
|
};
|
|
3269
3466
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
|
|
3270
3467
|
children,
|
|
@@ -3274,7 +3471,7 @@ function VariablesProvider({
|
|
|
3274
3471
|
onSubmit: (val) => {
|
|
3275
3472
|
setEditing(void 0);
|
|
3276
3473
|
const { name, ...varValue } = val;
|
|
3277
|
-
onChange({ ...value, [name]: varValue });
|
|
3474
|
+
onChange == null ? void 0 : onChange({ ...value, [name]: varValue });
|
|
3278
3475
|
events.emit("update", name);
|
|
3279
3476
|
},
|
|
3280
3477
|
onCancel: () => setEditing(void 0),
|
|
@@ -3313,7 +3510,7 @@ function flattenVariables(variables) {
|
|
|
3313
3510
|
// src/components/Variables/useOnVariableUpdated.ts
|
|
3314
3511
|
function useOnVariableUpdated(fn2, disabled) {
|
|
3315
3512
|
const { variables, events } = useVariables();
|
|
3316
|
-
(0,
|
|
3513
|
+
(0, import_react33.useEffect)(() => {
|
|
3317
3514
|
if (disabled) {
|
|
3318
3515
|
return;
|
|
3319
3516
|
}
|
|
@@ -3322,6 +3519,9 @@ function useOnVariableUpdated(fn2, disabled) {
|
|
|
3322
3519
|
}, [disabled, events, fn2, variables]);
|
|
3323
3520
|
}
|
|
3324
3521
|
|
|
3522
|
+
// src/components/Variables/variablesToGroupedList.ts
|
|
3523
|
+
init_emotion_jsx_shim();
|
|
3524
|
+
|
|
3325
3525
|
// src/components/Variables/variablesToList.ts
|
|
3326
3526
|
init_emotion_jsx_shim();
|
|
3327
3527
|
function variablesToList(variables) {
|
|
@@ -3341,180 +3541,474 @@ function variablesToList(variables) {
|
|
|
3341
3541
|
}));
|
|
3342
3542
|
}
|
|
3343
3543
|
|
|
3344
|
-
// src/components/Variables/
|
|
3544
|
+
// src/components/Variables/variablesToGroupedList.ts
|
|
3545
|
+
function variablesToGroupedList(variables) {
|
|
3546
|
+
const groups = {};
|
|
3547
|
+
Object.entries(variables || {}).forEach(([name, definition]) => {
|
|
3548
|
+
var _a;
|
|
3549
|
+
const group = (_a = definition.source) != null ? _a : "";
|
|
3550
|
+
if (!groups[group]) {
|
|
3551
|
+
groups[group] = {};
|
|
3552
|
+
}
|
|
3553
|
+
groups[group][name] = definition;
|
|
3554
|
+
});
|
|
3555
|
+
return Object.entries(groups).map(([group, variables2]) => ({
|
|
3556
|
+
name: group,
|
|
3557
|
+
variables: variablesToList(variables2)
|
|
3558
|
+
})).sort((a2, b2) => {
|
|
3559
|
+
var _a, _b;
|
|
3560
|
+
return ((_a = a2.name) != null ? _a : "").localeCompare((_b = b2.name) != null ? _b : "");
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3563
|
+
|
|
3564
|
+
// src/components/Variables/composer/VariableNode.tsx
|
|
3565
|
+
init_emotion_jsx_shim();
|
|
3566
|
+
var import_design_system15 = require("@uniformdev/design-system");
|
|
3567
|
+
var import_lexical2 = require("lexical");
|
|
3568
|
+
var import_react34 = require("react");
|
|
3345
3569
|
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
3570
|
+
var VariableNode = class extends import_lexical2.DecoratorNode {
|
|
3571
|
+
constructor(reference, state, key) {
|
|
3572
|
+
super(key);
|
|
3573
|
+
this.reference = reference;
|
|
3574
|
+
this.__state = state;
|
|
3575
|
+
}
|
|
3576
|
+
static getType() {
|
|
3577
|
+
return "variable";
|
|
3578
|
+
}
|
|
3579
|
+
static clone(node) {
|
|
3580
|
+
return new VariableNode(node.reference, { ...node.__state }, node.__key);
|
|
3581
|
+
}
|
|
3582
|
+
/** Imports the node from serialized JSON (i.e. the data provided to the editor's initial state) */
|
|
3583
|
+
static importJSON(serializedNode) {
|
|
3584
|
+
return $createVariableNode(serializedNode.reference, {
|
|
3585
|
+
displayName: serializedNode.reference,
|
|
3586
|
+
referenceIsValid: true,
|
|
3587
|
+
hasClickEvent: void 0
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3590
|
+
/**
|
|
3591
|
+
* Updates the node's variables state so it knows its current validity, display name, etc
|
|
3592
|
+
* The plugin updates this whenever the variables prop changes.
|
|
3593
|
+
*/
|
|
3594
|
+
setState(state) {
|
|
3595
|
+
this.getWritable().__state = state;
|
|
3596
|
+
}
|
|
3597
|
+
/**
|
|
3598
|
+
* Serializes the node to JSON for editor initial state
|
|
3599
|
+
*/
|
|
3600
|
+
exportJSON() {
|
|
3601
|
+
return {
|
|
3602
|
+
reference: this.reference,
|
|
3603
|
+
type: VariableNode.getType(),
|
|
3604
|
+
version: 1
|
|
3605
|
+
};
|
|
3606
|
+
}
|
|
3607
|
+
/**
|
|
3608
|
+
* Copy variable to clipboard in a format we will read back if pasted
|
|
3609
|
+
* (albeit it won't get the fancy chip-node)
|
|
3610
|
+
*/
|
|
3611
|
+
getTextContent() {
|
|
3612
|
+
return `\${${this.reference}}`;
|
|
3613
|
+
}
|
|
3614
|
+
/** Creates the DOM wrapper that hosts the node */
|
|
3615
|
+
createDOM() {
|
|
3616
|
+
return document.createElement("span");
|
|
3617
|
+
}
|
|
3618
|
+
updateDOM() {
|
|
3619
|
+
return false;
|
|
3620
|
+
}
|
|
3621
|
+
/**
|
|
3622
|
+
* Render the variable node using React.
|
|
3623
|
+
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
3624
|
+
* rely on Context, etc in this renderer.
|
|
3625
|
+
*/
|
|
3626
|
+
decorate(editor) {
|
|
3627
|
+
const { displayName, hasClickEvent, referenceIsValid } = this.__state;
|
|
3628
|
+
const Wrapper = referenceIsValid ? import_react34.Fragment : UndefinedVariableReference;
|
|
3629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3630
|
+
import_design_system15.Chip,
|
|
3631
|
+
{
|
|
3632
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || this.reference }),
|
|
3633
|
+
title: !referenceIsValid ? `${this.reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0,
|
|
3634
|
+
onClick: () => {
|
|
3635
|
+
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
3636
|
+
reference: this.reference
|
|
3637
|
+
});
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
);
|
|
3641
|
+
}
|
|
3642
|
+
/** Enables keyboard navigation to hop over the node to previous text */
|
|
3643
|
+
isIsolated() {
|
|
3644
|
+
return true;
|
|
3645
|
+
}
|
|
3646
|
+
};
|
|
3647
|
+
function $createVariableNode(variableReference, state) {
|
|
3648
|
+
return new VariableNode(variableReference, state);
|
|
3649
|
+
}
|
|
3650
|
+
function UndefinedVariableReference({ children }) {
|
|
3651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3652
|
+
"span",
|
|
3653
|
+
{
|
|
3654
|
+
style: {
|
|
3655
|
+
textDecoration: "underline",
|
|
3656
|
+
textDecorationStyle: "wavy",
|
|
3657
|
+
textDecorationColor: "red"
|
|
3658
|
+
},
|
|
3659
|
+
children
|
|
3660
|
+
}
|
|
3661
|
+
);
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3665
|
+
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
3666
|
+
var EDIT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:edit-variable");
|
|
3667
|
+
var INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:insert-variable");
|
|
3668
|
+
var PUNCTUATION = `\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;
|
|
3669
|
+
var NAME = "\\b[A-Z][^\\s" + PUNCTUATION + "]";
|
|
3670
|
+
var DocumentVariablesRegex = {
|
|
3671
|
+
NAME,
|
|
3672
|
+
PUNCTUATION
|
|
3673
|
+
};
|
|
3674
|
+
var PUNC = DocumentVariablesRegex.PUNCTUATION;
|
|
3675
|
+
var TRIGGERS = ["$"].join("");
|
|
3676
|
+
var VALID_CHARS = "[^" + TRIGGERS + PUNC + "\\s]";
|
|
3677
|
+
var VALID_JOINS = "(?:\\.[ |$]| |[" + PUNC + "]|)";
|
|
3678
|
+
var LENGTH_LIMIT = 75;
|
|
3679
|
+
var DollarSignVariablesRegex = new RegExp(
|
|
3680
|
+
"(^.*)([" + TRIGGERS + "]((?:" + VALID_CHARS + VALID_JOINS + "){0," + LENGTH_LIMIT + "}))$"
|
|
3681
|
+
);
|
|
3682
|
+
function getPossibleQueryMatch(text) {
|
|
3683
|
+
const match = DollarSignVariablesRegex.exec(text);
|
|
3684
|
+
if (match !== null) {
|
|
3685
|
+
const maybeLeadingWhitespace = match[1];
|
|
3686
|
+
const matchingString = match[3];
|
|
3687
|
+
return {
|
|
3688
|
+
leadOffset: match.index + maybeLeadingWhitespace.length,
|
|
3689
|
+
matchingString,
|
|
3690
|
+
replaceableString: match[2]
|
|
3691
|
+
};
|
|
3692
|
+
}
|
|
3693
|
+
return null;
|
|
3694
|
+
}
|
|
3695
|
+
var ADD_VARIABLE_OPTION = "$$add-variable$$";
|
|
3696
|
+
var SOURCE_SEPARATOR = "--";
|
|
3697
|
+
function VariablesPlugin({
|
|
3698
|
+
disableVariables,
|
|
3699
|
+
showAddVariableMenuOption,
|
|
3700
|
+
enableEditingVariables
|
|
3701
|
+
}) {
|
|
3702
|
+
const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
|
|
3703
|
+
const { variables, dispatch, isEditing, canDispatch, readOnly } = useVariables();
|
|
3704
|
+
const canEditVariable = canDispatch && enableEditingVariables && !readOnly;
|
|
3705
|
+
const canAddVariable = canDispatch && showAddVariableMenuOption && !readOnly;
|
|
3706
|
+
const [openedAdd, setOpenedAdd] = (0, import_react36.useState)(false);
|
|
3707
|
+
useOnVariableUpdated((varName) => {
|
|
3708
|
+
editor.update(() => {
|
|
3709
|
+
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, { reference: varName });
|
|
3710
|
+
});
|
|
3711
|
+
}, !openedAdd);
|
|
3712
|
+
(0, import_react36.useEffect)(() => {
|
|
3713
|
+
if (openedAdd && !isEditing) {
|
|
3714
|
+
setOpenedAdd(false);
|
|
3715
|
+
}
|
|
3716
|
+
}, [isEditing, openedAdd]);
|
|
3717
|
+
const [queryString, setQueryString] = (0, import_react36.useState)(null);
|
|
3718
|
+
const { groupedVariables, menuOptions } = (0, import_react36.useMemo)(() => {
|
|
3719
|
+
const groupedVariables2 = variablesToGroupedList(variables);
|
|
3720
|
+
if (canAddVariable) {
|
|
3721
|
+
groupedVariables2.push({
|
|
3722
|
+
name: SOURCE_SEPARATOR,
|
|
3723
|
+
variables: [{ name: ADD_VARIABLE_OPTION, displayName: "Add\u2026", default: "" }]
|
|
3724
|
+
});
|
|
3725
|
+
}
|
|
3726
|
+
const menuOptions2 = [];
|
|
3727
|
+
groupedVariables2.forEach(
|
|
3728
|
+
(group) => group.variables.forEach((variable) => {
|
|
3729
|
+
menuOptions2.push(new import_LexicalTypeaheadMenuPlugin.MenuOption(variable.name));
|
|
3730
|
+
})
|
|
3731
|
+
);
|
|
3732
|
+
return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
|
|
3733
|
+
}, [variables, canAddVariable]);
|
|
3734
|
+
const { filteredGroupedVariables, filteredMenuOptions } = (0, import_react36.useMemo)(() => {
|
|
3735
|
+
if (!queryString) {
|
|
3736
|
+
return {
|
|
3737
|
+
filteredGroupedVariables: groupedVariables,
|
|
3738
|
+
filteredMenuOptions: menuOptions
|
|
3739
|
+
};
|
|
3740
|
+
}
|
|
3741
|
+
const query = queryString.toLowerCase();
|
|
3742
|
+
return {
|
|
3743
|
+
filteredGroupedVariables: groupedVariables.map((group) => ({
|
|
3744
|
+
name: group.name,
|
|
3745
|
+
variables: group.variables.filter(
|
|
3746
|
+
(option) => option.name.toLowerCase().includes(query) || option.name === ADD_VARIABLE_OPTION
|
|
3747
|
+
)
|
|
3748
|
+
})).filter((group) => group.variables.length > 0),
|
|
3749
|
+
filteredMenuOptions: menuOptions.filter(
|
|
3750
|
+
(option) => option.key.includes(query) || option.key === ADD_VARIABLE_OPTION
|
|
3751
|
+
)
|
|
3752
|
+
};
|
|
3753
|
+
}, [queryString, groupedVariables, menuOptions]);
|
|
3754
|
+
const onSelectOption = (0, import_react36.useCallback)(
|
|
3755
|
+
(selectedOption, nodeToReplace, closeMenu) => {
|
|
3756
|
+
if (selectedOption.key === ADD_VARIABLE_OPTION) {
|
|
3757
|
+
setOpenedAdd(true);
|
|
3758
|
+
editor.update(() => {
|
|
3759
|
+
nodeToReplace == null ? void 0 : nodeToReplace.remove();
|
|
3760
|
+
});
|
|
3761
|
+
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
3762
|
+
reference: queryString != null ? queryString : ""
|
|
3763
|
+
});
|
|
3764
|
+
} else {
|
|
3765
|
+
editor.update(() => {
|
|
3766
|
+
var _a;
|
|
3767
|
+
const variableNode = $createVariableNode(selectedOption.key, {
|
|
3768
|
+
displayName: ((_a = variables[selectedOption.key]) == null ? void 0 : _a.displayName) || selectedOption.key,
|
|
3769
|
+
hasClickEvent: canEditVariable,
|
|
3770
|
+
referenceIsValid: Boolean(variables[selectedOption.key])
|
|
3771
|
+
});
|
|
3772
|
+
if (nodeToReplace) {
|
|
3773
|
+
nodeToReplace.replace(variableNode);
|
|
3774
|
+
}
|
|
3775
|
+
});
|
|
3776
|
+
}
|
|
3777
|
+
closeMenu();
|
|
3778
|
+
},
|
|
3779
|
+
[editor, queryString, variables, canEditVariable]
|
|
3780
|
+
);
|
|
3781
|
+
(0, import_react36.useEffect)(() => {
|
|
3782
|
+
editor.registerCommand(
|
|
3783
|
+
EDIT_VARIABLE_COMMAND,
|
|
3784
|
+
({ reference }) => {
|
|
3785
|
+
if (!disableVariables && canEditVariable) {
|
|
3786
|
+
dispatch({ type: "edit", variable: reference });
|
|
3787
|
+
}
|
|
3788
|
+
return true;
|
|
3789
|
+
},
|
|
3790
|
+
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3791
|
+
);
|
|
3792
|
+
editor.registerCommand(
|
|
3793
|
+
INSERT_VARIABLE_COMMAND,
|
|
3794
|
+
({ reference }) => {
|
|
3795
|
+
var _a;
|
|
3796
|
+
if (!disableVariables) {
|
|
3797
|
+
const variableNode = $createVariableNode(reference, {
|
|
3798
|
+
displayName: ((_a = variables[reference]) == null ? void 0 : _a.displayName) || reference,
|
|
3799
|
+
hasClickEvent: canEditVariable,
|
|
3800
|
+
referenceIsValid: Boolean(variables[reference])
|
|
3801
|
+
});
|
|
3802
|
+
(0, import_lexical3.$insertNodes)([variableNode]);
|
|
3803
|
+
}
|
|
3804
|
+
return true;
|
|
3805
|
+
},
|
|
3806
|
+
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3807
|
+
);
|
|
3808
|
+
}, [editor, disableVariables, variables, canDispatch, dispatch, canEditVariable, readOnly]);
|
|
3809
|
+
(0, import_react36.useEffect)(() => {
|
|
3810
|
+
editor.update(() => {
|
|
3811
|
+
(0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
3812
|
+
const targetVar = variables[variableNode.reference];
|
|
3813
|
+
variableNode.setState({
|
|
3814
|
+
displayName: (targetVar == null ? void 0 : targetVar.displayName) || variableNode.reference,
|
|
3815
|
+
hasClickEvent: canEditVariable,
|
|
3816
|
+
referenceIsValid: Boolean(targetVar)
|
|
3817
|
+
});
|
|
3818
|
+
});
|
|
3819
|
+
});
|
|
3820
|
+
}, [editor, variables, canEditVariable]);
|
|
3821
|
+
if (disableVariables) {
|
|
3822
|
+
return null;
|
|
3823
|
+
}
|
|
3824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3825
|
+
import_LexicalTypeaheadMenuPlugin.LexicalTypeaheadMenuPlugin,
|
|
3826
|
+
{
|
|
3827
|
+
onQueryChange: setQueryString,
|
|
3828
|
+
onSelectOption,
|
|
3829
|
+
triggerFn: getPossibleQueryMatch,
|
|
3830
|
+
options: filteredMenuOptions,
|
|
3831
|
+
menuRenderFn: (anchorElementRef, { selectOptionAndCleanUp, setHighlightedIndex, selectedIndex }) => {
|
|
3832
|
+
if (!anchorElementRef.current || groupedVariables.length === 0 || openedAdd) {
|
|
3833
|
+
return null;
|
|
3834
|
+
}
|
|
3835
|
+
let currentCumulativeMenuIndex = -1;
|
|
3836
|
+
return (0, import_react_dom.createPortal)(
|
|
3837
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3838
|
+
"div",
|
|
3839
|
+
{
|
|
3840
|
+
css: import_react35.css`
|
|
3841
|
+
box-shadow: var(--shadow-base);
|
|
3842
|
+
border-radius: var(--rounded-base);
|
|
3843
|
+
background: var(--gray-50);
|
|
3844
|
+
display: flex;
|
|
3845
|
+
flex-direction: column;
|
|
3846
|
+
// 1em = text height, spacing-sm for padding, to prevent menu overlapping text entry
|
|
3847
|
+
margin-top: calc(1em + var(--spacing-sm));
|
|
3848
|
+
min-width: 250px;
|
|
3849
|
+
padding: var(--spacing-sm);
|
|
3850
|
+
outline: none;
|
|
3851
|
+
overflow: hidden;
|
|
3852
|
+
position: relative;
|
|
3853
|
+
z-index: var(--z-50);
|
|
3854
|
+
`,
|
|
3855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: filteredGroupedVariables.map((group, index) => {
|
|
3856
|
+
var _a, _b;
|
|
3857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3858
|
+
import_design_system16.MenuGroup,
|
|
3859
|
+
{
|
|
3860
|
+
title: group.name === SOURCE_SEPARATOR ? "" : (_a = group.name) != null ? _a : "",
|
|
3861
|
+
children: [
|
|
3862
|
+
group.name === SOURCE_SEPARATOR && currentCumulativeMenuIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system16.MenuItemSeparator, {}) : null,
|
|
3863
|
+
group.variables.map((variable) => {
|
|
3864
|
+
var _a2;
|
|
3865
|
+
currentCumulativeMenuIndex++;
|
|
3866
|
+
const myCumulativeIndex = currentCumulativeMenuIndex;
|
|
3867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3868
|
+
import_design_system16.MenuItem,
|
|
3869
|
+
{
|
|
3870
|
+
active: selectedIndex === myCumulativeIndex,
|
|
3871
|
+
onClick: () => {
|
|
3872
|
+
setHighlightedIndex(myCumulativeIndex);
|
|
3873
|
+
selectOptionAndCleanUp(new import_LexicalTypeaheadMenuPlugin.MenuOption(variable.name));
|
|
3874
|
+
},
|
|
3875
|
+
onMouseEnter: () => {
|
|
3876
|
+
setHighlightedIndex(myCumulativeIndex);
|
|
3877
|
+
},
|
|
3878
|
+
css: menuItemTextGroup,
|
|
3879
|
+
children: [
|
|
3880
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: (_a2 = variable.displayName) != null ? _a2 : variable.name }),
|
|
3881
|
+
variable.helpText ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("small", { css: smallText, children: variable.helpText }) : null
|
|
3882
|
+
]
|
|
3883
|
+
},
|
|
3884
|
+
variable.name
|
|
3885
|
+
);
|
|
3886
|
+
})
|
|
3887
|
+
]
|
|
3888
|
+
},
|
|
3889
|
+
(_b = group.name) != null ? _b : `none${index}`
|
|
3890
|
+
);
|
|
3891
|
+
}) })
|
|
3892
|
+
}
|
|
3893
|
+
),
|
|
3894
|
+
anchorElementRef.current
|
|
3895
|
+
);
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
);
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3901
|
+
// src/components/Variables/SelectVariableMenu.tsx
|
|
3902
|
+
init_emotion_jsx_shim();
|
|
3903
|
+
var import_design_system17 = require("@uniformdev/design-system");
|
|
3904
|
+
var import_react37 = require("react");
|
|
3905
|
+
var import_cg5 = require("react-icons/cg");
|
|
3906
|
+
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
3346
3907
|
var SelectVariableMenu = ({
|
|
3347
3908
|
onSelectVariable,
|
|
3348
3909
|
onResetVariables,
|
|
3349
3910
|
showAddVariableMenuOption = false,
|
|
3350
|
-
forceVisible,
|
|
3351
3911
|
buttonCss,
|
|
3352
3912
|
buttonProps,
|
|
3353
3913
|
tip
|
|
3354
3914
|
}) => {
|
|
3355
3915
|
const { variables, dispatch, isEditing, canDispatch } = useVariables();
|
|
3356
|
-
const btnRef = (0,
|
|
3357
|
-
const [openedAdd, setOpenedAdd] = (0,
|
|
3916
|
+
const btnRef = (0, import_react37.useRef)(null);
|
|
3917
|
+
const [openedAdd, setOpenedAdd] = (0, import_react37.useState)(false);
|
|
3358
3918
|
useOnVariableUpdated((varName) => {
|
|
3359
3919
|
onSelectVariable == null ? void 0 : onSelectVariable({ name: varName, default: "" });
|
|
3360
3920
|
}, !openedAdd);
|
|
3361
|
-
(0,
|
|
3921
|
+
(0, import_react37.useEffect)(() => {
|
|
3362
3922
|
if (openedAdd && !isEditing) {
|
|
3363
3923
|
setOpenedAdd(false);
|
|
3364
3924
|
}
|
|
3365
3925
|
}, [isEditing, openedAdd]);
|
|
3366
|
-
const
|
|
3926
|
+
const variablesGroups = variablesToGroupedList(variables);
|
|
3367
3927
|
const menuHasVariableOptions = Object.entries(variables).length || showAddVariableMenuOption;
|
|
3368
|
-
return /* @__PURE__ */ (0,
|
|
3369
|
-
|
|
3928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3929
|
+
import_design_system17.Menu,
|
|
3370
3930
|
{
|
|
3371
3931
|
placement: "bottom-start",
|
|
3372
|
-
|
|
3373
|
-
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3932
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3374
3933
|
"button",
|
|
3375
3934
|
{
|
|
3376
3935
|
title: "Insert variable",
|
|
3377
3936
|
...buttonProps,
|
|
3378
3937
|
ref: btnRef,
|
|
3379
|
-
css: [
|
|
3938
|
+
css: [menuBtn2, buttonCss],
|
|
3380
3939
|
type: "button",
|
|
3381
|
-
children: /* @__PURE__ */ (0,
|
|
3940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_cg5.CgUsbC, { size: "1.4rem" })
|
|
3382
3941
|
}
|
|
3383
3942
|
),
|
|
3384
3943
|
menuLabel: "Insert variable",
|
|
3385
3944
|
children: [
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
return /* @__PURE__ */ (0,
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3945
|
+
variablesGroups.map((group) => {
|
|
3946
|
+
var _a;
|
|
3947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system17.MenuGroup, { title: (_a = group.name) != null ? _a : "", children: group.variables.map((variable) => {
|
|
3948
|
+
const { name, displayName, helpText } = variable;
|
|
3949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3950
|
+
import_design_system17.MenuItem,
|
|
3951
|
+
{
|
|
3952
|
+
id: name,
|
|
3953
|
+
css: menuItemTextGroup,
|
|
3954
|
+
onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
|
|
3955
|
+
children: [
|
|
3956
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: displayName != null ? displayName : name }),
|
|
3957
|
+
helpText ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("small", { css: smallText, children: helpText }) : null
|
|
3958
|
+
]
|
|
3959
|
+
},
|
|
3960
|
+
name
|
|
3961
|
+
);
|
|
3962
|
+
}) }, group.name);
|
|
3401
3963
|
}),
|
|
3402
|
-
showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ (0,
|
|
3403
|
-
|
|
3404
|
-
/* @__PURE__ */ (0,
|
|
3405
|
-
|
|
3964
|
+
showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3965
|
+
variablesGroups.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system17.MenuItemSeparator, {}) : null,
|
|
3966
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3967
|
+
import_design_system17.MenuItem,
|
|
3406
3968
|
{
|
|
3407
3969
|
onClick: () => {
|
|
3408
3970
|
setOpenedAdd(true);
|
|
3409
3971
|
dispatch({ type: "edit", variable: "" });
|
|
3410
3972
|
},
|
|
3411
|
-
children: "Add
|
|
3973
|
+
children: "Add\u2026"
|
|
3412
3974
|
}
|
|
3413
3975
|
)
|
|
3414
3976
|
] }) : null,
|
|
3415
|
-
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0,
|
|
3416
|
-
onResetVariables ? /* @__PURE__ */ (0,
|
|
3417
|
-
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0,
|
|
3418
|
-
tip ? /* @__PURE__ */ (0,
|
|
3977
|
+
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system17.MenuItemSeparator, {}) : null,
|
|
3978
|
+
onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system17.MenuItem, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
|
|
3979
|
+
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system17.MenuItemSeparator, {}) : null,
|
|
3980
|
+
tip ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("i", { css: variablesTipText, children: tip }) : null
|
|
3419
3981
|
]
|
|
3420
3982
|
}
|
|
3421
3983
|
);
|
|
3422
3984
|
};
|
|
3423
3985
|
|
|
3424
|
-
// src/components/Variables/
|
|
3425
|
-
|
|
3426
|
-
var
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
const result = [];
|
|
3448
|
-
for (const match of value.matchAll(variableExpression)) {
|
|
3449
|
-
result.push(match[1]);
|
|
3450
|
-
}
|
|
3451
|
-
return result;
|
|
3452
|
-
}
|
|
3453
|
-
|
|
3454
|
-
// src/components/Variables/util/insertVariableIntoText.ts
|
|
3455
|
-
init_emotion_jsx_shim();
|
|
3456
|
-
function insertVariableIntoText({
|
|
3457
|
-
variableName: variableName2,
|
|
3458
|
-
value,
|
|
3459
|
-
selectionStart = null,
|
|
3460
|
-
selectionEnd = null
|
|
3461
|
-
}) {
|
|
3462
|
-
const variableExpression2 = `${variablePrefix}${variableName2}${variableSuffix}`;
|
|
3463
|
-
if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
|
|
3464
|
-
return `${value.substring(0, selectionStart)}${variableExpression2}${value.substring(selectionEnd)}`;
|
|
3465
|
-
}
|
|
3466
|
-
const hasCursorPosition = selectionStart !== null;
|
|
3467
|
-
let startOffset = 0;
|
|
3468
|
-
if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
|
|
3469
|
-
startOffset = variablePrefix.length;
|
|
3470
|
-
}
|
|
3471
|
-
if (hasCursorPosition) {
|
|
3472
|
-
return `${value.substring(0, selectionStart - startOffset)}${variableExpression2}${value.substring(
|
|
3473
|
-
selectionStart
|
|
3474
|
-
)}`;
|
|
3475
|
-
}
|
|
3476
|
-
return `${value}${variableExpression2}`;
|
|
3477
|
-
}
|
|
3478
|
-
|
|
3479
|
-
// src/components/Variables/VariableField.tsx
|
|
3480
|
-
init_emotion_jsx_shim();
|
|
3481
|
-
|
|
3482
|
-
// src/components/Variables/styles/VariableField.styles.ts
|
|
3483
|
-
init_emotion_jsx_shim();
|
|
3484
|
-
var import_react33 = require("@emotion/react");
|
|
3485
|
-
var labelText = import_react33.css`
|
|
3486
|
-
align-items: center;
|
|
3487
|
-
display: flex;
|
|
3488
|
-
gap: var(--spacing-xs);
|
|
3489
|
-
font-weight: var(--fw-regular);
|
|
3490
|
-
margin: 0 0 var(--spacing-xs);
|
|
3491
|
-
`;
|
|
3492
|
-
var variableBindButton = import_react33.css`
|
|
3493
|
-
align-items: center;
|
|
3494
|
-
border: none;
|
|
3495
|
-
border-radius: var(--rounded-base);
|
|
3496
|
-
background: none;
|
|
3497
|
-
display: flex;
|
|
3498
|
-
height: 1.2rem;
|
|
3499
|
-
padding: var(--spacing-2xs);
|
|
3500
|
-
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3501
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
3502
|
-
width: 1.2rem;
|
|
3503
|
-
|
|
3504
|
-
&:hover,
|
|
3505
|
-
&[aria-pressed='true']:not(:disabled) {
|
|
3506
|
-
background: var(--brand-secondary-3);
|
|
3507
|
-
color: var(--white);
|
|
3508
|
-
}
|
|
3509
|
-
|
|
3510
|
-
&[aria-disabled='true'] {
|
|
3511
|
-
background: none;
|
|
3512
|
-
color: currentColor;
|
|
3513
|
-
}
|
|
3514
|
-
`;
|
|
3986
|
+
// src/components/Variables/VariablesComposerVariableMenu.tsx
|
|
3987
|
+
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
3988
|
+
var VariablesComposerVariableMenu = (props) => {
|
|
3989
|
+
const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
|
|
3990
|
+
const onSelectVariable = (selectedVariable) => {
|
|
3991
|
+
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
3992
|
+
reference: selectedVariable.name
|
|
3993
|
+
});
|
|
3994
|
+
};
|
|
3995
|
+
const onResetVariable = () => {
|
|
3996
|
+
var _a;
|
|
3997
|
+
editor.dispatchCommand(import_lexical4.CLEAR_EDITOR_COMMAND, void 0);
|
|
3998
|
+
(_a = props.onResetVariables) == null ? void 0 : _a.call(props);
|
|
3999
|
+
};
|
|
4000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4001
|
+
SelectVariableMenu,
|
|
4002
|
+
{
|
|
4003
|
+
...props,
|
|
4004
|
+
onSelectVariable,
|
|
4005
|
+
onResetVariables: props.onResetVariables ? onResetVariable : void 0
|
|
4006
|
+
}
|
|
4007
|
+
);
|
|
4008
|
+
};
|
|
3515
4009
|
|
|
3516
4010
|
// src/components/Variables/VariableField.tsx
|
|
3517
|
-
var
|
|
4011
|
+
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
3518
4012
|
function VariableField({
|
|
3519
4013
|
label,
|
|
3520
4014
|
selectVariableMenuOptions,
|
|
@@ -3525,25 +4019,191 @@ function VariableField({
|
|
|
3525
4019
|
}) {
|
|
3526
4020
|
const { variables } = useVariables(true);
|
|
3527
4021
|
const varCount = Object.keys(variables).length;
|
|
3528
|
-
const variableSelector = varCount > 0 &&
|
|
3529
|
-
|
|
4022
|
+
const variableSelector = varCount > 0 && !disableVariables ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4023
|
+
VariablesComposerVariableMenu,
|
|
3530
4024
|
{
|
|
3531
4025
|
...selectVariableMenuOptions,
|
|
3532
4026
|
buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
3533
4027
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
3534
4028
|
}
|
|
3535
4029
|
) : null;
|
|
3536
|
-
return /* @__PURE__ */ (0,
|
|
3537
|
-
/* @__PURE__ */ (0,
|
|
4030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
4031
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { htmlFor: id, css: labelText, children: [
|
|
3538
4032
|
variableSelector,
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
4033
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label })
|
|
3540
4034
|
] }),
|
|
3541
4035
|
children
|
|
3542
4036
|
] });
|
|
3543
4037
|
}
|
|
3544
4038
|
|
|
4039
|
+
// src/components/Variables/VariablesComposer.tsx
|
|
4040
|
+
init_emotion_jsx_shim();
|
|
4041
|
+
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
4042
|
+
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
4043
|
+
var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
4044
|
+
var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
|
|
4045
|
+
var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
4046
|
+
var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
|
|
4047
|
+
var import_lexical6 = require("lexical");
|
|
4048
|
+
var import_react40 = require("react");
|
|
4049
|
+
var import_uuid2 = require("uuid");
|
|
4050
|
+
|
|
4051
|
+
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4052
|
+
init_emotion_jsx_shim();
|
|
4053
|
+
var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
|
|
4054
|
+
var import_react38 = require("react");
|
|
4055
|
+
function DisablePlugin({ disabled }) {
|
|
4056
|
+
const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
|
|
4057
|
+
(0, import_react38.useEffect)(() => {
|
|
4058
|
+
editor.setEditable(!disabled);
|
|
4059
|
+
}, [editor, disabled]);
|
|
4060
|
+
return null;
|
|
4061
|
+
}
|
|
4062
|
+
|
|
4063
|
+
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4064
|
+
init_emotion_jsx_shim();
|
|
4065
|
+
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
4066
|
+
var import_lexical5 = require("lexical");
|
|
4067
|
+
var import_react39 = require("react");
|
|
4068
|
+
function SingleLineTextPlugin() {
|
|
4069
|
+
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
4070
|
+
(0, import_react39.useEffect)(() => {
|
|
4071
|
+
editor.registerNodeTransform(import_lexical5.LineBreakNode, (node) => {
|
|
4072
|
+
node.remove();
|
|
4073
|
+
});
|
|
4074
|
+
}, [editor]);
|
|
4075
|
+
return null;
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
// src/components/Variables/VariablesComposer.tsx
|
|
4079
|
+
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4080
|
+
function VariablesComposer(props) {
|
|
4081
|
+
const { value, children, onChange, disabled, disableVariables, ...variablesPluginProps } = props;
|
|
4082
|
+
const [namespace] = (0, import_react40.useState)((0, import_uuid2.v4)());
|
|
4083
|
+
const [lastEmittedValue, setLastEmittedValue] = (0, import_react40.useState)(value);
|
|
4084
|
+
const editorConfig = (0, import_react40.useMemo)(
|
|
4085
|
+
() => ({
|
|
4086
|
+
namespace,
|
|
4087
|
+
onError(error) {
|
|
4088
|
+
throw error;
|
|
4089
|
+
},
|
|
4090
|
+
nodes: [VariableNode],
|
|
4091
|
+
editorState: deserializeEditorState(props.value)
|
|
4092
|
+
}),
|
|
4093
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4094
|
+
[namespace]
|
|
4095
|
+
);
|
|
4096
|
+
const editorState = (0, import_react40.useRef)();
|
|
4097
|
+
const updateTimeout = (0, import_react40.useRef)();
|
|
4098
|
+
if (typeof document === "undefined")
|
|
4099
|
+
return null;
|
|
4100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
|
|
4101
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4102
|
+
import_LexicalOnChangePlugin.OnChangePlugin,
|
|
4103
|
+
{
|
|
4104
|
+
onChange: (state) => {
|
|
4105
|
+
editorState.current = state;
|
|
4106
|
+
if (updateTimeout.current) {
|
|
4107
|
+
clearTimeout(updateTimeout.current);
|
|
4108
|
+
}
|
|
4109
|
+
setTimeout(() => {
|
|
4110
|
+
if (editorState.current) {
|
|
4111
|
+
const valueToEmit = serializeEditorState(editorState.current);
|
|
4112
|
+
if (valueToEmit !== lastEmittedValue) {
|
|
4113
|
+
setLastEmittedValue(valueToEmit);
|
|
4114
|
+
onChange(valueToEmit);
|
|
4115
|
+
}
|
|
4116
|
+
}
|
|
4117
|
+
}, 400);
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
),
|
|
4121
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SingleLineTextPlugin, {}),
|
|
4122
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_LexicalClearEditorPlugin.ClearEditorPlugin, {}),
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(VariablesPlugin, { ...variablesPluginProps }),
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DisablePlugin, { disabled }),
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children })
|
|
4126
|
+
] });
|
|
4127
|
+
}
|
|
4128
|
+
function VariablesComposerInput(props) {
|
|
4129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4130
|
+
import_LexicalPlainTextPlugin.PlainTextPlugin,
|
|
4131
|
+
{
|
|
4132
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_LexicalContentEditable.ContentEditable, { css: input, ...props }),
|
|
4133
|
+
placeholder: null,
|
|
4134
|
+
ErrorBoundary: import_LexicalErrorBoundary.default
|
|
4135
|
+
}
|
|
4136
|
+
) });
|
|
4137
|
+
}
|
|
4138
|
+
function deserializeEditorState(serialized) {
|
|
4139
|
+
const result = [];
|
|
4140
|
+
parseVariableExpression(serialized, (token, type) => {
|
|
4141
|
+
if (type === "text") {
|
|
4142
|
+
const node = {
|
|
4143
|
+
type: import_lexical6.TextNode.getType(),
|
|
4144
|
+
text: token,
|
|
4145
|
+
mode: "normal",
|
|
4146
|
+
version: 1,
|
|
4147
|
+
detail: 0,
|
|
4148
|
+
format: 0,
|
|
4149
|
+
style: ""
|
|
4150
|
+
};
|
|
4151
|
+
result.push(node);
|
|
4152
|
+
}
|
|
4153
|
+
if (type === "variable") {
|
|
4154
|
+
const node = {
|
|
4155
|
+
type: "variable",
|
|
4156
|
+
reference: token,
|
|
4157
|
+
version: 1
|
|
4158
|
+
};
|
|
4159
|
+
result.push(node);
|
|
4160
|
+
}
|
|
4161
|
+
});
|
|
4162
|
+
const rez = JSON.stringify({
|
|
4163
|
+
root: {
|
|
4164
|
+
children: [
|
|
4165
|
+
{
|
|
4166
|
+
children: result,
|
|
4167
|
+
direction: "ltr",
|
|
4168
|
+
format: "",
|
|
4169
|
+
indent: 0,
|
|
4170
|
+
type: "paragraph",
|
|
4171
|
+
version: 1
|
|
4172
|
+
}
|
|
4173
|
+
],
|
|
4174
|
+
direction: "ltr",
|
|
4175
|
+
format: "",
|
|
4176
|
+
indent: 0,
|
|
4177
|
+
type: "root",
|
|
4178
|
+
version: 1
|
|
4179
|
+
}
|
|
4180
|
+
});
|
|
4181
|
+
return rez;
|
|
4182
|
+
}
|
|
4183
|
+
function serializeEditorState(editorState) {
|
|
4184
|
+
const buf = [];
|
|
4185
|
+
serializeRecursive(editorState.toJSON().root, buf);
|
|
4186
|
+
return buf.join("");
|
|
4187
|
+
}
|
|
4188
|
+
function serializeRecursive(node, buffer) {
|
|
4189
|
+
if (node.type === import_lexical6.TextNode.getType()) {
|
|
4190
|
+
buffer.push(node.text.replace("${", "\\${"));
|
|
4191
|
+
}
|
|
4192
|
+
if (node.type === VariableNode.getType()) {
|
|
4193
|
+
buffer.push(`\${${node.reference}}`);
|
|
4194
|
+
}
|
|
4195
|
+
if (node.type === import_lexical6.LineBreakNode.getType()) {
|
|
4196
|
+
buffer.push("\n");
|
|
4197
|
+
}
|
|
4198
|
+
if ("children" in node && node.children) {
|
|
4199
|
+
for (const child of node.children) {
|
|
4200
|
+
serializeRecursive(child, buffer);
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
|
|
3545
4205
|
// src/components/Variables/InputVariables.tsx
|
|
3546
|
-
var
|
|
4206
|
+
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
3547
4207
|
function InputVariables({
|
|
3548
4208
|
id,
|
|
3549
4209
|
"aria-label": ariaLabel,
|
|
@@ -3551,99 +4211,60 @@ function InputVariables({
|
|
|
3551
4211
|
value,
|
|
3552
4212
|
disableVariables,
|
|
3553
4213
|
disableReset,
|
|
4214
|
+
enableEditingVariables,
|
|
3554
4215
|
disableInlineMenu,
|
|
3555
4216
|
onChange,
|
|
3556
|
-
|
|
4217
|
+
transformPaste,
|
|
3557
4218
|
showAddVariableMenuOption,
|
|
3558
4219
|
inputWhenNoVariables,
|
|
3559
4220
|
caption,
|
|
3560
4221
|
errorMessage,
|
|
3561
4222
|
warningMessage,
|
|
3562
4223
|
infoMessage,
|
|
3563
|
-
|
|
4224
|
+
"data-test-id": dataTestId
|
|
3564
4225
|
}) {
|
|
3565
|
-
var _a, _b;
|
|
3566
4226
|
const { variables } = useVariables(true);
|
|
3567
|
-
const
|
|
3568
|
-
const [finalId] = React11.useState(id != null ? id : () => (0, import_uuid2.v4)());
|
|
3569
|
-
const onPasteHandler = (e) => {
|
|
3570
|
-
var _a2, _b2, _c;
|
|
3571
|
-
if (!onPaste) {
|
|
3572
|
-
return;
|
|
3573
|
-
}
|
|
3574
|
-
const pastedValue = (_a2 = e.clipboardData) == null ? void 0 : _a2.getData("text/plain");
|
|
3575
|
-
if (!pastedValue || !e.currentTarget) {
|
|
3576
|
-
return;
|
|
3577
|
-
}
|
|
3578
|
-
const selectionStart = (_b2 = e.currentTarget.selectionStart) != null ? _b2 : 0;
|
|
3579
|
-
const selectionEnd = (_c = e.currentTarget.selectionEnd) != null ? _c : 0;
|
|
3580
|
-
const newValue = e.currentTarget.value.substring(0, selectionStart) + pastedValue + e.currentTarget.value.substring(selectionEnd);
|
|
3581
|
-
onPaste(newValue);
|
|
3582
|
-
e.preventDefault();
|
|
3583
|
-
};
|
|
3584
|
-
const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
|
|
3585
|
-
const forceMenu = value.substring(currentCursor - 2, currentCursor) === variablePrefix;
|
|
4227
|
+
const [finalId] = React11.useState(id != null ? id : () => (0, import_uuid3.v4)());
|
|
3586
4228
|
const hasVariablesInValue = getReferencedVariables(value).length > 0;
|
|
3587
4229
|
const [hadVariablesInValue, setHadVariablesInValue] = React11.useState(hasVariablesInValue);
|
|
3588
4230
|
React11.useEffect(() => {
|
|
3589
4231
|
if (hasVariablesInValue) {
|
|
3590
4232
|
setHadVariablesInValue(true);
|
|
3591
4233
|
}
|
|
3592
|
-
|
|
4234
|
+
if (!inputWhenNoVariables) {
|
|
4235
|
+
setHadVariablesInValue(hasVariablesInValue);
|
|
4236
|
+
}
|
|
4237
|
+
}, [hasVariablesInValue, inputWhenNoVariables]);
|
|
3593
4238
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
3594
4239
|
const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
|
|
3595
|
-
const
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
onChange(rawValue);
|
|
3609
|
-
};
|
|
3610
|
-
const sharedMenuProps = {
|
|
3611
|
-
onSelectVariable: handleInsertVariable,
|
|
3612
|
-
showAddVariableMenuOption,
|
|
3613
|
-
onResetVariables: hadVariablesInValue && !disableReset ? () => {
|
|
3614
|
-
handleSetValue("");
|
|
3615
|
-
setHadVariablesInValue(false);
|
|
3616
|
-
} : void 0
|
|
3617
|
-
};
|
|
3618
|
-
const input = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
3619
|
-
inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3620
|
-
InputVariablesShell,
|
|
4240
|
+
const disableResetForReals = disableReset || !inputWhenNoVariables || !hadVariablesInValue;
|
|
4241
|
+
const sharedMenuProps = (0, import_react41.useMemo)(
|
|
4242
|
+
() => ({
|
|
4243
|
+
showAddVariableMenuOption,
|
|
4244
|
+
onResetVariables: disableResetForReals ? void 0 : () => {
|
|
4245
|
+
setHadVariablesInValue(false);
|
|
4246
|
+
}
|
|
4247
|
+
}),
|
|
4248
|
+
[disableResetForReals, showAddVariableMenuOption]
|
|
4249
|
+
);
|
|
4250
|
+
const input2 = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
4251
|
+
inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InputVariablesMenu, { ...sharedMenuProps, disabled: disableInlineVariablesForReals, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4252
|
+
VariablesComposerInput,
|
|
3621
4253
|
{
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
import_design_system16.Input,
|
|
3627
|
-
{
|
|
3628
|
-
id: finalId,
|
|
3629
|
-
ref: inputRef,
|
|
3630
|
-
label: ariaLabel,
|
|
3631
|
-
showLabel: false,
|
|
3632
|
-
value,
|
|
3633
|
-
onChange: (e) => handleSetValue(e.currentTarget.value),
|
|
3634
|
-
onPaste: onPasteHandler,
|
|
3635
|
-
...inputProps
|
|
3636
|
-
}
|
|
3637
|
-
)
|
|
4254
|
+
id: finalId,
|
|
4255
|
+
"aria-label": ariaLabel,
|
|
4256
|
+
"data-testid": dataTestId,
|
|
4257
|
+
"data-text-value": value
|
|
3638
4258
|
}
|
|
3639
|
-
),
|
|
3640
|
-
caption ? /* @__PURE__ */ (0,
|
|
3641
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
3642
|
-
warningMessage ? /* @__PURE__ */ (0,
|
|
3643
|
-
infoMessage ? /* @__PURE__ */ (0,
|
|
4259
|
+
) }),
|
|
4260
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system18.Caption, { children: caption }) : null,
|
|
4261
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system18.ErrorMessage, { message: errorMessage }) : null,
|
|
4262
|
+
warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system18.WarningMessage, { message: warningMessage }) : null,
|
|
4263
|
+
infoMessage ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system18.InfoMessage, { message: infoMessage }) : null
|
|
3644
4264
|
] });
|
|
4265
|
+
let body = input2;
|
|
3645
4266
|
if (label) {
|
|
3646
|
-
|
|
4267
|
+
body = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3647
4268
|
VariableField,
|
|
3648
4269
|
{
|
|
3649
4270
|
label,
|
|
@@ -3651,36 +4272,56 @@ function InputVariables({
|
|
|
3651
4272
|
id: finalId,
|
|
3652
4273
|
isActive: hadVariablesInValue,
|
|
3653
4274
|
disableVariables: disableVariablesForReals,
|
|
3654
|
-
children:
|
|
4275
|
+
children: input2
|
|
3655
4276
|
}
|
|
3656
4277
|
);
|
|
3657
4278
|
}
|
|
3658
|
-
return
|
|
4279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
4280
|
+
VariablesComposer,
|
|
4281
|
+
{
|
|
4282
|
+
onChange,
|
|
4283
|
+
value,
|
|
4284
|
+
disableVariables: disableVariablesForReals,
|
|
4285
|
+
showAddVariableMenuOption,
|
|
4286
|
+
enableEditingVariables,
|
|
4287
|
+
children: [
|
|
4288
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PasteTransformerPlugin, { transformPaste }),
|
|
4289
|
+
body
|
|
4290
|
+
]
|
|
4291
|
+
}
|
|
4292
|
+
);
|
|
3659
4293
|
}
|
|
3660
|
-
function
|
|
4294
|
+
function InputVariablesMenu({
|
|
3661
4295
|
children,
|
|
3662
4296
|
disabled,
|
|
3663
4297
|
...props
|
|
3664
4298
|
}) {
|
|
3665
4299
|
if (disabled) {
|
|
3666
|
-
return /* @__PURE__ */ (0,
|
|
4300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
|
3667
4301
|
}
|
|
3668
|
-
return /* @__PURE__ */ (0,
|
|
4302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { css: menuContainer, children: [
|
|
3669
4303
|
children,
|
|
3670
|
-
/* @__PURE__ */ (0,
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4305
|
+
VariablesComposerVariableMenu,
|
|
4306
|
+
{
|
|
4307
|
+
...props,
|
|
4308
|
+
tip: "Tip: access this list by typing $",
|
|
4309
|
+
buttonCss: menuBtn
|
|
4310
|
+
}
|
|
4311
|
+
)
|
|
3671
4312
|
] });
|
|
3672
4313
|
}
|
|
3673
4314
|
|
|
3674
4315
|
// src/components/Variables/VariablesList.tsx
|
|
3675
4316
|
init_emotion_jsx_shim();
|
|
3676
|
-
var
|
|
3677
|
-
var
|
|
4317
|
+
var import_react43 = require("@emotion/react");
|
|
4318
|
+
var import_design_system19 = require("@uniformdev/design-system");
|
|
3678
4319
|
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
|
3679
4320
|
|
|
3680
4321
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
3681
4322
|
init_emotion_jsx_shim();
|
|
3682
|
-
var
|
|
3683
|
-
var tableRow = (isDragging) =>
|
|
4323
|
+
var import_react42 = require("@emotion/react");
|
|
4324
|
+
var tableRow = (isDragging) => import_react42.css`
|
|
3684
4325
|
position: relative;
|
|
3685
4326
|
${isDragging ? `
|
|
3686
4327
|
display: table;
|
|
@@ -3688,7 +4329,7 @@ var tableRow = (isDragging) => import_react34.css`
|
|
|
3688
4329
|
top: auto !important;
|
|
3689
4330
|
` : void 0}
|
|
3690
4331
|
`;
|
|
3691
|
-
var tableCellDragIcon =
|
|
4332
|
+
var tableCellDragIcon = import_react42.css`
|
|
3692
4333
|
&::after {
|
|
3693
4334
|
content: '';
|
|
3694
4335
|
display: block;
|
|
@@ -3706,7 +4347,7 @@ var tableCellDragIcon = import_react34.css`
|
|
|
3706
4347
|
opacity: 1;
|
|
3707
4348
|
}
|
|
3708
4349
|
`;
|
|
3709
|
-
var variableName =
|
|
4350
|
+
var variableName = import_react42.css`
|
|
3710
4351
|
border: none;
|
|
3711
4352
|
color: var(--brand-secondary-5);
|
|
3712
4353
|
font-weight: var(--fw-medium);
|
|
@@ -3717,7 +4358,7 @@ var variableName = import_react34.css`
|
|
|
3717
4358
|
white-space: nowrap;
|
|
3718
4359
|
max-width: 20ch;
|
|
3719
4360
|
`;
|
|
3720
|
-
var variableValue =
|
|
4361
|
+
var variableValue = import_react42.css`
|
|
3721
4362
|
overflow: hidden;
|
|
3722
4363
|
text-overflow: ellipsis;
|
|
3723
4364
|
white-space: nowrap;
|
|
@@ -3725,7 +4366,7 @@ var variableValue = import_react34.css`
|
|
|
3725
4366
|
`;
|
|
3726
4367
|
|
|
3727
4368
|
// src/components/Variables/VariablesList.tsx
|
|
3728
|
-
var
|
|
4369
|
+
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
3729
4370
|
function VariablesList() {
|
|
3730
4371
|
const { variables, dispatch } = useVariables();
|
|
3731
4372
|
const sorted = variablesToList(variables);
|
|
@@ -3746,24 +4387,24 @@ function VariablesList() {
|
|
|
3746
4387
|
return result;
|
|
3747
4388
|
}
|
|
3748
4389
|
};
|
|
3749
|
-
return /* @__PURE__ */ (0,
|
|
3750
|
-
/* @__PURE__ */ (0,
|
|
3751
|
-
/* @__PURE__ */ (0,
|
|
3752
|
-
/* @__PURE__ */ (0,
|
|
3753
|
-
/* @__PURE__ */ (0,
|
|
3754
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_beautiful_dnd2.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_beautiful_dnd2.Droppable, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_design_system19.Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_design_system19.TableRow, { children: [
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.TableCellHead, { children: "Name" }),
|
|
4394
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.TableCellHead, { children: "Default Value" }),
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.TableCellHead, {})
|
|
3755
4396
|
] }) }),
|
|
3756
|
-
/* @__PURE__ */ (0,
|
|
4397
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_design_system19.TableBody, { children: [
|
|
3757
4398
|
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
3758
4399
|
const text = displayName != null ? displayName : name;
|
|
3759
|
-
return /* @__PURE__ */ (0,
|
|
4400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3760
4401
|
import_react_beautiful_dnd2.Draggable,
|
|
3761
4402
|
{
|
|
3762
4403
|
draggableId: name,
|
|
3763
4404
|
index,
|
|
3764
4405
|
isDragDisabled: sorted.length === 1,
|
|
3765
|
-
children: (provided2, snapshot) => /* @__PURE__ */ (0,
|
|
3766
|
-
|
|
4406
|
+
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4407
|
+
import_design_system19.TableRow,
|
|
3767
4408
|
{
|
|
3768
4409
|
ref: provided2.innerRef,
|
|
3769
4410
|
...provided2.dragHandleProps,
|
|
@@ -3772,7 +4413,7 @@ function VariablesList() {
|
|
|
3772
4413
|
css: tableRow(snapshot.isDragging),
|
|
3773
4414
|
"data-dragging": snapshot.isDragging,
|
|
3774
4415
|
children: [
|
|
3775
|
-
/* @__PURE__ */ (0,
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3776
4417
|
"button",
|
|
3777
4418
|
{
|
|
3778
4419
|
css: variableName,
|
|
@@ -3785,21 +4426,21 @@ function VariablesList() {
|
|
|
3785
4426
|
children: text
|
|
3786
4427
|
}
|
|
3787
4428
|
) }),
|
|
3788
|
-
/* @__PURE__ */ (0,
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
4429
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.TableCellData, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
|
|
4430
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.TableCellData, { align: "right", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3790
4431
|
"button",
|
|
3791
4432
|
{
|
|
3792
4433
|
type: "button",
|
|
3793
4434
|
title: `delete ${text}`,
|
|
3794
4435
|
css: [
|
|
3795
|
-
|
|
3796
|
-
|
|
4436
|
+
import_design_system19.button,
|
|
4437
|
+
import_react43.css`
|
|
3797
4438
|
background: transparent;
|
|
3798
4439
|
`
|
|
3799
4440
|
],
|
|
3800
4441
|
"aria-controls": text,
|
|
3801
4442
|
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
3802
|
-
children: /* @__PURE__ */ (0,
|
|
4443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_design_system19.Icon, { icon: "trash", iconColor: "red" })
|
|
3803
4444
|
}
|
|
3804
4445
|
) })
|
|
3805
4446
|
]
|
|
@@ -3812,8 +4453,8 @@ function VariablesList() {
|
|
|
3812
4453
|
provided.placeholder
|
|
3813
4454
|
] })
|
|
3814
4455
|
] }) }) }),
|
|
3815
|
-
/* @__PURE__ */ (0,
|
|
3816
|
-
|
|
4456
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4457
|
+
import_design_system19.AddListButton,
|
|
3817
4458
|
{
|
|
3818
4459
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
3819
4460
|
"aria-label": "Add variable",
|
|
@@ -3826,49 +4467,36 @@ function VariablesList() {
|
|
|
3826
4467
|
}
|
|
3827
4468
|
|
|
3828
4469
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
3829
|
-
var
|
|
4470
|
+
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
3830
4471
|
function DataResourceDynamicInputProvider({
|
|
3831
4472
|
children,
|
|
3832
4473
|
dynamicInputs
|
|
3833
4474
|
}) {
|
|
3834
4475
|
if (dynamicInputs) {
|
|
3835
|
-
return /* @__PURE__ */ (0,
|
|
4476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DataResourceDynamicInputProviderRenderer, { dynamicInputs, children });
|
|
3836
4477
|
}
|
|
3837
|
-
return /* @__PURE__ */ (0,
|
|
4478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DataResourceDynamicInputProviderContextShim, { children });
|
|
3838
4479
|
}
|
|
3839
4480
|
function DataResourceDynamicInputProviderContextShim(props) {
|
|
3840
4481
|
const {
|
|
3841
4482
|
metadata: { dynamicInputs }
|
|
3842
4483
|
} = useMeshLocation("dataResource");
|
|
3843
|
-
return /* @__PURE__ */ (0,
|
|
4484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
|
|
3844
4485
|
}
|
|
3845
4486
|
function DataResourceDynamicInputProviderRenderer({
|
|
3846
4487
|
children,
|
|
3847
4488
|
dynamicInputs
|
|
3848
4489
|
}) {
|
|
3849
|
-
return /* @__PURE__ */ (0,
|
|
3850
|
-
VariablesProvider,
|
|
3851
|
-
{
|
|
3852
|
-
value: convertDynamicInputsToVariables(dynamicInputs),
|
|
3853
|
-
onChange: () => {
|
|
3854
|
-
throw new Error("Cannot change dynamic inputs. Make sure that add variable is disabled.");
|
|
3855
|
-
},
|
|
3856
|
-
editVariableComponent: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Cannot edit dynamic inputs." }),
|
|
3857
|
-
children
|
|
3858
|
-
}
|
|
3859
|
-
);
|
|
4490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(VariablesProvider, { value: convertDynamicInputsToVariables(dynamicInputs), readOnly: true, children });
|
|
3860
4491
|
}
|
|
3861
4492
|
function convertDynamicInputsToVariables(dynamicInputs) {
|
|
3862
4493
|
return Object.entries(dynamicInputs).reduce(
|
|
3863
|
-
(acc, [name,
|
|
4494
|
+
(acc, [name, input2]) => {
|
|
3864
4495
|
acc[name] = {
|
|
3865
|
-
type:
|
|
3866
|
-
default:
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
", from ",
|
|
3870
|
-
input.type === "path" ? "URL path" : "query string"
|
|
3871
|
-
] })
|
|
4496
|
+
type: input2.type,
|
|
4497
|
+
default: input2.value,
|
|
4498
|
+
source: `from ${input2.type === "path" ? "URL path" : "query string"}`,
|
|
4499
|
+
helpText: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: input2.value || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("em", { children: "not provided" }) })
|
|
3872
4500
|
// type abuse! 💚
|
|
3873
4501
|
};
|
|
3874
4502
|
return acc;
|
|
@@ -3879,14 +4507,14 @@ function convertDynamicInputsToVariables(dynamicInputs) {
|
|
|
3879
4507
|
|
|
3880
4508
|
// src/components/DataResourceVariablesList.tsx
|
|
3881
4509
|
init_emotion_jsx_shim();
|
|
3882
|
-
var
|
|
3883
|
-
var
|
|
4510
|
+
var import_design_system20 = require("@uniformdev/design-system");
|
|
4511
|
+
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
3884
4512
|
function DataResourceVariablesList(props) {
|
|
3885
4513
|
const {
|
|
3886
4514
|
value,
|
|
3887
4515
|
metadata: { dataType, dynamicInputs }
|
|
3888
4516
|
} = useMeshLocation("dataResource");
|
|
3889
|
-
return /* @__PURE__ */ (0,
|
|
4517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3890
4518
|
DataResourceVariablesListExplicit,
|
|
3891
4519
|
{
|
|
3892
4520
|
...props,
|
|
@@ -3907,14 +4535,14 @@ function DataResourceVariablesListExplicit({
|
|
|
3907
4535
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
3908
4536
|
if (variableDefinitions.length === 0) {
|
|
3909
4537
|
if (NoVariablesComponent) {
|
|
3910
|
-
return /* @__PURE__ */ (0,
|
|
4538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(NoVariablesComponent, {});
|
|
3911
4539
|
}
|
|
3912
|
-
return /* @__PURE__ */ (0,
|
|
4540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system20.Callout, { type: "note", children: "No settings are required." });
|
|
3913
4541
|
}
|
|
3914
|
-
return /* @__PURE__ */ (0,
|
|
4542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: variableDefinitions.map((variableDefinition) => {
|
|
3915
4543
|
var _a, _b, _c;
|
|
3916
4544
|
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
3917
|
-
return /* @__PURE__ */ (0,
|
|
4545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3918
4546
|
VariableRenderer,
|
|
3919
4547
|
{
|
|
3920
4548
|
definition: variableDefinition,
|
|
@@ -3937,7 +4565,7 @@ function DataResourceVariablesListExplicit({
|
|
|
3937
4565
|
}
|
|
3938
4566
|
function TextVariableRenderer({ definition, value, setValue }) {
|
|
3939
4567
|
var _a;
|
|
3940
|
-
return /* @__PURE__ */ (0,
|
|
4568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3941
4569
|
InputVariables,
|
|
3942
4570
|
{
|
|
3943
4571
|
label: definition.displayName || definition.name,
|
|
@@ -3953,14 +4581,14 @@ init_emotion_jsx_shim();
|
|
|
3953
4581
|
|
|
3954
4582
|
// src/components/Request/RequestBody.tsx
|
|
3955
4583
|
init_emotion_jsx_shim();
|
|
3956
|
-
var
|
|
3957
|
-
var
|
|
3958
|
-
var
|
|
4584
|
+
var import_react45 = require("@emotion/react");
|
|
4585
|
+
var import_design_system21 = require("@uniformdev/design-system");
|
|
4586
|
+
var import_react46 = require("react");
|
|
3959
4587
|
|
|
3960
4588
|
// src/components/Request/RequestProvider.tsx
|
|
3961
4589
|
init_emotion_jsx_shim();
|
|
3962
4590
|
var React12 = __toESM(require("react"));
|
|
3963
|
-
var
|
|
4591
|
+
var import_jsx_runtime40 = require("@emotion/react/jsx-runtime");
|
|
3964
4592
|
var RequestContext = React12.createContext(null);
|
|
3965
4593
|
function RequestProvider({ value, onChange, children }) {
|
|
3966
4594
|
const contextValue = React12.useMemo(() => {
|
|
@@ -4029,7 +4657,7 @@ function RequestProvider({ value, onChange, children }) {
|
|
|
4029
4657
|
request: value
|
|
4030
4658
|
};
|
|
4031
4659
|
}, [onChange, value]);
|
|
4032
|
-
return /* @__PURE__ */ (0,
|
|
4660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RequestContext.Provider, { value: contextValue, children });
|
|
4033
4661
|
}
|
|
4034
4662
|
function useRequest() {
|
|
4035
4663
|
const context = React12.useContext(RequestContext);
|
|
@@ -4044,11 +4672,11 @@ init_emotion_jsx_shim();
|
|
|
4044
4672
|
|
|
4045
4673
|
// src/components/Request/styles/Request.styles.ts
|
|
4046
4674
|
init_emotion_jsx_shim();
|
|
4047
|
-
var
|
|
4048
|
-
var innerContentStyles =
|
|
4675
|
+
var import_react44 = require("@emotion/react");
|
|
4676
|
+
var innerContentStyles = import_react44.css`
|
|
4049
4677
|
background: var(--white);
|
|
4050
4678
|
`;
|
|
4051
|
-
var requestTypeContainer = (bgColor) =>
|
|
4679
|
+
var requestTypeContainer = (bgColor) => import_react44.css`
|
|
4052
4680
|
align-items: start;
|
|
4053
4681
|
background: ${bgColor};
|
|
4054
4682
|
display: grid;
|
|
@@ -4057,17 +4685,17 @@ var requestTypeContainer = (bgColor) => import_react36.css`
|
|
|
4057
4685
|
`;
|
|
4058
4686
|
|
|
4059
4687
|
// src/components/Request/RequestTypeContainer.tsx
|
|
4060
|
-
var
|
|
4688
|
+
var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
|
|
4061
4689
|
var RequestTypeContainer = ({
|
|
4062
4690
|
bgColor = "transparent",
|
|
4063
4691
|
children,
|
|
4064
4692
|
...props
|
|
4065
4693
|
}) => {
|
|
4066
|
-
return /* @__PURE__ */ (0,
|
|
4694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: requestTypeContainer(bgColor), ...props, children });
|
|
4067
4695
|
};
|
|
4068
4696
|
|
|
4069
4697
|
// src/components/Request/RequestBody.tsx
|
|
4070
|
-
var
|
|
4698
|
+
var import_jsx_runtime42 = require("@emotion/react/jsx-runtime");
|
|
4071
4699
|
var LANGUAGE_OPTIONS = [
|
|
4072
4700
|
{ label: "Text", value: "plaintext" },
|
|
4073
4701
|
{ label: "JSON", value: "json" },
|
|
@@ -4086,23 +4714,23 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
4086
4714
|
};
|
|
4087
4715
|
function RequestBody() {
|
|
4088
4716
|
const { request, dispatch } = useRequest();
|
|
4089
|
-
const [language, setLanguage] = (0,
|
|
4090
|
-
return /* @__PURE__ */ (0,
|
|
4717
|
+
const [language, setLanguage] = (0, import_react46.useState)("json");
|
|
4718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4091
4719
|
"div",
|
|
4092
4720
|
{
|
|
4093
|
-
css:
|
|
4721
|
+
css: import_react45.css`
|
|
4094
4722
|
background: var(--white);
|
|
4095
4723
|
`,
|
|
4096
4724
|
children: [
|
|
4097
|
-
/* @__PURE__ */ (0,
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4098
4726
|
RequestTypeContainer,
|
|
4099
4727
|
{
|
|
4100
4728
|
bgColor: "var(--gray-100)",
|
|
4101
|
-
css:
|
|
4729
|
+
css: import_react45.css`
|
|
4102
4730
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
4103
4731
|
`,
|
|
4104
|
-
children: /* @__PURE__ */ (0,
|
|
4105
|
-
|
|
4732
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4733
|
+
import_design_system21.InputSelect,
|
|
4106
4734
|
{
|
|
4107
4735
|
label: "Language",
|
|
4108
4736
|
showLabel: false,
|
|
@@ -4124,8 +4752,8 @@ function RequestBody() {
|
|
|
4124
4752
|
)
|
|
4125
4753
|
}
|
|
4126
4754
|
),
|
|
4127
|
-
/* @__PURE__ */ (0,
|
|
4128
|
-
|
|
4755
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4756
|
+
import_design_system21.JsonEditor,
|
|
4129
4757
|
{
|
|
4130
4758
|
height: 200,
|
|
4131
4759
|
defaultValue: request.body,
|
|
@@ -4143,8 +4771,8 @@ function RequestBody() {
|
|
|
4143
4771
|
|
|
4144
4772
|
// src/components/Request/RequestHeaders.tsx
|
|
4145
4773
|
init_emotion_jsx_shim();
|
|
4146
|
-
var
|
|
4147
|
-
var
|
|
4774
|
+
var import_design_system22 = require("@uniformdev/design-system");
|
|
4775
|
+
var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
|
|
4148
4776
|
function RequestHeaders({ disableVariables }) {
|
|
4149
4777
|
var _a, _b;
|
|
4150
4778
|
const { dispatch, request } = useRequest();
|
|
@@ -4160,29 +4788,29 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4160
4788
|
index
|
|
4161
4789
|
});
|
|
4162
4790
|
};
|
|
4163
|
-
return /* @__PURE__ */ (0,
|
|
4164
|
-
/* @__PURE__ */ (0,
|
|
4165
|
-
/* @__PURE__ */ (0,
|
|
4166
|
-
/* @__PURE__ */ (0,
|
|
4791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system22.Table, { children: [
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system22.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system22.TableRow, { children: [
|
|
4793
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system22.TableCellHead, { children: "Name" }),
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system22.TableCellHead, { children: "Value" })
|
|
4167
4795
|
] }) }),
|
|
4168
|
-
/* @__PURE__ */ (0,
|
|
4796
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system22.TableBody, { children: [
|
|
4169
4797
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
|
|
4170
|
-
return /* @__PURE__ */ (0,
|
|
4171
|
-
/* @__PURE__ */ (0,
|
|
4798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system22.TableRow, { children: [
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system22.TableCellData, { width: "50%", children: [
|
|
4172
4800
|
baseHeader.key,
|
|
4173
|
-
/* @__PURE__ */ (0,
|
|
4174
|
-
/* @__PURE__ */ (0,
|
|
4801
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("br", {}),
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("small", { children: "from data source" }) })
|
|
4175
4803
|
] }),
|
|
4176
|
-
/* @__PURE__ */ (0,
|
|
4177
|
-
/* @__PURE__ */ (0,
|
|
4178
|
-
request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ (0,
|
|
4804
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system22.TableCellData, { width: "50%", children: [
|
|
4805
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
|
|
4806
|
+
request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system22.WarningMessage, { message: "overridden below" }) : null
|
|
4179
4807
|
] })
|
|
4180
4808
|
] }, baseHeader.key);
|
|
4181
4809
|
}),
|
|
4182
4810
|
deezHeaders.map((header, index) => {
|
|
4183
|
-
return /* @__PURE__ */ (0,
|
|
4184
|
-
/* @__PURE__ */ (0,
|
|
4185
|
-
|
|
4811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system22.TableRow, { children: [
|
|
4812
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system22.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4813
|
+
import_design_system22.Input,
|
|
4186
4814
|
{
|
|
4187
4815
|
label: header.key,
|
|
4188
4816
|
value: header.key,
|
|
@@ -4201,13 +4829,14 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4201
4829
|
"data-test-id": "header-key"
|
|
4202
4830
|
}
|
|
4203
4831
|
) }),
|
|
4204
|
-
/* @__PURE__ */ (0,
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system22.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4205
4833
|
InputVariables,
|
|
4206
4834
|
{
|
|
4207
4835
|
value: header.value,
|
|
4208
4836
|
onChange: (value) => handleUpdateParamFromMenu({ key: header.key, value, index }),
|
|
4209
4837
|
disableVariables,
|
|
4210
4838
|
showAddVariableMenuOption: true,
|
|
4839
|
+
enableEditingVariables: true,
|
|
4211
4840
|
"data-test-id": "header-value"
|
|
4212
4841
|
}
|
|
4213
4842
|
) : null })
|
|
@@ -4219,13 +4848,13 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4219
4848
|
|
|
4220
4849
|
// src/components/Request/RequestMethodSelect.tsx
|
|
4221
4850
|
init_emotion_jsx_shim();
|
|
4222
|
-
var
|
|
4223
|
-
var
|
|
4851
|
+
var import_design_system23 = require("@uniformdev/design-system");
|
|
4852
|
+
var import_jsx_runtime44 = require("@emotion/react/jsx-runtime");
|
|
4224
4853
|
function RequestMethodSelect(props) {
|
|
4225
4854
|
var _a;
|
|
4226
4855
|
const { request, dispatch } = useRequest();
|
|
4227
|
-
return /* @__PURE__ */ (0,
|
|
4228
|
-
|
|
4856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4857
|
+
import_design_system23.InputSelect,
|
|
4229
4858
|
{
|
|
4230
4859
|
...props,
|
|
4231
4860
|
options: [
|
|
@@ -4241,8 +4870,8 @@ function RequestMethodSelect(props) {
|
|
|
4241
4870
|
|
|
4242
4871
|
// src/components/Request/RequestParameters.tsx
|
|
4243
4872
|
init_emotion_jsx_shim();
|
|
4244
|
-
var
|
|
4245
|
-
var
|
|
4873
|
+
var import_design_system24 = require("@uniformdev/design-system");
|
|
4874
|
+
var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
|
|
4246
4875
|
function RequestParameters({ disableVariables }) {
|
|
4247
4876
|
var _a, _b;
|
|
4248
4877
|
const { dispatch, request } = useRequest();
|
|
@@ -4258,29 +4887,29 @@ function RequestParameters({ disableVariables }) {
|
|
|
4258
4887
|
index
|
|
4259
4888
|
});
|
|
4260
4889
|
};
|
|
4261
|
-
return /* @__PURE__ */ (0,
|
|
4262
|
-
/* @__PURE__ */ (0,
|
|
4263
|
-
/* @__PURE__ */ (0,
|
|
4264
|
-
/* @__PURE__ */ (0,
|
|
4890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.Table, { children: [
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.TableRow, { children: [
|
|
4892
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.TableCellHead, { children: "Name" }),
|
|
4893
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.TableCellHead, { children: "Value" })
|
|
4265
4894
|
] }) }),
|
|
4266
|
-
/* @__PURE__ */ (0,
|
|
4895
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.TableBody, { children: [
|
|
4267
4896
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
|
|
4268
|
-
return /* @__PURE__ */ (0,
|
|
4269
|
-
/* @__PURE__ */ (0,
|
|
4897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.TableRow, { children: [
|
|
4898
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.TableCellData, { width: "50%", children: [
|
|
4270
4899
|
baseParameter.key,
|
|
4271
|
-
/* @__PURE__ */ (0,
|
|
4272
|
-
/* @__PURE__ */ (0,
|
|
4900
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("br", {}),
|
|
4901
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("small", { children: "from data source" }) })
|
|
4273
4902
|
] }),
|
|
4274
|
-
/* @__PURE__ */ (0,
|
|
4275
|
-
/* @__PURE__ */ (0,
|
|
4276
|
-
request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ (0,
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.TableCellData, { width: "50%", children: [
|
|
4904
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
|
|
4905
|
+
request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.WarningMessage, { message: "overridden below" }) : null
|
|
4277
4906
|
] })
|
|
4278
4907
|
] }, baseParameter.key);
|
|
4279
4908
|
}),
|
|
4280
4909
|
deezParameters.map((parameter, index) => {
|
|
4281
|
-
return /* @__PURE__ */ (0,
|
|
4282
|
-
/* @__PURE__ */ (0,
|
|
4283
|
-
|
|
4910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.TableRow, { children: [
|
|
4911
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4912
|
+
import_design_system24.Input,
|
|
4284
4913
|
{
|
|
4285
4914
|
label: parameter.key,
|
|
4286
4915
|
value: parameter.key,
|
|
@@ -4299,7 +4928,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
4299
4928
|
"data-test-id": "parameter-key"
|
|
4300
4929
|
}
|
|
4301
4930
|
) }),
|
|
4302
|
-
/* @__PURE__ */ (0,
|
|
4931
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4303
4932
|
InputVariables,
|
|
4304
4933
|
{
|
|
4305
4934
|
value: parameter.value,
|
|
@@ -4310,7 +4939,8 @@ function RequestParameters({ disableVariables }) {
|
|
|
4310
4939
|
}),
|
|
4311
4940
|
disableVariables,
|
|
4312
4941
|
"data-test-id": "parameter-value",
|
|
4313
|
-
showAddVariableMenuOption: true
|
|
4942
|
+
showAddVariableMenuOption: true,
|
|
4943
|
+
enableEditingVariables: true
|
|
4314
4944
|
}
|
|
4315
4945
|
) : null })
|
|
4316
4946
|
] }, index);
|
|
@@ -4321,8 +4951,8 @@ function RequestParameters({ disableVariables }) {
|
|
|
4321
4951
|
|
|
4322
4952
|
// src/components/Request/RequestUrl.tsx
|
|
4323
4953
|
init_emotion_jsx_shim();
|
|
4324
|
-
var
|
|
4325
|
-
var
|
|
4954
|
+
var import_react47 = require("@emotion/react");
|
|
4955
|
+
var import_react48 = require("react");
|
|
4326
4956
|
|
|
4327
4957
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
4328
4958
|
init_emotion_jsx_shim();
|
|
@@ -4344,35 +4974,35 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
|
|
|
4344
4974
|
}
|
|
4345
4975
|
|
|
4346
4976
|
// src/components/Request/RequestUrl.tsx
|
|
4347
|
-
var
|
|
4977
|
+
var import_jsx_runtime46 = require("@emotion/react/jsx-runtime");
|
|
4348
4978
|
function RequestUrl() {
|
|
4349
4979
|
var _a, _b;
|
|
4350
4980
|
const { variables } = useVariables();
|
|
4351
4981
|
const { request } = useRequest();
|
|
4352
|
-
const mergedParameters = (0,
|
|
4982
|
+
const mergedParameters = (0, import_react48.useMemo)(() => {
|
|
4353
4983
|
var _a2;
|
|
4354
4984
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
4355
4985
|
return request.parameters;
|
|
4356
4986
|
}
|
|
4357
4987
|
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p2) => p2.key === baseParam.key)).concat(request.parameters);
|
|
4358
4988
|
}, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
|
|
4359
|
-
return /* @__PURE__ */ (0,
|
|
4989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
4360
4990
|
"small",
|
|
4361
4991
|
{
|
|
4362
|
-
css:
|
|
4992
|
+
css: import_react47.css`
|
|
4363
4993
|
display: inline-block;
|
|
4364
4994
|
margin-bottom: var(--spacing-xs);
|
|
4365
4995
|
word-break: break-word;
|
|
4366
4996
|
`,
|
|
4367
4997
|
children: [
|
|
4368
|
-
request.baseRequest ? /* @__PURE__ */ (0,
|
|
4369
|
-
/* @__PURE__ */ (0,
|
|
4998
|
+
request.baseRequest ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
|
|
4999
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
|
|
4370
5000
|
urlEncodeRequestUrl(request.relativeUrl, variables),
|
|
4371
|
-
mergedParameters.length > 0 ? /* @__PURE__ */ (0,
|
|
5001
|
+
mergedParameters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
4372
5002
|
"?",
|
|
4373
5003
|
mergedParameters.map((param, index) => {
|
|
4374
5004
|
const encoded = urlEncodeRequestParameter(param, variables);
|
|
4375
|
-
return /* @__PURE__ */ (0,
|
|
5005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { children: [
|
|
4376
5006
|
index > 0 ? "&" : null,
|
|
4377
5007
|
encoded.key,
|
|
4378
5008
|
"=",
|
|
@@ -4389,9 +5019,9 @@ function RequestUrl() {
|
|
|
4389
5019
|
// src/components/Request/RequestUrlInput.tsx
|
|
4390
5020
|
init_emotion_jsx_shim();
|
|
4391
5021
|
|
|
4392
|
-
// src/components/Request/util/
|
|
5022
|
+
// src/components/Request/util/transformPastedUrl.ts
|
|
4393
5023
|
init_emotion_jsx_shim();
|
|
4394
|
-
function
|
|
5024
|
+
function transformPastedUrl(value, currentRequest, dispatch) {
|
|
4395
5025
|
var _a, _b, _c;
|
|
4396
5026
|
const indexOfQueryString = value.indexOf("?");
|
|
4397
5027
|
const hasQueryString = indexOfQueryString >= 0;
|
|
@@ -4399,7 +5029,6 @@ function handlePastedUrl(value, currentRequest, dispatch) {
|
|
|
4399
5029
|
if (((_a = currentRequest.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = currentRequest.baseRequest) == null ? void 0 : _b.baseUrl)) {
|
|
4400
5030
|
relativeUrl = relativeUrl.substring((_c = currentRequest.baseRequest) == null ? void 0 : _c.baseUrl.length);
|
|
4401
5031
|
}
|
|
4402
|
-
dispatch({ type: "setRelativeUrl", relativeUrl });
|
|
4403
5032
|
if (hasQueryString) {
|
|
4404
5033
|
for (let index = currentRequest.parameters.length - 1; index >= 0; index--) {
|
|
4405
5034
|
dispatch({ type: "removeParameter", index });
|
|
@@ -4412,25 +5041,24 @@ function handlePastedUrl(value, currentRequest, dispatch) {
|
|
|
4412
5041
|
} catch (e) {
|
|
4413
5042
|
}
|
|
4414
5043
|
}
|
|
5044
|
+
return relativeUrl;
|
|
4415
5045
|
}
|
|
4416
5046
|
|
|
4417
5047
|
// src/components/Request/RequestUrlInput.tsx
|
|
4418
|
-
var
|
|
5048
|
+
var import_jsx_runtime47 = require("@emotion/react/jsx-runtime");
|
|
4419
5049
|
function RequestUrlInput(props) {
|
|
4420
5050
|
const { request, dispatch } = useRequest();
|
|
4421
|
-
return /* @__PURE__ */ (0,
|
|
5051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4422
5052
|
InputVariables,
|
|
4423
5053
|
{
|
|
4424
|
-
disableReset: true,
|
|
4425
5054
|
...props,
|
|
4426
5055
|
value: request.relativeUrl,
|
|
4427
|
-
|
|
4428
|
-
handlePastedUrl(value, request, dispatch);
|
|
4429
|
-
},
|
|
5056
|
+
transformPaste: (value) => transformPastedUrl(value, request, dispatch),
|
|
4430
5057
|
onChange: (value) => {
|
|
4431
5058
|
dispatch({ type: "setRelativeUrl", relativeUrl: value });
|
|
4432
5059
|
},
|
|
4433
5060
|
showAddVariableMenuOption: true,
|
|
5061
|
+
enableEditingVariables: true,
|
|
4434
5062
|
"data-test-id": "field-url"
|
|
4435
5063
|
}
|
|
4436
5064
|
);
|
|
@@ -4473,18 +5101,19 @@ function useRequestParameter(paramName) {
|
|
|
4473
5101
|
}
|
|
4474
5102
|
|
|
4475
5103
|
// src/components/DataSourceEditor.tsx
|
|
4476
|
-
var
|
|
5104
|
+
var import_jsx_runtime48 = require("@emotion/react/jsx-runtime");
|
|
4477
5105
|
function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
4478
5106
|
var _a;
|
|
4479
5107
|
const { value } = useMeshLocation("dataSource");
|
|
4480
5108
|
const currentRequestValue = convertDataSourceToRequestData(value);
|
|
4481
|
-
return /* @__PURE__ */ (0,
|
|
5109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4482
5110
|
VariablesProvider,
|
|
4483
5111
|
{
|
|
4484
5112
|
value: (_a = value.variables) != null ? _a : {},
|
|
4485
5113
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
4486
5114
|
editVariableComponent,
|
|
4487
|
-
|
|
5115
|
+
readOnly: true,
|
|
5116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4488
5117
|
RequestProvider,
|
|
4489
5118
|
{
|
|
4490
5119
|
value: currentRequestValue,
|
|
@@ -4522,21 +5151,23 @@ function convertRequestDataToDataSource(dataSource, requestData) {
|
|
|
4522
5151
|
|
|
4523
5152
|
// src/components/DataTypeEditor.tsx
|
|
4524
5153
|
init_emotion_jsx_shim();
|
|
4525
|
-
var
|
|
5154
|
+
var import_jsx_runtime49 = require("@emotion/react/jsx-runtime");
|
|
4526
5155
|
function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
4527
5156
|
var _a;
|
|
4528
5157
|
const {
|
|
4529
5158
|
value,
|
|
4530
|
-
metadata: { dataSource }
|
|
5159
|
+
metadata: { dataSource },
|
|
5160
|
+
isReadOnly
|
|
4531
5161
|
} = useMeshLocation("dataType");
|
|
4532
5162
|
const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
|
|
4533
|
-
return /* @__PURE__ */ (0,
|
|
5163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4534
5164
|
VariablesProvider,
|
|
4535
5165
|
{
|
|
4536
5166
|
value: (_a = value.variables) != null ? _a : {},
|
|
4537
5167
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
4538
5168
|
editVariableComponent,
|
|
4539
|
-
|
|
5169
|
+
readOnly: isReadOnly,
|
|
5170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4540
5171
|
RequestProvider,
|
|
4541
5172
|
{
|
|
4542
5173
|
value: currentRequestValue,
|
|
@@ -4583,17 +5214,17 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
4583
5214
|
|
|
4584
5215
|
// src/components/MeshApp.tsx
|
|
4585
5216
|
init_emotion_jsx_shim();
|
|
4586
|
-
var
|
|
5217
|
+
var import_design_system25 = require("@uniformdev/design-system");
|
|
4587
5218
|
|
|
4588
5219
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
4589
5220
|
init_emotion_jsx_shim();
|
|
4590
5221
|
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
4591
|
-
var
|
|
5222
|
+
var import_react49 = require("react");
|
|
4592
5223
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
4593
|
-
const [error, setError] = (0,
|
|
4594
|
-
const [sdk, setSdk] = (0,
|
|
4595
|
-
const initializationInProgress = (0,
|
|
4596
|
-
(0,
|
|
5224
|
+
const [error, setError] = (0, import_react49.useState)();
|
|
5225
|
+
const [sdk, setSdk] = (0, import_react49.useState)();
|
|
5226
|
+
const initializationInProgress = (0, import_react49.useRef)(false);
|
|
5227
|
+
(0, import_react49.useEffect)(
|
|
4597
5228
|
() => {
|
|
4598
5229
|
if (typeof window === "undefined" || sdk) {
|
|
4599
5230
|
return;
|
|
@@ -4626,7 +5257,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
4626
5257
|
};
|
|
4627
5258
|
|
|
4628
5259
|
// src/components/MeshApp.tsx
|
|
4629
|
-
var
|
|
5260
|
+
var import_jsx_runtime50 = require("@emotion/react/jsx-runtime");
|
|
4630
5261
|
var MeshApp = ({
|
|
4631
5262
|
children,
|
|
4632
5263
|
loadingComponent,
|
|
@@ -4635,37 +5266,37 @@ var MeshApp = ({
|
|
|
4635
5266
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
4636
5267
|
if (initializing || !sdk) {
|
|
4637
5268
|
const LoadingComponent = loadingComponent;
|
|
4638
|
-
return LoadingComponent ? /* @__PURE__ */ (0,
|
|
5269
|
+
return LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LoadingComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system25.LoadingIndicator, {});
|
|
4639
5270
|
}
|
|
4640
5271
|
if (error) {
|
|
4641
5272
|
const ErrorComponent = errorComponent;
|
|
4642
5273
|
if (ErrorComponent) {
|
|
4643
|
-
return /* @__PURE__ */ (0,
|
|
5274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ErrorComponent, { error });
|
|
4644
5275
|
}
|
|
4645
5276
|
throw error;
|
|
4646
5277
|
}
|
|
4647
|
-
return /* @__PURE__ */ (0,
|
|
4648
|
-
/* @__PURE__ */ (0,
|
|
4649
|
-
/* @__PURE__ */ (0,
|
|
5278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system25.Theme, {}),
|
|
5280
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(UniformMeshLocationContextProvider, { children })
|
|
4650
5281
|
] });
|
|
4651
5282
|
};
|
|
4652
5283
|
|
|
4653
5284
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
4654
5285
|
init_emotion_jsx_shim();
|
|
4655
|
-
var
|
|
4656
|
-
var
|
|
4657
|
-
var
|
|
5286
|
+
var import_react50 = require("@emotion/react");
|
|
5287
|
+
var import_design_system26 = require("@uniformdev/design-system");
|
|
5288
|
+
var import_jsx_runtime51 = require("@emotion/react/jsx-runtime");
|
|
4658
5289
|
var DataRefreshButton = ({
|
|
4659
5290
|
buttonText,
|
|
4660
5291
|
isLoading,
|
|
4661
5292
|
onRefreshData,
|
|
4662
5293
|
...props
|
|
4663
5294
|
}) => {
|
|
4664
|
-
return /* @__PURE__ */ (0,
|
|
4665
|
-
!isLoading ? null : /* @__PURE__ */ (0,
|
|
4666
|
-
|
|
5295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_design_system26.Button, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
5296
|
+
!isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5297
|
+
import_design_system26.LoadingIndicator,
|
|
4667
5298
|
{
|
|
4668
|
-
css:
|
|
5299
|
+
css: import_react50.css`
|
|
4669
5300
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
4670
5301
|
`
|
|
4671
5302
|
}
|
|
@@ -5837,13 +6468,13 @@ function bindVariablesToObjectRecursive({
|
|
|
5837
6468
|
}
|
|
5838
6469
|
|
|
5839
6470
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
5840
|
-
var
|
|
6471
|
+
var import_design_system27 = require("@uniformdev/design-system");
|
|
5841
6472
|
|
|
5842
6473
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
5843
6474
|
init_emotion_jsx_shim();
|
|
5844
|
-
var
|
|
5845
|
-
var
|
|
5846
|
-
var ObjectSearchContext = (0,
|
|
6475
|
+
var import_react51 = require("react");
|
|
6476
|
+
var import_jsx_runtime52 = require("@emotion/react/jsx-runtime");
|
|
6477
|
+
var ObjectSearchContext = (0, import_react51.createContext)({
|
|
5847
6478
|
onSetQuery: () => {
|
|
5848
6479
|
},
|
|
5849
6480
|
onSelectItem: () => {
|
|
@@ -5858,15 +6489,15 @@ var ObjectSearchContext = (0, import_react43.createContext)({
|
|
|
5858
6489
|
}
|
|
5859
6490
|
});
|
|
5860
6491
|
var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
5861
|
-
const [query, setQuery] = (0,
|
|
6492
|
+
const [query, setQuery] = (0, import_react51.useState)({
|
|
5862
6493
|
contentType: "",
|
|
5863
6494
|
keyword: ""
|
|
5864
6495
|
});
|
|
5865
6496
|
const { flatVariables } = useVariables(true);
|
|
5866
|
-
const querySearchDeferred = (0,
|
|
5867
|
-
const [selectedItems, setSelectedItems] = (0,
|
|
5868
|
-
const [list, setList] = (0,
|
|
5869
|
-
const onSetQuery = (0,
|
|
6497
|
+
const querySearchDeferred = (0, import_react51.useDeferredValue)(query);
|
|
6498
|
+
const [selectedItems, setSelectedItems] = (0, import_react51.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
6499
|
+
const [list, setList] = (0, import_react51.useState)({});
|
|
6500
|
+
const onSetQuery = (0, import_react51.useCallback)(
|
|
5870
6501
|
(value2) => {
|
|
5871
6502
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
5872
6503
|
return setQuery({
|
|
@@ -5878,7 +6509,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
5878
6509
|
},
|
|
5879
6510
|
[setQuery]
|
|
5880
6511
|
);
|
|
5881
|
-
const onSelectItem = (0,
|
|
6512
|
+
const onSelectItem = (0, import_react51.useCallback)(
|
|
5882
6513
|
(selectedResult) => {
|
|
5883
6514
|
if (Array.isArray(selectedResult)) {
|
|
5884
6515
|
setSelectedItems(selectedResult);
|
|
@@ -5892,17 +6523,17 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
5892
6523
|
},
|
|
5893
6524
|
[setSelectedItems, selectedItems]
|
|
5894
6525
|
);
|
|
5895
|
-
const onRemoveAllSelectedItems = (0,
|
|
6526
|
+
const onRemoveAllSelectedItems = (0, import_react51.useCallback)(() => {
|
|
5896
6527
|
setSelectedItems([]);
|
|
5897
6528
|
}, [setSelectedItems]);
|
|
5898
|
-
const onSetList = (0,
|
|
6529
|
+
const onSetList = (0, import_react51.useCallback)(
|
|
5899
6530
|
(value2) => {
|
|
5900
6531
|
setList(value2);
|
|
5901
6532
|
},
|
|
5902
6533
|
[setList]
|
|
5903
6534
|
);
|
|
5904
|
-
const boundQuery = (0,
|
|
5905
|
-
const value = (0,
|
|
6535
|
+
const boundQuery = (0, import_react51.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
6536
|
+
const value = (0, import_react51.useMemo)(
|
|
5906
6537
|
() => ({
|
|
5907
6538
|
boundQuery,
|
|
5908
6539
|
onSetQuery,
|
|
@@ -5924,10 +6555,10 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
5924
6555
|
onSetList
|
|
5925
6556
|
]
|
|
5926
6557
|
);
|
|
5927
|
-
return /* @__PURE__ */ (0,
|
|
6558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
5928
6559
|
};
|
|
5929
6560
|
function useObjectSearchContext() {
|
|
5930
|
-
return (0,
|
|
6561
|
+
return (0, import_react51.useContext)(ObjectSearchContext);
|
|
5931
6562
|
}
|
|
5932
6563
|
function bindQuery(query, inputs) {
|
|
5933
6564
|
const { result, errors } = bindVariablesToObject({
|
|
@@ -5942,7 +6573,7 @@ function bindQuery(query, inputs) {
|
|
|
5942
6573
|
}
|
|
5943
6574
|
|
|
5944
6575
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
5945
|
-
var
|
|
6576
|
+
var import_jsx_runtime53 = require("@emotion/react/jsx-runtime");
|
|
5946
6577
|
var ObjectSearchContainer = ({
|
|
5947
6578
|
label,
|
|
5948
6579
|
enableDynamicInputToResultId,
|
|
@@ -5953,9 +6584,9 @@ var ObjectSearchContainer = ({
|
|
|
5953
6584
|
var _a, _b;
|
|
5954
6585
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
5955
6586
|
const { flatVariables } = useVariables(true);
|
|
5956
|
-
const body = /* @__PURE__ */ (0,
|
|
6587
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_design_system27.VerticalRhythm, { children: [
|
|
5957
6588
|
searchFilters,
|
|
5958
|
-
!resultList ? null : /* @__PURE__ */ (0,
|
|
6589
|
+
!resultList ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system27.ScrollableList, { role: "list", children: resultList })
|
|
5959
6590
|
] });
|
|
5960
6591
|
const handleSelectedVariableChange = (selectedValue) => {
|
|
5961
6592
|
var _a2;
|
|
@@ -5984,8 +6615,8 @@ var ObjectSearchContainer = ({
|
|
|
5984
6615
|
}
|
|
5985
6616
|
]);
|
|
5986
6617
|
};
|
|
5987
|
-
return /* @__PURE__ */ (0,
|
|
5988
|
-
/* @__PURE__ */ (0,
|
|
6618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system27.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_design_system27.VerticalRhythm, { children: [
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system27.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5989
6620
|
InputVariables,
|
|
5990
6621
|
{
|
|
5991
6622
|
label,
|
|
@@ -6001,13 +6632,13 @@ var ObjectSearchContainer = ({
|
|
|
6001
6632
|
|
|
6002
6633
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6003
6634
|
init_emotion_jsx_shim();
|
|
6004
|
-
var
|
|
6005
|
-
var
|
|
6635
|
+
var import_design_system28 = require("@uniformdev/design-system");
|
|
6636
|
+
var import_react53 = require("react");
|
|
6006
6637
|
|
|
6007
6638
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6008
6639
|
init_emotion_jsx_shim();
|
|
6009
|
-
var
|
|
6010
|
-
var ObjectSearchFilterContainerLabel =
|
|
6640
|
+
var import_react52 = require("@emotion/react");
|
|
6641
|
+
var ObjectSearchFilterContainerLabel = import_react52.css`
|
|
6011
6642
|
align-items: center;
|
|
6012
6643
|
display: flex;
|
|
6013
6644
|
font-size: var(--fs-sm);
|
|
@@ -6015,21 +6646,21 @@ var ObjectSearchFilterContainerLabel = import_react44.css`
|
|
|
6015
6646
|
line-height: 1rem;
|
|
6016
6647
|
margin-bottom: var(--spacing-sm);
|
|
6017
6648
|
`;
|
|
6018
|
-
var ObjectSearchFilterContainer =
|
|
6649
|
+
var ObjectSearchFilterContainer = import_react52.css`
|
|
6019
6650
|
display: grid;
|
|
6020
6651
|
gap: var(--spacing-base);
|
|
6021
6652
|
`;
|
|
6022
|
-
var ObjectSearchFilterDropdownAndTextSearch =
|
|
6653
|
+
var ObjectSearchFilterDropdownAndTextSearch = import_react52.css`
|
|
6023
6654
|
grid-template-columns: 0.5fr 1fr;
|
|
6024
6655
|
`;
|
|
6025
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6656
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react52.css`
|
|
6026
6657
|
display: grid;
|
|
6027
6658
|
grid-template-columns: ${gridColumns};
|
|
6028
6659
|
gap: var(--spacing-base);
|
|
6029
6660
|
`;
|
|
6030
6661
|
|
|
6031
6662
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6032
|
-
var
|
|
6663
|
+
var import_jsx_runtime54 = require("@emotion/react/jsx-runtime");
|
|
6033
6664
|
var ObjectSearchFilter = ({
|
|
6034
6665
|
requireContentType,
|
|
6035
6666
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6039,7 +6670,7 @@ var ObjectSearchFilter = ({
|
|
|
6039
6670
|
selectOptions
|
|
6040
6671
|
}) => {
|
|
6041
6672
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6042
|
-
const [searchState, setSearchState] = (0,
|
|
6673
|
+
const [searchState, setSearchState] = (0, import_react53.useState)({
|
|
6043
6674
|
contentType: "",
|
|
6044
6675
|
keyword: ""
|
|
6045
6676
|
});
|
|
@@ -6049,9 +6680,9 @@ var ObjectSearchFilter = ({
|
|
|
6049
6680
|
});
|
|
6050
6681
|
onSetQuery({ ...query, ...value });
|
|
6051
6682
|
};
|
|
6052
|
-
return /* @__PURE__ */ (0,
|
|
6053
|
-
/* @__PURE__ */ (0,
|
|
6054
|
-
|
|
6683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
|
|
6684
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6685
|
+
import_design_system28.InputSelect,
|
|
6055
6686
|
{
|
|
6056
6687
|
label: selectLabel,
|
|
6057
6688
|
showLabel: false,
|
|
@@ -6066,8 +6697,8 @@ var ObjectSearchFilter = ({
|
|
|
6066
6697
|
value: query.contentType
|
|
6067
6698
|
}
|
|
6068
6699
|
),
|
|
6069
|
-
/* @__PURE__ */ (0,
|
|
6070
|
-
|
|
6700
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6701
|
+
import_design_system28.InputKeywordSearch,
|
|
6071
6702
|
{
|
|
6072
6703
|
inputFieldName: searchInputName,
|
|
6073
6704
|
placeholder: searchInputPlaceholderText,
|
|
@@ -6082,23 +6713,23 @@ var ObjectSearchFilter = ({
|
|
|
6082
6713
|
|
|
6083
6714
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6084
6715
|
init_emotion_jsx_shim();
|
|
6085
|
-
var
|
|
6716
|
+
var import_jsx_runtime55 = require("@emotion/react/jsx-runtime");
|
|
6086
6717
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6087
|
-
return /* @__PURE__ */ (0,
|
|
6088
|
-
label ? /* @__PURE__ */ (0,
|
|
6089
|
-
/* @__PURE__ */ (0,
|
|
6718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { children: [
|
|
6719
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6720
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6090
6721
|
] });
|
|
6091
6722
|
};
|
|
6092
6723
|
|
|
6093
6724
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6094
6725
|
init_emotion_jsx_shim();
|
|
6095
|
-
var
|
|
6726
|
+
var import_design_system30 = require("@uniformdev/design-system");
|
|
6096
6727
|
|
|
6097
6728
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6098
6729
|
init_emotion_jsx_shim();
|
|
6099
|
-
var
|
|
6100
|
-
var
|
|
6101
|
-
var ObjectListItemContainer =
|
|
6730
|
+
var import_react54 = require("@emotion/react");
|
|
6731
|
+
var import_design_system29 = require("@uniformdev/design-system");
|
|
6732
|
+
var ObjectListItemContainer = import_react54.css`
|
|
6102
6733
|
align-items: center;
|
|
6103
6734
|
border: 1px solid var(--gray-300);
|
|
6104
6735
|
border-radius: var(--rounded-base);
|
|
@@ -6111,8 +6742,8 @@ var ObjectListItemContainer = import_react46.css`
|
|
|
6111
6742
|
display: none;
|
|
6112
6743
|
}
|
|
6113
6744
|
`;
|
|
6114
|
-
var ObjectListItemLoading =
|
|
6115
|
-
animation: ${
|
|
6745
|
+
var ObjectListItemLoading = import_react54.css`
|
|
6746
|
+
animation: ${import_design_system29.skeletonLoading} 1s linear infinite alternate;
|
|
6116
6747
|
border-color: transparent;
|
|
6117
6748
|
min-height: 42px;
|
|
6118
6749
|
position: relative;
|
|
@@ -6135,37 +6766,37 @@ var ObjectListItemLoading = import_react46.css`
|
|
|
6135
6766
|
width: 1rem;
|
|
6136
6767
|
}
|
|
6137
6768
|
`;
|
|
6138
|
-
var ObjectListItemHeadingGroup =
|
|
6769
|
+
var ObjectListItemHeadingGroup = import_react54.css`
|
|
6139
6770
|
align-items: center;
|
|
6140
6771
|
display: grid;
|
|
6141
6772
|
`;
|
|
6142
|
-
var ObjectListItemTitle =
|
|
6773
|
+
var ObjectListItemTitle = import_react54.css`
|
|
6143
6774
|
color: var(--brand-secondary-1);
|
|
6144
6775
|
display: block;
|
|
6145
6776
|
font-size: var(--fs-sm);
|
|
6146
6777
|
`;
|
|
6147
|
-
var ObjectListItemSubtitle =
|
|
6778
|
+
var ObjectListItemSubtitle = import_react54.css`
|
|
6148
6779
|
color: var(--gray-500);
|
|
6149
6780
|
display: block;
|
|
6150
6781
|
font-size: var(--fs-xs);
|
|
6151
6782
|
line-height: 1;
|
|
6152
6783
|
`;
|
|
6153
|
-
var ObjectListItemInfoContainer =
|
|
6784
|
+
var ObjectListItemInfoContainer = import_react54.css`
|
|
6154
6785
|
align-items: center;
|
|
6155
6786
|
display: flex;
|
|
6156
6787
|
justify-content: center;
|
|
6157
6788
|
`;
|
|
6158
|
-
var ObjectListItemControlledContent =
|
|
6789
|
+
var ObjectListItemControlledContent = import_react54.css`
|
|
6159
6790
|
display: flex;
|
|
6160
6791
|
gap: var(--spacing-sm);
|
|
6161
6792
|
`;
|
|
6162
|
-
var ObjectListItemUnControlledContent =
|
|
6793
|
+
var ObjectListItemUnControlledContent = import_react54.css`
|
|
6163
6794
|
margin-top: var(--spacing-sm);
|
|
6164
6795
|
grid-column: 1 / -1;
|
|
6165
6796
|
`;
|
|
6166
6797
|
|
|
6167
6798
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6168
|
-
var
|
|
6799
|
+
var import_jsx_runtime56 = require("@emotion/react/jsx-runtime");
|
|
6169
6800
|
var ObjectSearchListItem = ({
|
|
6170
6801
|
id,
|
|
6171
6802
|
title,
|
|
@@ -6188,25 +6819,25 @@ var ObjectSearchListItem = ({
|
|
|
6188
6819
|
return onSelectItem([selectedItem]);
|
|
6189
6820
|
};
|
|
6190
6821
|
const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
|
|
6191
|
-
return /* @__PURE__ */ (0,
|
|
6192
|
-
/* @__PURE__ */ (0,
|
|
6193
|
-
!image ? null : /* @__PURE__ */ (0,
|
|
6194
|
-
/* @__PURE__ */ (0,
|
|
6195
|
-
!contentType ? null : /* @__PURE__ */ (0,
|
|
6196
|
-
/* @__PURE__ */ (0,
|
|
6822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, children: [
|
|
6823
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
|
|
6824
|
+
!image ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6825
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6826
|
+
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6827
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { css: ObjectListItemTitle, children: title })
|
|
6197
6828
|
] })
|
|
6198
6829
|
] }),
|
|
6199
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
6200
|
-
!children ? null : /* @__PURE__ */ (0,
|
|
6830
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_design_system30.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
|
|
6831
|
+
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6201
6832
|
] });
|
|
6202
6833
|
};
|
|
6203
6834
|
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6204
|
-
return /* @__PURE__ */ (0,
|
|
6835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6205
6836
|
};
|
|
6206
6837
|
|
|
6207
6838
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6208
6839
|
init_emotion_jsx_shim();
|
|
6209
|
-
var
|
|
6840
|
+
var import_design_system32 = require("@uniformdev/design-system");
|
|
6210
6841
|
var import_timeago3 = require("timeago.js");
|
|
6211
6842
|
|
|
6212
6843
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
@@ -6214,10 +6845,10 @@ init_emotion_jsx_shim();
|
|
|
6214
6845
|
|
|
6215
6846
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6216
6847
|
init_emotion_jsx_shim();
|
|
6217
|
-
var
|
|
6218
|
-
var
|
|
6219
|
-
var ButtonStyles =
|
|
6220
|
-
${
|
|
6848
|
+
var import_react55 = require("@emotion/react");
|
|
6849
|
+
var import_design_system31 = require("@uniformdev/design-system");
|
|
6850
|
+
var ButtonStyles = import_react55.css`
|
|
6851
|
+
${import_design_system31.button}
|
|
6221
6852
|
background: transparent;
|
|
6222
6853
|
border: 1px solid var(--brand-secondary-1);
|
|
6223
6854
|
color: var(--brand-secondary-1);
|
|
@@ -6243,20 +6874,20 @@ var ButtonStyles = import_react47.css`
|
|
|
6243
6874
|
text-decoration: none;
|
|
6244
6875
|
}
|
|
6245
6876
|
`;
|
|
6246
|
-
var ButtonIcon =
|
|
6877
|
+
var ButtonIcon = import_react55.css`
|
|
6247
6878
|
width: 1rem;
|
|
6248
6879
|
height: 1rem;
|
|
6249
6880
|
`;
|
|
6250
6881
|
|
|
6251
6882
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6252
|
-
var
|
|
6883
|
+
var import_jsx_runtime57 = require("@emotion/react/jsx-runtime");
|
|
6253
6884
|
var ObjectSearchResultItemButton = ({
|
|
6254
6885
|
text,
|
|
6255
6886
|
icon,
|
|
6256
6887
|
...props
|
|
6257
6888
|
}) => {
|
|
6258
|
-
return /* @__PURE__ */ (0,
|
|
6259
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
6890
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6260
6891
|
text
|
|
6261
6892
|
] });
|
|
6262
6893
|
};
|
|
@@ -6265,16 +6896,16 @@ var LinkButton = ({
|
|
|
6265
6896
|
icon,
|
|
6266
6897
|
...props
|
|
6267
6898
|
}) => {
|
|
6268
|
-
return /* @__PURE__ */ (0,
|
|
6269
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6900
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6270
6901
|
text
|
|
6271
6902
|
] });
|
|
6272
6903
|
};
|
|
6273
6904
|
|
|
6274
6905
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6275
6906
|
init_emotion_jsx_shim();
|
|
6276
|
-
var
|
|
6277
|
-
var ObjectSearchResultItemContainer =
|
|
6907
|
+
var import_react56 = require("@emotion/react");
|
|
6908
|
+
var ObjectSearchResultItemContainer = import_react56.css`
|
|
6278
6909
|
align-items: center;
|
|
6279
6910
|
border: 1px solid var(--gray-300);
|
|
6280
6911
|
border-radius: var(--rounded-base);
|
|
@@ -6290,7 +6921,7 @@ var ObjectSearchResultItemContainer = import_react48.css`
|
|
|
6290
6921
|
}
|
|
6291
6922
|
}
|
|
6292
6923
|
`;
|
|
6293
|
-
var ObjectSearchDragHandle =
|
|
6924
|
+
var ObjectSearchDragHandle = import_react56.css`
|
|
6294
6925
|
border-left: 2px dotted var(--gray-300);
|
|
6295
6926
|
border-right: 2px dotted var(--gray-300);
|
|
6296
6927
|
position: absolute;
|
|
@@ -6299,41 +6930,41 @@ var ObjectSearchDragHandle = import_react48.css`
|
|
|
6299
6930
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6300
6931
|
opacity: 0;
|
|
6301
6932
|
`;
|
|
6302
|
-
var ObjectSearchResultItemSubtitle =
|
|
6933
|
+
var ObjectSearchResultItemSubtitle = import_react56.css`
|
|
6303
6934
|
color: var(--gray-500);
|
|
6304
6935
|
display: block;
|
|
6305
6936
|
font-size: var(--fs-xs);
|
|
6306
6937
|
line-height: 1;
|
|
6307
6938
|
`;
|
|
6308
|
-
var ObjectSearchResultItemTitle =
|
|
6939
|
+
var ObjectSearchResultItemTitle = import_react56.css`
|
|
6309
6940
|
align-items: center;
|
|
6310
6941
|
color: var(--brand-secondary-1);
|
|
6311
6942
|
display: flex;
|
|
6312
6943
|
gap: var(--spacing-xs);
|
|
6313
6944
|
`;
|
|
6314
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6945
|
+
var ObjectSearchResultItemTimeStamp = import_react56.css`
|
|
6315
6946
|
color: var(--gray-500);
|
|
6316
6947
|
font-size: var(--fs-xs);
|
|
6317
6948
|
`;
|
|
6318
|
-
var ObjectSearchAuthorStateGroup =
|
|
6949
|
+
var ObjectSearchAuthorStateGroup = import_react56.css`
|
|
6319
6950
|
align-items: center;
|
|
6320
6951
|
display: flex;
|
|
6321
6952
|
gap: var(--spacing-sm);
|
|
6322
6953
|
`;
|
|
6323
|
-
var ObjectSearchUpdateGroup =
|
|
6954
|
+
var ObjectSearchUpdateGroup = import_react56.css`
|
|
6324
6955
|
display: grid;
|
|
6325
6956
|
`;
|
|
6326
|
-
var ObjectSearchContentContainer =
|
|
6957
|
+
var ObjectSearchContentContainer = import_react56.css`
|
|
6327
6958
|
display: flex;
|
|
6328
6959
|
gap: var(--spacing-base);
|
|
6329
6960
|
`;
|
|
6330
|
-
var ObjectSearchImage =
|
|
6961
|
+
var ObjectSearchImage = import_react56.css`
|
|
6331
6962
|
width: 56px;
|
|
6332
6963
|
object-fit: contain;
|
|
6333
6964
|
`;
|
|
6334
6965
|
|
|
6335
6966
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6336
|
-
var
|
|
6967
|
+
var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
|
|
6337
6968
|
var ObjectSearchResultItem = ({
|
|
6338
6969
|
id,
|
|
6339
6970
|
title,
|
|
@@ -6357,75 +6988,75 @@ var ObjectSearchResultItem = ({
|
|
|
6357
6988
|
onSelectItem({ id, title: id });
|
|
6358
6989
|
onRemove == null ? void 0 : onRemove();
|
|
6359
6990
|
};
|
|
6360
|
-
return /* @__PURE__ */ (0,
|
|
6361
|
-
disableDnD ? null : /* @__PURE__ */ (0,
|
|
6362
|
-
/* @__PURE__ */ (0,
|
|
6363
|
-
!imageUrl ? null : /* @__PURE__ */ (0,
|
|
6364
|
-
/* @__PURE__ */ (0,
|
|
6365
|
-
/* @__PURE__ */ (0,
|
|
6366
|
-
/* @__PURE__ */ (0,
|
|
6991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { css: ObjectSearchResultItemContainer, children: [
|
|
6992
|
+
disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
6993
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { css: ObjectSearchContentContainer, children: [
|
|
6994
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
6995
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { children: [
|
|
6996
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
|
|
6997
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
|
|
6367
6998
|
title != null ? title : name,
|
|
6368
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
6999
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_design_system32.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6369
7000
|
] }),
|
|
6370
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0,
|
|
6371
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0,
|
|
6372
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0,
|
|
6373
|
-
!createdAt ? null : /* @__PURE__ */ (0,
|
|
6374
|
-
/* @__PURE__ */ (0,
|
|
7001
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
7002
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_design_system32.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
7003
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
|
|
7004
|
+
!createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
7005
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("strong", { children: "Last updated: " }),
|
|
6375
7006
|
(0, import_timeago3.format)(createdAt)
|
|
6376
7007
|
] }),
|
|
6377
|
-
!publishedAt ? null : /* @__PURE__ */ (0,
|
|
6378
|
-
/* @__PURE__ */ (0,
|
|
7008
|
+
!publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
7009
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("strong", { children: "Last published: " }),
|
|
6379
7010
|
(0, import_timeago3.format)(publishedAt)
|
|
6380
7011
|
] })
|
|
6381
7012
|
] })
|
|
6382
7013
|
] }),
|
|
6383
|
-
/* @__PURE__ */ (0,
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { children })
|
|
6384
7015
|
] })
|
|
6385
7016
|
] }) }),
|
|
6386
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6387
|
-
!editLink ? null : /* @__PURE__ */ (0,
|
|
6388
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
7017
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
7018
|
+
!editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
7019
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_design_system32.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
6389
7020
|
] })
|
|
6390
7021
|
] });
|
|
6391
7022
|
};
|
|
6392
7023
|
|
|
6393
7024
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6394
7025
|
init_emotion_jsx_shim();
|
|
6395
|
-
var
|
|
7026
|
+
var import_design_system33 = require("@uniformdev/design-system");
|
|
6396
7027
|
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
6397
7028
|
|
|
6398
7029
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6399
7030
|
init_emotion_jsx_shim();
|
|
6400
|
-
var
|
|
6401
|
-
var ObjectSearchResultListContainer =
|
|
7031
|
+
var import_react57 = require("@emotion/react");
|
|
7032
|
+
var ObjectSearchResultListContainer = import_react57.css`
|
|
6402
7033
|
align-items: center;
|
|
6403
7034
|
display: flex;
|
|
6404
7035
|
gap: var(--spacing-sm);
|
|
6405
7036
|
justify-content: space-between;
|
|
6406
7037
|
`;
|
|
6407
|
-
var ObjectSearchDragContainer =
|
|
7038
|
+
var ObjectSearchDragContainer = import_react57.css`
|
|
6408
7039
|
margin: 0 0 var(--spacing-sm);
|
|
6409
7040
|
`;
|
|
6410
|
-
var ObjectSearchResultListCounterContainer =
|
|
7041
|
+
var ObjectSearchResultListCounterContainer = import_react57.css`
|
|
6411
7042
|
align-items: center;
|
|
6412
7043
|
display: flex;
|
|
6413
7044
|
gap: var(--spacing-sm);
|
|
6414
7045
|
`;
|
|
6415
|
-
var ObjectSearchResultListTitle =
|
|
7046
|
+
var ObjectSearchResultListTitle = import_react57.css`
|
|
6416
7047
|
font-weight: var(--fw-bold);
|
|
6417
7048
|
line-height: 1;
|
|
6418
7049
|
`;
|
|
6419
7050
|
|
|
6420
7051
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6421
|
-
var
|
|
7052
|
+
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6422
7053
|
function ObjectSearchResultList({
|
|
6423
7054
|
resultLabelText = "Selected",
|
|
6424
7055
|
removeButtonText = "Remove all",
|
|
6425
7056
|
onRemoveAllSelected,
|
|
6426
7057
|
hideRemoveButton = false,
|
|
6427
7058
|
additionalButtons,
|
|
6428
|
-
renderResultComponent = (value) => /* @__PURE__ */ (0,
|
|
7059
|
+
renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ObjectSearchResultItem, { ...value, disableDnD }),
|
|
6429
7060
|
multiSelectId,
|
|
6430
7061
|
disableDnD = false,
|
|
6431
7062
|
whenNothingSelected = null
|
|
@@ -6445,17 +7076,17 @@ function ObjectSearchResultList({
|
|
|
6445
7076
|
return result;
|
|
6446
7077
|
}
|
|
6447
7078
|
};
|
|
6448
|
-
return /* @__PURE__ */ (0,
|
|
6449
|
-
/* @__PURE__ */ (0,
|
|
6450
|
-
/* @__PURE__ */ (0,
|
|
6451
|
-
/* @__PURE__ */ (0,
|
|
7079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
7080
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
7081
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
7082
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
6452
7083
|
" ",
|
|
6453
|
-
!selectedListItems.length ? null : /* @__PURE__ */ (0,
|
|
7084
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system33.Counter, { count: selectedListItems.length })
|
|
6454
7085
|
] }),
|
|
6455
|
-
/* @__PURE__ */ (0,
|
|
7086
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
6456
7087
|
additionalButtons,
|
|
6457
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6458
|
-
|
|
7088
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7089
|
+
import_design_system33.Button,
|
|
6459
7090
|
{
|
|
6460
7091
|
buttonType: "ghostDestructive",
|
|
6461
7092
|
size: "xs",
|
|
@@ -6466,10 +7097,10 @@ function ObjectSearchResultList({
|
|
|
6466
7097
|
)
|
|
6467
7098
|
] })
|
|
6468
7099
|
] }),
|
|
6469
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0,
|
|
7100
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react_beautiful_dnd3.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react_beautiful_dnd3.Droppable, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
6470
7101
|
selectedListItems.map((item, i2) => {
|
|
6471
7102
|
const renderListItem = renderResultComponent(item);
|
|
6472
|
-
return /* @__PURE__ */ (0,
|
|
7103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react_beautiful_dnd3.Draggable, { draggableId: item.id, index: i2, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6473
7104
|
"div",
|
|
6474
7105
|
{
|
|
6475
7106
|
css: ObjectSearchDragContainer,
|
|
@@ -6488,9 +7119,9 @@ function ObjectSearchResultList({
|
|
|
6488
7119
|
|
|
6489
7120
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
6490
7121
|
init_emotion_jsx_shim();
|
|
6491
|
-
var
|
|
6492
|
-
var
|
|
6493
|
-
var
|
|
7122
|
+
var import_design_system34 = require("@uniformdev/design-system");
|
|
7123
|
+
var import_react58 = require("react");
|
|
7124
|
+
var import_jsx_runtime60 = require("@emotion/react/jsx-runtime");
|
|
6494
7125
|
var QueryFilter = ({
|
|
6495
7126
|
requireContentType,
|
|
6496
7127
|
queryFilterTitle = "Configure Query",
|
|
@@ -6521,7 +7152,7 @@ var QueryFilter = ({
|
|
|
6521
7152
|
}) => {
|
|
6522
7153
|
var _a, _b, _c, _d;
|
|
6523
7154
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6524
|
-
const [queryState, setQueryState] = (0,
|
|
7155
|
+
const [queryState, setQueryState] = (0, import_react58.useState)({
|
|
6525
7156
|
contentType: "",
|
|
6526
7157
|
keyword: "",
|
|
6527
7158
|
count: countValue != null ? countValue : 5,
|
|
@@ -6532,13 +7163,13 @@ var QueryFilter = ({
|
|
|
6532
7163
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
6533
7164
|
onSetQuery({ ...query, ...value });
|
|
6534
7165
|
};
|
|
6535
|
-
(0,
|
|
7166
|
+
(0, import_react58.useEffect)(() => {
|
|
6536
7167
|
onSetQuery(queryState);
|
|
6537
7168
|
}, [onSetQuery, queryState]);
|
|
6538
|
-
return /* @__PURE__ */ (0,
|
|
6539
|
-
/* @__PURE__ */ (0,
|
|
6540
|
-
/* @__PURE__ */ (0,
|
|
6541
|
-
/* @__PURE__ */ (0,
|
|
7169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("fieldset", { children: [
|
|
7170
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
7171
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_design_system34.VerticalRhythm, { children: [
|
|
7172
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6542
7173
|
InputVariables,
|
|
6543
7174
|
{
|
|
6544
7175
|
label: searchInputLabel,
|
|
@@ -6546,8 +7177,8 @@ var QueryFilter = ({
|
|
|
6546
7177
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
6547
7178
|
disableInlineMenu: true,
|
|
6548
7179
|
id: "qf_searchText",
|
|
6549
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
6550
|
-
|
|
7180
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7181
|
+
import_design_system34.InputKeywordSearch,
|
|
6551
7182
|
{
|
|
6552
7183
|
id: "qf_searchText",
|
|
6553
7184
|
inputFieldName: searchInputName,
|
|
@@ -6560,8 +7191,8 @@ var QueryFilter = ({
|
|
|
6560
7191
|
)
|
|
6561
7192
|
}
|
|
6562
7193
|
),
|
|
6563
|
-
/* @__PURE__ */ (0,
|
|
6564
|
-
/* @__PURE__ */ (0,
|
|
7194
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
7195
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6565
7196
|
InputVariables,
|
|
6566
7197
|
{
|
|
6567
7198
|
label: contentTypeLabel,
|
|
@@ -6569,8 +7200,8 @@ var QueryFilter = ({
|
|
|
6569
7200
|
value: (_d = queryState.contentType) != null ? _d : "",
|
|
6570
7201
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
6571
7202
|
disableInlineMenu: true,
|
|
6572
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
6573
|
-
|
|
7203
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7204
|
+
import_design_system34.InputSelect,
|
|
6574
7205
|
{
|
|
6575
7206
|
id: "qf_contentType",
|
|
6576
7207
|
label: contentTypeLabel,
|
|
@@ -6588,7 +7219,7 @@ var QueryFilter = ({
|
|
|
6588
7219
|
)
|
|
6589
7220
|
}
|
|
6590
7221
|
),
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
7222
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6592
7223
|
InputVariables,
|
|
6593
7224
|
{
|
|
6594
7225
|
label: countLabel,
|
|
@@ -6596,8 +7227,8 @@ var QueryFilter = ({
|
|
|
6596
7227
|
value: queryState.count.toString(10),
|
|
6597
7228
|
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
6598
7229
|
disableInlineMenu: true,
|
|
6599
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
6600
|
-
|
|
7230
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7231
|
+
import_design_system34.Input,
|
|
6601
7232
|
{
|
|
6602
7233
|
id: "qf_count",
|
|
6603
7234
|
label: countLabel,
|
|
@@ -6611,8 +7242,8 @@ var QueryFilter = ({
|
|
|
6611
7242
|
}
|
|
6612
7243
|
)
|
|
6613
7244
|
] }),
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
7245
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
7246
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6616
7247
|
InputVariables,
|
|
6617
7248
|
{
|
|
6618
7249
|
id: "qf_sortBy",
|
|
@@ -6620,8 +7251,8 @@ var QueryFilter = ({
|
|
|
6620
7251
|
value: queryState.sortBy,
|
|
6621
7252
|
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
6622
7253
|
disableInlineMenu: true,
|
|
6623
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
6624
|
-
|
|
7254
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7255
|
+
import_design_system34.InputSelect,
|
|
6625
7256
|
{
|
|
6626
7257
|
label: sortLabel,
|
|
6627
7258
|
id: "qf_sortBy",
|
|
@@ -6642,7 +7273,7 @@ var QueryFilter = ({
|
|
|
6642
7273
|
)
|
|
6643
7274
|
}
|
|
6644
7275
|
),
|
|
6645
|
-
/* @__PURE__ */ (0,
|
|
7276
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6646
7277
|
InputVariables,
|
|
6647
7278
|
{
|
|
6648
7279
|
label: sortOrderLabel,
|
|
@@ -6650,8 +7281,8 @@ var QueryFilter = ({
|
|
|
6650
7281
|
value: queryState.sortOrder,
|
|
6651
7282
|
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
6652
7283
|
disableInlineMenu: true,
|
|
6653
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
6654
|
-
|
|
7284
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7285
|
+
import_design_system34.InputSelect,
|
|
6655
7286
|
{
|
|
6656
7287
|
label: sortOrderLabel,
|
|
6657
7288
|
id: "qf_sortOrder",
|
|
@@ -6676,7 +7307,7 @@ var QueryFilter = ({
|
|
|
6676
7307
|
|
|
6677
7308
|
// src/hooks/index.ts
|
|
6678
7309
|
init_emotion_jsx_shim();
|
|
6679
|
-
var
|
|
7310
|
+
var import_design_system35 = require("@uniformdev/design-system");
|
|
6680
7311
|
|
|
6681
7312
|
// src/utils/createLocationValidator.ts
|
|
6682
7313
|
init_emotion_jsx_shim();
|
|
@@ -6688,7 +7319,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
6688
7319
|
}
|
|
6689
7320
|
|
|
6690
7321
|
// src/index.ts
|
|
6691
|
-
var
|
|
7322
|
+
var import_design_system36 = require("@uniformdev/design-system");
|
|
6692
7323
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
6693
7324
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6694
7325
|
0 && (module.exports = {
|
|
@@ -6846,7 +7477,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
6846
7477
|
useRequestParameter,
|
|
6847
7478
|
useUniformMeshSdk,
|
|
6848
7479
|
useVariables,
|
|
6849
|
-
variableExpression,
|
|
6850
7480
|
variablePrefix,
|
|
6851
7481
|
variableSuffix,
|
|
6852
7482
|
variablesToList,
|