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