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