@uniformdev/mesh-sdk-react 19.141.1-alpha.5 → 19.142.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +542 -153
- package/dist/index.d.ts +542 -153
- package/dist/index.esm.js +2481 -607
- package/dist/index.js +2558 -661
- package/dist/index.mjs +2481 -607
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -33,71 +33,83 @@ var src_exports = {};
|
|
|
33
33
|
__export(src_exports, {
|
|
34
34
|
$createVariableNode: () => $createVariableNode,
|
|
35
35
|
$isVariableNode: () => $isVariableNode,
|
|
36
|
-
AddListButton: () =>
|
|
37
|
-
Button: () =>
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
AddListButton: () => import_design_system53.AddListButton,
|
|
37
|
+
Button: () => import_design_system53.Button,
|
|
38
|
+
CHECKBOX_OPERATORS: () => CHECKBOX_OPERATORS,
|
|
39
|
+
Callout: () => import_design_system53.Callout,
|
|
40
40
|
ControlledValuePlugin: () => ControlledValuePlugin,
|
|
41
|
+
DATE_OPERATORS: () => DATE_OPERATORS,
|
|
41
42
|
DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
|
|
42
43
|
DamSelectedItem: () => DamSelectedItem,
|
|
43
44
|
DataRefreshButton: () => DataRefreshButton,
|
|
44
45
|
DataResourceDynamicInputProvider: () => DataResourceDynamicInputProvider,
|
|
45
|
-
DataResourceInputContext: () => DataResourceInputContext,
|
|
46
46
|
DataResourceVariablesList: () => DataResourceVariablesList,
|
|
47
47
|
DataResourceVariablesListExplicit: () => DataResourceVariablesListExplicit,
|
|
48
48
|
DataSourceEditor: () => DataSourceEditor,
|
|
49
49
|
DataTypeEditor: () => DataTypeEditor,
|
|
50
|
+
DateEditor: () => DateEditor,
|
|
51
|
+
DateRangeEditor: () => DateRangeEditor,
|
|
50
52
|
DefaultSearchRow: () => DefaultSearchRow,
|
|
51
53
|
DefaultSelectedItem: () => DefaultSelectedItem,
|
|
52
|
-
DrawerContent: () =>
|
|
54
|
+
DrawerContent: () => import_design_system53.DrawerContent,
|
|
53
55
|
EDIT_VARIABLE_COMMAND: () => EDIT_VARIABLE_COMMAND,
|
|
54
56
|
EntrySearch: () => EntrySearch,
|
|
55
|
-
|
|
57
|
+
FilterButton: () => FilterButton2,
|
|
58
|
+
FilterControls: () => FilterControls,
|
|
59
|
+
FilterEditorRenderer: () => FilterEditorRenderer,
|
|
60
|
+
FilterItem: () => FilterItem,
|
|
61
|
+
FilterItems: () => FilterItems,
|
|
62
|
+
FilterMenu: () => FilterMenu,
|
|
63
|
+
FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
|
|
64
|
+
FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
|
|
65
|
+
Heading: () => import_design_system53.Heading,
|
|
56
66
|
INSERT_VARIABLE_COMMAND: () => INSERT_VARIABLE_COMMAND,
|
|
57
67
|
Icons: () => icons_exports,
|
|
58
|
-
Input: () =>
|
|
59
|
-
InputComboBox: () =>
|
|
60
|
-
InputKeywordSearch: () =>
|
|
61
|
-
InputSelect: () =>
|
|
62
|
-
InputToggle: () =>
|
|
68
|
+
Input: () => import_design_system53.Input,
|
|
69
|
+
InputComboBox: () => import_design_system53.InputComboBox,
|
|
70
|
+
InputKeywordSearch: () => import_design_system53.InputKeywordSearch,
|
|
71
|
+
InputSelect: () => import_design_system53.InputSelect,
|
|
72
|
+
InputToggle: () => import_design_system53.InputToggle,
|
|
63
73
|
InputVariables: () => InputVariables,
|
|
64
|
-
Label: () =>
|
|
74
|
+
Label: () => import_design_system53.Label,
|
|
65
75
|
LinkButton: () => LinkButton,
|
|
66
|
-
LoadingIndicator: () =>
|
|
67
|
-
LoadingOverlay: () =>
|
|
68
|
-
Menu: () =>
|
|
69
|
-
MenuItem: () =>
|
|
76
|
+
LoadingIndicator: () => import_design_system53.LoadingIndicator,
|
|
77
|
+
LoadingOverlay: () => import_design_system53.LoadingOverlay,
|
|
78
|
+
Menu: () => import_design_system53.Menu,
|
|
79
|
+
MenuItem: () => import_design_system53.MenuItem,
|
|
70
80
|
MeshApp: () => MeshApp,
|
|
81
|
+
NUMBER_OPERATORS: () => NUMBER_OPERATORS,
|
|
82
|
+
NumberEditor: () => NumberEditor,
|
|
83
|
+
NumberRangeEditor: () => NumberRangeEditor,
|
|
71
84
|
OPEN_INSERT_VARIABLE_COMMAND: () => OPEN_INSERT_VARIABLE_COMMAND,
|
|
72
85
|
ObjectSearchContainer: () => ObjectSearchContainer,
|
|
73
|
-
ObjectSearchContext: () => ObjectSearchContext,
|
|
74
86
|
ObjectSearchFilter: () => ObjectSearchFilter,
|
|
75
87
|
ObjectSearchFilterContainer: () => ObjectSearchFilterContainer2,
|
|
76
88
|
ObjectSearchListItem: () => ObjectSearchListItem,
|
|
77
89
|
ObjectSearchListItemLoadingSkeleton: () => ObjectSearchListItemLoadingSkeleton,
|
|
78
|
-
ObjectSearchListOfSearchResults: () => ObjectSearchListOfSearchResults,
|
|
79
90
|
ObjectSearchProvider: () => ObjectSearchProvider,
|
|
80
91
|
ObjectSearchResultItem: () => ObjectSearchResultItem,
|
|
81
92
|
ObjectSearchResultItemButton: () => ObjectSearchResultItemButton,
|
|
82
93
|
ObjectSearchResultList: () => ObjectSearchResultList,
|
|
94
|
+
PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
|
|
83
95
|
ParamTypeDynamicDataProvider: () => ParamTypeDynamicDataProvider,
|
|
84
96
|
ParameterConnectionIndicator: () => ParameterConnectionIndicator,
|
|
85
|
-
ParameterGroup: () =>
|
|
86
|
-
ParameterImage: () =>
|
|
87
|
-
ParameterImageInner: () =>
|
|
88
|
-
ParameterInput: () =>
|
|
89
|
-
ParameterInputInner: () =>
|
|
90
|
-
ParameterLabel: () =>
|
|
91
|
-
ParameterMenuButton: () =>
|
|
97
|
+
ParameterGroup: () => import_design_system53.ParameterGroup,
|
|
98
|
+
ParameterImage: () => import_design_system53.ParameterImage,
|
|
99
|
+
ParameterImageInner: () => import_design_system53.ParameterImageInner,
|
|
100
|
+
ParameterInput: () => import_design_system53.ParameterInput,
|
|
101
|
+
ParameterInputInner: () => import_design_system53.ParameterInputInner,
|
|
102
|
+
ParameterLabel: () => import_design_system53.ParameterLabel,
|
|
103
|
+
ParameterMenuButton: () => import_design_system53.ParameterMenuButton,
|
|
92
104
|
ParameterOrSingleVariable: () => ParameterOrSingleVariable,
|
|
93
|
-
ParameterSelect: () =>
|
|
94
|
-
ParameterSelectInner: () =>
|
|
95
|
-
ParameterShell: () =>
|
|
105
|
+
ParameterSelect: () => import_design_system53.ParameterSelect,
|
|
106
|
+
ParameterSelectInner: () => import_design_system53.ParameterSelectInner,
|
|
107
|
+
ParameterShell: () => import_design_system53.ParameterShell,
|
|
96
108
|
ParameterShellContext: () => import_design_system14.ParameterShellContext,
|
|
97
|
-
ParameterTextarea: () =>
|
|
98
|
-
ParameterTextareaInner: () =>
|
|
99
|
-
ParameterToggle: () =>
|
|
100
|
-
ParameterToggleInner: () =>
|
|
109
|
+
ParameterTextarea: () => import_design_system53.ParameterTextarea,
|
|
110
|
+
ParameterTextareaInner: () => import_design_system53.ParameterTextareaInner,
|
|
111
|
+
ParameterToggle: () => import_design_system53.ParameterToggle,
|
|
112
|
+
ParameterToggleInner: () => import_design_system53.ParameterToggleInner,
|
|
101
113
|
ParameterVariables: () => ParameterVariables,
|
|
102
114
|
ProductPreviewList: () => ProductPreviewList,
|
|
103
115
|
ProductQuery: () => ProductQuery,
|
|
@@ -107,6 +119,7 @@ __export(src_exports, {
|
|
|
107
119
|
ProductSearchRow: () => ProductSearchRow,
|
|
108
120
|
ProductSelectedItem: () => ProductSelectedItem,
|
|
109
121
|
QueryFilter: () => QueryFilter,
|
|
122
|
+
RICHTEXT_OPERATORS: () => RICHTEXT_OPERATORS,
|
|
110
123
|
RequestBody: () => RequestBody,
|
|
111
124
|
RequestHeaders: () => RequestHeaders,
|
|
112
125
|
RequestMethodSelect: () => RequestMethodSelect,
|
|
@@ -116,20 +129,34 @@ __export(src_exports, {
|
|
|
116
129
|
RequestUrl: () => RequestUrl,
|
|
117
130
|
RequestUrlInput: () => RequestUrlInput,
|
|
118
131
|
ResolvableLoadingValue: () => ResolvableLoadingValue,
|
|
119
|
-
|
|
120
|
-
|
|
132
|
+
SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
|
|
133
|
+
SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
|
|
134
|
+
ScrollableList: () => import_design_system53.ScrollableList,
|
|
135
|
+
ScrollableListItem: () => import_design_system53.ScrollableListItem,
|
|
136
|
+
SearchAndFilter: () => SearchAndFilter,
|
|
137
|
+
SearchAndFilterContext: () => SearchAndFilterContext,
|
|
138
|
+
SearchAndFilterOptionsContainer: () => SearchAndFilterOptionsContainer2,
|
|
139
|
+
SearchAndFilterProvider: () => SearchAndFilterProvider,
|
|
140
|
+
SearchAndFilterResultContainer: () => SearchAndFilterResultContainer,
|
|
141
|
+
SearchOnlyContext: () => SearchOnlyContext,
|
|
142
|
+
SearchOnlyFilter: () => SearchOnlyFilter,
|
|
121
143
|
SelectionField: () => SelectionField,
|
|
122
|
-
|
|
144
|
+
SortItems: () => SortItems,
|
|
145
|
+
StatusMultiEditor: () => StatusMultiEditor,
|
|
146
|
+
StatusSingleEditor: () => StatusSingleEditor,
|
|
147
|
+
Switch: () => import_design_system53.Switch,
|
|
148
|
+
TEXTBOX_OPERATORS: () => TEXTBOX_OPERATORS,
|
|
149
|
+
TextEditor: () => TextEditor,
|
|
123
150
|
TextVariableRenderer: () => TextVariableRenderer,
|
|
124
|
-
Textarea: () =>
|
|
125
|
-
Theme: () =>
|
|
151
|
+
Textarea: () => import_design_system53.Textarea,
|
|
152
|
+
Theme: () => import_design_system53.Theme,
|
|
153
|
+
USER_OPERATORS: () => USER_OPERATORS,
|
|
126
154
|
VariableEditor: () => VariableEditor,
|
|
127
155
|
VariableNode: () => VariableNode,
|
|
128
156
|
VariablesList: () => VariablesList,
|
|
129
157
|
VariablesPlugin: () => VariablesPlugin,
|
|
130
158
|
VariablesProvider: () => VariablesProvider,
|
|
131
159
|
badgeIcon: () => badgeIcon,
|
|
132
|
-
bindQuery: () => bindQuery,
|
|
133
160
|
bindableFiltersMapper: () => bindableFiltersMapper,
|
|
134
161
|
convertConnectedDataToVariable: () => convertConnectedDataToVariable,
|
|
135
162
|
createLocationValidator: () => createLocationValidator,
|
|
@@ -161,6 +188,7 @@ __export(src_exports, {
|
|
|
161
188
|
entrySearchSelectInput: () => entrySearchSelectInput,
|
|
162
189
|
entrySearchSelectOption: () => entrySearchSelectOption,
|
|
163
190
|
entrySearchWrapper: () => entrySearchWrapper,
|
|
191
|
+
filterMapper: () => filterMapper,
|
|
164
192
|
hasReferencedVariables: () => hasReferencedVariables,
|
|
165
193
|
prettifyBindExpression: () => prettifyBindExpression,
|
|
166
194
|
productSearchRowActiveIcon: () => productSearchRowActiveIcon,
|
|
@@ -202,7 +230,6 @@ __export(src_exports, {
|
|
|
202
230
|
urlEncodeRequestUrl: () => urlEncodeRequestUrl,
|
|
203
231
|
useConnectedDataAsVariables: () => useConnectedDataAsVariables,
|
|
204
232
|
useContentDataResourceLocaleInfo: () => useContentDataResourceLocaleInfo,
|
|
205
|
-
useDataResourceDynamicInputs: () => useDataResourceDynamicInputs,
|
|
206
233
|
useDynamicInputsAsVariables: () => useDynamicInputsAsVariables,
|
|
207
234
|
useMeshLocation: () => useMeshLocation,
|
|
208
235
|
useObjectSearchContext: () => useObjectSearchContext,
|
|
@@ -212,6 +239,7 @@ __export(src_exports, {
|
|
|
212
239
|
useRequest: () => useRequest,
|
|
213
240
|
useRequestHeader: () => useRequestHeader,
|
|
214
241
|
useRequestParameter: () => useRequestParameter,
|
|
242
|
+
useSearchAndFilter: () => useSearchAndFilter,
|
|
215
243
|
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
216
244
|
useVariableEditor: () => useVariableEditor,
|
|
217
245
|
useVariables: () => useVariables,
|
|
@@ -2862,9 +2890,6 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2862
2890
|
] }) : null;
|
|
2863
2891
|
}
|
|
2864
2892
|
|
|
2865
|
-
// src/components/DataResourceDynamicInputProvider.tsx
|
|
2866
|
-
var import_react59 = require("react");
|
|
2867
|
-
|
|
2868
2893
|
// src/hooks/useConnectedDataAsVariables.tsx
|
|
2869
2894
|
var import_react26 = require("react");
|
|
2870
2895
|
function useConnectedDataAsVariables(connectedData) {
|
|
@@ -3148,7 +3173,8 @@ var import_react40 = require("react");
|
|
|
3148
3173
|
|
|
3149
3174
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
3150
3175
|
function prettifyBindExpression(bindExpression) {
|
|
3151
|
-
|
|
3176
|
+
const [, expression] = bindExpression.split(":");
|
|
3177
|
+
return expression;
|
|
3152
3178
|
}
|
|
3153
3179
|
|
|
3154
3180
|
// src/components/Variables/composer/VariableChip.tsx
|
|
@@ -3168,42 +3194,58 @@ function VariableChip({
|
|
|
3168
3194
|
}) {
|
|
3169
3195
|
const hasClickEvent = !!onClick;
|
|
3170
3196
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
3171
|
-
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
|
|
3197
|
+
const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
|
|
3172
3198
|
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
3199
|
+
const chippy = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.MultilineChip, { onClick, "aria-selected": selected ? true : void 0, "aria-disabled": disabled, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference }) });
|
|
3200
|
+
if (tooltip) {
|
|
3201
|
+
const tip = tooltip ? `${tooltip}${extraTitle ? `
|
|
3202
|
+
|
|
3203
|
+
${extraTitle}` : ""}` : extraTitle != null ? extraTitle : "";
|
|
3204
|
+
const tipLines = tip.split("\n");
|
|
3205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3206
|
+
import_design_system15.Tooltip,
|
|
3207
|
+
{
|
|
3208
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.VerticalRhythm, { gap: "sm", children: tipLines.map((t, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: t }, index)) }),
|
|
3209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: chippy })
|
|
3210
|
+
}
|
|
3211
|
+
);
|
|
3212
|
+
}
|
|
3213
|
+
return chippy;
|
|
3214
|
+
}
|
|
3215
|
+
function UndefinedVariableReference({ children }) {
|
|
3173
3216
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3174
|
-
|
|
3217
|
+
"span",
|
|
3175
3218
|
{
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference })
|
|
3219
|
+
style: {
|
|
3220
|
+
textDecoration: "underline",
|
|
3221
|
+
textDecorationStyle: "wavy",
|
|
3222
|
+
textDecorationColor: "var(--error)"
|
|
3223
|
+
},
|
|
3224
|
+
children
|
|
3183
3225
|
}
|
|
3184
3226
|
);
|
|
3185
3227
|
}
|
|
3186
|
-
function
|
|
3228
|
+
function InfoVariableReference({ children }) {
|
|
3187
3229
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3188
3230
|
"span",
|
|
3189
3231
|
{
|
|
3190
3232
|
style: {
|
|
3191
3233
|
textDecoration: "underline",
|
|
3192
3234
|
textDecorationStyle: "wavy",
|
|
3193
|
-
textDecorationColor: "
|
|
3235
|
+
textDecorationColor: "var(--primary-action-default)"
|
|
3194
3236
|
},
|
|
3195
3237
|
children
|
|
3196
3238
|
}
|
|
3197
3239
|
);
|
|
3198
3240
|
}
|
|
3199
|
-
function
|
|
3241
|
+
function WarningVariableReference({ children }) {
|
|
3200
3242
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3201
3243
|
"span",
|
|
3202
3244
|
{
|
|
3203
3245
|
style: {
|
|
3204
3246
|
textDecoration: "underline",
|
|
3205
3247
|
textDecorationStyle: "wavy",
|
|
3206
|
-
textDecorationColor: "
|
|
3248
|
+
textDecorationColor: "var(--alert)"
|
|
3207
3249
|
},
|
|
3208
3250
|
children
|
|
3209
3251
|
}
|
|
@@ -3451,7 +3493,8 @@ function VariablesProvider({
|
|
|
3451
3493
|
readOnly,
|
|
3452
3494
|
isLoading,
|
|
3453
3495
|
children,
|
|
3454
|
-
knownUndefinedValues = {}
|
|
3496
|
+
knownUndefinedValues = {},
|
|
3497
|
+
onChangeKnownUndefinedValue
|
|
3455
3498
|
}) {
|
|
3456
3499
|
const [editing, setEditing] = (0, import_react37.useState)();
|
|
3457
3500
|
const [editingContext, setEditingContext] = (0, import_react37.useState)();
|
|
@@ -3518,6 +3561,15 @@ function VariablesProvider({
|
|
|
3518
3561
|
isLoading: !!isLoading
|
|
3519
3562
|
};
|
|
3520
3563
|
}, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
|
|
3564
|
+
(0, import_react37.useEffect)(() => {
|
|
3565
|
+
if (editing === void 0) {
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
const activeElement = document.activeElement;
|
|
3569
|
+
if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") {
|
|
3570
|
+
activeElement.blur();
|
|
3571
|
+
}
|
|
3572
|
+
}, [editing]);
|
|
3521
3573
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
|
|
3522
3574
|
children,
|
|
3523
3575
|
typeof editing !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -3526,9 +3578,19 @@ function VariablesProvider({
|
|
|
3526
3578
|
context: editingContext,
|
|
3527
3579
|
onSubmit: (val, editorCompletedContext) => {
|
|
3528
3580
|
contextValue.dispatch({ type: "cancelEdit" });
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3581
|
+
if ("resultType" in val) {
|
|
3582
|
+
if (!onChangeKnownUndefinedValue) {
|
|
3583
|
+
throw new Error(
|
|
3584
|
+
"onChangeKnownUndefinedValue must be provided to handle known-undefined-value results"
|
|
3585
|
+
);
|
|
3586
|
+
}
|
|
3587
|
+
const { name, ...kuv } = val;
|
|
3588
|
+
onChangeKnownUndefinedValue(val.name, kuv);
|
|
3589
|
+
} else {
|
|
3590
|
+
const { name, ...varValue } = val;
|
|
3591
|
+
const latestValue = { ...value, [name]: varValue };
|
|
3592
|
+
onChange == null ? void 0 : onChange(latestValue);
|
|
3593
|
+
}
|
|
3532
3594
|
events.emit("editCompleted", {
|
|
3533
3595
|
canceled: false,
|
|
3534
3596
|
selectedVariable: val,
|
|
@@ -3943,21 +4005,21 @@ function VariablesPlugin({
|
|
|
3943
4005
|
]);
|
|
3944
4006
|
const updateExistingNodeIfChanged = (0, import_react39.useCallback)(
|
|
3945
4007
|
(variableNode) => {
|
|
3946
|
-
var _a, _b, _c;
|
|
4008
|
+
var _a, _b, _c, _d;
|
|
3947
4009
|
const targetVar = variablesRef.current.variables[variableNode.reference];
|
|
3948
4010
|
const targetUndefinedVar = variablesRef.current.knownUndefinedValues[variableNode.reference];
|
|
3949
4011
|
const isLoadingVariables = variablesRef.current.isLoading;
|
|
3950
4012
|
const currentState = variableNode.getState();
|
|
3951
|
-
if (currentState.isFresh && !targetVar) {
|
|
4013
|
+
if (currentState.isFresh && !targetVar && !targetUndefinedVar) {
|
|
3952
4014
|
return;
|
|
3953
4015
|
}
|
|
3954
|
-
const tooltip = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
|
|
4016
|
+
const tooltip = (_d = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
|
|
3955
4017
|
const newState = {
|
|
3956
4018
|
...currentState,
|
|
3957
4019
|
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
|
|
3958
4020
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
3959
4021
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
3960
|
-
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
4022
|
+
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
3961
4023
|
tooltip,
|
|
3962
4024
|
isFresh: false
|
|
3963
4025
|
};
|
|
@@ -3973,7 +4035,7 @@ function VariablesPlugin({
|
|
|
3973
4035
|
updateExistingNodeIfChanged(variableNode);
|
|
3974
4036
|
});
|
|
3975
4037
|
});
|
|
3976
|
-
}, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
|
|
4038
|
+
}, [editor, variables, knownUndefinedValues, canEditVariable, updateExistingNodeIfChanged]);
|
|
3977
4039
|
(0, import_react39.useEffect)(() => {
|
|
3978
4040
|
return editor.registerNodeTransform(VariableNode, (variableNode) => {
|
|
3979
4041
|
updateExistingNodeIfChanged(variableNode);
|
|
@@ -4859,7 +4921,7 @@ var import_lexical9 = require("lexical");
|
|
|
4859
4921
|
var import_react50 = require("react");
|
|
4860
4922
|
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
4861
4923
|
function VariablesComposerInput({
|
|
4862
|
-
css:
|
|
4924
|
+
css: css40,
|
|
4863
4925
|
placeholder,
|
|
4864
4926
|
...contentEditableProps
|
|
4865
4927
|
}) {
|
|
@@ -4980,7 +5042,8 @@ function InputVariables(props) {
|
|
|
4980
5042
|
editorRef,
|
|
4981
5043
|
filterVariable,
|
|
4982
5044
|
styleVariant = "default",
|
|
4983
|
-
renderMenuInPortal
|
|
5045
|
+
renderMenuInPortal,
|
|
5046
|
+
disableDismissEditorOnChange
|
|
4984
5047
|
} = props;
|
|
4985
5048
|
const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
4986
5049
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -4990,7 +5053,7 @@ function InputVariables(props) {
|
|
|
4990
5053
|
"div",
|
|
4991
5054
|
{
|
|
4992
5055
|
onKeyDown: () => {
|
|
4993
|
-
if (isEditing && canDispatch) {
|
|
5056
|
+
if (!disableDismissEditorOnChange && isEditing && canDispatch) {
|
|
4994
5057
|
dispatch({ type: "cancelEdit" });
|
|
4995
5058
|
}
|
|
4996
5059
|
},
|
|
@@ -5322,19 +5385,17 @@ function ParameterVariables(props) {
|
|
|
5322
5385
|
children: [
|
|
5323
5386
|
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
5324
5387
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
|
|
5325
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
}
|
|
5335
|
-
|
|
5336
|
-
children: [
|
|
5337
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5388
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system24.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5389
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5390
|
+
"div",
|
|
5391
|
+
{
|
|
5392
|
+
css: { flex: 1 },
|
|
5393
|
+
onKeyDown: () => {
|
|
5394
|
+
if (isEditing && canDispatch) {
|
|
5395
|
+
dispatch({ type: "cancelEdit" });
|
|
5396
|
+
}
|
|
5397
|
+
},
|
|
5398
|
+
children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5338
5399
|
VariablesComposerInput,
|
|
5339
5400
|
{
|
|
5340
5401
|
"aria-label": ariaLabel,
|
|
@@ -5346,20 +5407,20 @@ function ParameterVariables(props) {
|
|
|
5346
5407
|
inputCss != null ? inputCss : import_react56.css``
|
|
5347
5408
|
]
|
|
5348
5409
|
}
|
|
5349
|
-
) }),
|
|
5350
|
-
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5351
|
-
VariablesComposerVariableMenu,
|
|
5352
|
-
{
|
|
5353
|
-
...sharedMenuProps,
|
|
5354
|
-
buttonCss: [variableBindButton],
|
|
5355
|
-
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5356
|
-
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5357
|
-
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5358
|
-
}
|
|
5359
5410
|
)
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5411
|
+
}
|
|
5412
|
+
),
|
|
5413
|
+
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5414
|
+
VariablesComposerVariableMenu,
|
|
5415
|
+
{
|
|
5416
|
+
...sharedMenuProps,
|
|
5417
|
+
buttonCss: [variableBindButton],
|
|
5418
|
+
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5419
|
+
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5420
|
+
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5421
|
+
}
|
|
5422
|
+
)
|
|
5423
|
+
] })
|
|
5363
5424
|
]
|
|
5364
5425
|
}
|
|
5365
5426
|
);
|
|
@@ -5367,7 +5428,7 @@ function ParameterVariables(props) {
|
|
|
5367
5428
|
|
|
5368
5429
|
// src/components/Variables/util/convertConnectedDataToVariable.ts
|
|
5369
5430
|
function convertConnectedDataToVariable(bindExpression, value) {
|
|
5370
|
-
const isValuePrimitive = typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
5431
|
+
const isValuePrimitive = typeof value === "string" && value.length > 0 || typeof value === "number" || typeof value === "boolean";
|
|
5371
5432
|
return {
|
|
5372
5433
|
ephemeral: true,
|
|
5373
5434
|
displayName: isValuePrimitive ? value.toString() : prettifyBindExpression(bindExpression),
|
|
@@ -5532,10 +5593,6 @@ function VariablesList() {
|
|
|
5532
5593
|
|
|
5533
5594
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
5534
5595
|
var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
|
|
5535
|
-
var DataResourceInputContext = (0, import_react59.createContext)(void 0);
|
|
5536
|
-
var useDataResourceDynamicInputs = () => {
|
|
5537
|
-
return (0, import_react59.useContext)(DataResourceInputContext);
|
|
5538
|
-
};
|
|
5539
5596
|
function DataResourceDynamicInputProvider(props) {
|
|
5540
5597
|
const { children, dynamicInputs } = props;
|
|
5541
5598
|
if (dynamicInputs) {
|
|
@@ -5554,7 +5611,7 @@ function DataResourceDynamicInputProviderRenderer({
|
|
|
5554
5611
|
dynamicInputs
|
|
5555
5612
|
}) {
|
|
5556
5613
|
const variables = useDynamicInputsAsVariables(dynamicInputs);
|
|
5557
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(VariablesProvider, { value: variables, readOnly: true, children });
|
|
5558
5615
|
}
|
|
5559
5616
|
|
|
5560
5617
|
// src/components/DataResourceVariablesList.tsx
|
|
@@ -5631,9 +5688,9 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
5631
5688
|
}
|
|
5632
5689
|
|
|
5633
5690
|
// src/components/Request/RequestBody.tsx
|
|
5634
|
-
var
|
|
5691
|
+
var import_react60 = require("@emotion/react");
|
|
5635
5692
|
var import_design_system27 = require("@uniformdev/design-system");
|
|
5636
|
-
var
|
|
5693
|
+
var import_react61 = require("react");
|
|
5637
5694
|
|
|
5638
5695
|
// src/components/Request/RequestProvider.tsx
|
|
5639
5696
|
var React11 = __toESM(require("react"));
|
|
@@ -5717,11 +5774,11 @@ function useRequest() {
|
|
|
5717
5774
|
}
|
|
5718
5775
|
|
|
5719
5776
|
// src/components/Request/styles/Request.styles.ts
|
|
5720
|
-
var
|
|
5721
|
-
var innerContentStyles =
|
|
5777
|
+
var import_react59 = require("@emotion/react");
|
|
5778
|
+
var innerContentStyles = import_react59.css`
|
|
5722
5779
|
background: var(--white);
|
|
5723
5780
|
`;
|
|
5724
|
-
var requestTypeContainer = (bgColor) =>
|
|
5781
|
+
var requestTypeContainer = (bgColor) => import_react59.css`
|
|
5725
5782
|
align-items: start;
|
|
5726
5783
|
background: ${bgColor};
|
|
5727
5784
|
display: grid;
|
|
@@ -5759,11 +5816,11 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
5759
5816
|
};
|
|
5760
5817
|
function RequestBody() {
|
|
5761
5818
|
const { request, dispatch } = useRequest();
|
|
5762
|
-
const [language, setLanguage] = (0,
|
|
5819
|
+
const [language, setLanguage] = (0, import_react61.useState)("json");
|
|
5763
5820
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5764
5821
|
"div",
|
|
5765
5822
|
{
|
|
5766
|
-
css:
|
|
5823
|
+
css: import_react60.css`
|
|
5767
5824
|
background: var(--white);
|
|
5768
5825
|
`,
|
|
5769
5826
|
children: [
|
|
@@ -5771,7 +5828,7 @@ function RequestBody() {
|
|
|
5771
5828
|
RequestTypeContainer,
|
|
5772
5829
|
{
|
|
5773
5830
|
bgColor: "var(--gray-100)",
|
|
5774
|
-
css:
|
|
5831
|
+
css: import_react60.css`
|
|
5775
5832
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
5776
5833
|
`,
|
|
5777
5834
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -6042,8 +6099,8 @@ function RequestParameters({
|
|
|
6042
6099
|
}
|
|
6043
6100
|
|
|
6044
6101
|
// src/components/Request/RequestUrl.tsx
|
|
6045
|
-
var
|
|
6046
|
-
var
|
|
6102
|
+
var import_react62 = require("@emotion/react");
|
|
6103
|
+
var import_react63 = require("react");
|
|
6047
6104
|
|
|
6048
6105
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
6049
6106
|
function urlEncodeRequestUrl(url, varValues) {
|
|
@@ -6069,7 +6126,7 @@ function RequestUrl() {
|
|
|
6069
6126
|
var _a, _b;
|
|
6070
6127
|
const { variables } = useVariables();
|
|
6071
6128
|
const { request } = useRequest();
|
|
6072
|
-
const mergedParameters = (0,
|
|
6129
|
+
const mergedParameters = (0, import_react63.useMemo)(() => {
|
|
6073
6130
|
var _a2;
|
|
6074
6131
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
6075
6132
|
return request.parameters;
|
|
@@ -6079,7 +6136,7 @@ function RequestUrl() {
|
|
|
6079
6136
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
6080
6137
|
"small",
|
|
6081
6138
|
{
|
|
6082
|
-
css:
|
|
6139
|
+
css: import_react62.css`
|
|
6083
6140
|
display: inline-block;
|
|
6084
6141
|
margin-bottom: var(--spacing-xs);
|
|
6085
6142
|
word-break: break-word;
|
|
@@ -6317,12 +6374,12 @@ var import_design_system31 = require("@uniformdev/design-system");
|
|
|
6317
6374
|
|
|
6318
6375
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
6319
6376
|
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
6320
|
-
var
|
|
6377
|
+
var import_react64 = require("react");
|
|
6321
6378
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
6322
|
-
const [error, setError] = (0,
|
|
6323
|
-
const [sdk, setSdk] = (0,
|
|
6324
|
-
const initializationInProgress = (0,
|
|
6325
|
-
(0,
|
|
6379
|
+
const [error, setError] = (0, import_react64.useState)();
|
|
6380
|
+
const [sdk, setSdk] = (0, import_react64.useState)();
|
|
6381
|
+
const initializationInProgress = (0, import_react64.useRef)(false);
|
|
6382
|
+
(0, import_react64.useEffect)(
|
|
6326
6383
|
() => {
|
|
6327
6384
|
if (typeof window === "undefined" || sdk) {
|
|
6328
6385
|
return;
|
|
@@ -6380,7 +6437,7 @@ var MeshApp = ({
|
|
|
6380
6437
|
};
|
|
6381
6438
|
|
|
6382
6439
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
6383
|
-
var
|
|
6440
|
+
var import_react65 = require("@emotion/react");
|
|
6384
6441
|
var import_design_system32 = require("@uniformdev/design-system");
|
|
6385
6442
|
var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
|
|
6386
6443
|
var DataRefreshButton = ({
|
|
@@ -6393,7 +6450,7 @@ var DataRefreshButton = ({
|
|
|
6393
6450
|
!isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6394
6451
|
import_design_system32.LoadingIndicator,
|
|
6395
6452
|
{
|
|
6396
|
-
css:
|
|
6453
|
+
css: import_react65.css`
|
|
6397
6454
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
6398
6455
|
`
|
|
6399
6456
|
}
|
|
@@ -6403,16 +6460,15 @@ var DataRefreshButton = ({
|
|
|
6403
6460
|
};
|
|
6404
6461
|
|
|
6405
6462
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6406
|
-
var
|
|
6463
|
+
var import_react68 = require("@emotion/react");
|
|
6407
6464
|
var import_canvas9 = require("@uniformdev/canvas");
|
|
6408
|
-
var
|
|
6409
|
-
var import_react73 = __toESM(require("react"));
|
|
6465
|
+
var import_design_system35 = require("@uniformdev/design-system");
|
|
6410
6466
|
|
|
6411
6467
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6412
6468
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
6413
|
-
var
|
|
6469
|
+
var import_react66 = require("react");
|
|
6414
6470
|
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6415
|
-
var ObjectSearchContext = (0,
|
|
6471
|
+
var ObjectSearchContext = (0, import_react66.createContext)({
|
|
6416
6472
|
onSetQuery: () => {
|
|
6417
6473
|
},
|
|
6418
6474
|
onSelectItem: () => {
|
|
@@ -6420,6 +6476,8 @@ var ObjectSearchContext = (0, import_react67.createContext)({
|
|
|
6420
6476
|
query: {},
|
|
6421
6477
|
boundQuery: {},
|
|
6422
6478
|
list: {},
|
|
6479
|
+
onSetList: () => {
|
|
6480
|
+
},
|
|
6423
6481
|
selectedListItems: [],
|
|
6424
6482
|
onRemoveAllSelectedItems: () => {
|
|
6425
6483
|
},
|
|
@@ -6431,16 +6489,16 @@ var ObjectSearchProvider = ({
|
|
|
6431
6489
|
children,
|
|
6432
6490
|
defaultQuery
|
|
6433
6491
|
}) => {
|
|
6434
|
-
const [query, setQuery] = (0,
|
|
6492
|
+
const [query, setQuery] = (0, import_react66.useState)({
|
|
6435
6493
|
contentType: "",
|
|
6436
6494
|
keyword: "",
|
|
6437
6495
|
...defaultQuery
|
|
6438
6496
|
});
|
|
6439
6497
|
const { flatVariables } = useVariables(true);
|
|
6440
|
-
const querySearchDeferred = (0,
|
|
6441
|
-
const [selectedItems, setSelectedItems] = (0,
|
|
6442
|
-
const [list, setList] = (0,
|
|
6443
|
-
const onSetQuery = (0,
|
|
6498
|
+
const querySearchDeferred = (0, import_react66.useDeferredValue)(query);
|
|
6499
|
+
const [selectedItems, setSelectedItems] = (0, import_react66.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
6500
|
+
const [list, setList] = (0, import_react66.useState)({});
|
|
6501
|
+
const onSetQuery = (0, import_react66.useCallback)(
|
|
6444
6502
|
(value2) => {
|
|
6445
6503
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
6446
6504
|
return setQuery({
|
|
@@ -6452,7 +6510,7 @@ var ObjectSearchProvider = ({
|
|
|
6452
6510
|
},
|
|
6453
6511
|
[setQuery]
|
|
6454
6512
|
);
|
|
6455
|
-
const onSelectItem = (0,
|
|
6513
|
+
const onSelectItem = (0, import_react66.useCallback)(
|
|
6456
6514
|
(selectedResult) => {
|
|
6457
6515
|
if (Array.isArray(selectedResult)) {
|
|
6458
6516
|
setSelectedItems(selectedResult);
|
|
@@ -6466,17 +6524,17 @@ var ObjectSearchProvider = ({
|
|
|
6466
6524
|
},
|
|
6467
6525
|
[setSelectedItems, selectedItems]
|
|
6468
6526
|
);
|
|
6469
|
-
const onRemoveAllSelectedItems = (0,
|
|
6527
|
+
const onRemoveAllSelectedItems = (0, import_react66.useCallback)(() => {
|
|
6470
6528
|
setSelectedItems([]);
|
|
6471
6529
|
}, [setSelectedItems]);
|
|
6472
|
-
const onSetList = (0,
|
|
6530
|
+
const onSetList = (0, import_react66.useCallback)(
|
|
6473
6531
|
(value2) => {
|
|
6474
6532
|
setList(value2);
|
|
6475
6533
|
},
|
|
6476
6534
|
[setList]
|
|
6477
6535
|
);
|
|
6478
|
-
const boundQuery = (0,
|
|
6479
|
-
const value = (0,
|
|
6536
|
+
const boundQuery = (0, import_react66.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
6537
|
+
const value = (0, import_react66.useMemo)(
|
|
6480
6538
|
() => ({
|
|
6481
6539
|
boundQuery,
|
|
6482
6540
|
onSetQuery,
|
|
@@ -6503,7 +6561,7 @@ var ObjectSearchProvider = ({
|
|
|
6503
6561
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
6504
6562
|
};
|
|
6505
6563
|
function useObjectSearchContext() {
|
|
6506
|
-
return (0,
|
|
6564
|
+
return (0, import_react66.useContext)(ObjectSearchContext);
|
|
6507
6565
|
}
|
|
6508
6566
|
function bindQuery(query, inputs) {
|
|
6509
6567
|
const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
|
|
@@ -6521,9 +6579,9 @@ function bindQuery(query, inputs) {
|
|
|
6521
6579
|
var import_design_system34 = require("@uniformdev/design-system");
|
|
6522
6580
|
|
|
6523
6581
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6524
|
-
var
|
|
6582
|
+
var import_react67 = require("@emotion/react");
|
|
6525
6583
|
var import_design_system33 = require("@uniformdev/design-system");
|
|
6526
|
-
var ObjectListItemContainer =
|
|
6584
|
+
var ObjectListItemContainer = import_react67.css`
|
|
6527
6585
|
align-items: center;
|
|
6528
6586
|
border: 1px solid var(--gray-300);
|
|
6529
6587
|
border-radius: var(--rounded-base);
|
|
@@ -6532,11 +6590,11 @@ var ObjectListItemContainer = import_react68.css`
|
|
|
6532
6590
|
grid-template-columns: 1fr auto;
|
|
6533
6591
|
padding: var(--spacing-sm);
|
|
6534
6592
|
`;
|
|
6535
|
-
var ObjectListItemContainerDisabled =
|
|
6593
|
+
var ObjectListItemContainerDisabled = import_react67.css`
|
|
6536
6594
|
opacity: var(--opacity-50);
|
|
6537
6595
|
pointer-events: none;
|
|
6538
6596
|
`;
|
|
6539
|
-
var ObjectListItemLoading =
|
|
6597
|
+
var ObjectListItemLoading = import_react67.css`
|
|
6540
6598
|
animation: ${import_design_system33.skeletonLoading} 1s linear infinite alternate;
|
|
6541
6599
|
border-color: transparent;
|
|
6542
6600
|
min-height: 42px;
|
|
@@ -6560,36 +6618,36 @@ var ObjectListItemLoading = import_react68.css`
|
|
|
6560
6618
|
width: 1rem;
|
|
6561
6619
|
}
|
|
6562
6620
|
`;
|
|
6563
|
-
var ObjectListItemHeadingGroup =
|
|
6621
|
+
var ObjectListItemHeadingGroup = import_react67.css`
|
|
6564
6622
|
align-items: center;
|
|
6565
6623
|
display: grid;
|
|
6566
6624
|
`;
|
|
6567
|
-
var ObjectListItemThumbnail =
|
|
6625
|
+
var ObjectListItemThumbnail = import_react67.css`
|
|
6568
6626
|
width: 30px;
|
|
6569
6627
|
object-fit: contain;
|
|
6570
6628
|
`;
|
|
6571
|
-
var ObjectListItemTitle =
|
|
6629
|
+
var ObjectListItemTitle = import_react67.css`
|
|
6572
6630
|
color: var(--typography-base);
|
|
6573
6631
|
display: block;
|
|
6574
6632
|
font-size: var(--fs-sm);
|
|
6575
6633
|
`;
|
|
6576
|
-
var ObjectListItemSubtitle =
|
|
6634
|
+
var ObjectListItemSubtitle = import_react67.css`
|
|
6577
6635
|
color: var(--gray-500);
|
|
6578
6636
|
display: block;
|
|
6579
6637
|
font-size: var(--fs-xs);
|
|
6580
6638
|
line-height: 1;
|
|
6581
6639
|
`;
|
|
6582
|
-
var ObjectListItemInfoContainer =
|
|
6640
|
+
var ObjectListItemInfoContainer = import_react67.css`
|
|
6583
6641
|
align-items: center;
|
|
6584
6642
|
display: flex;
|
|
6585
6643
|
gap: var(--spacing-sm);
|
|
6586
6644
|
justify-content: center;
|
|
6587
6645
|
`;
|
|
6588
|
-
var ObjectListItemControlledContent =
|
|
6646
|
+
var ObjectListItemControlledContent = import_react67.css`
|
|
6589
6647
|
display: flex;
|
|
6590
6648
|
gap: var(--spacing-sm);
|
|
6591
6649
|
`;
|
|
6592
|
-
var ObjectListItemUnControlledContent =
|
|
6650
|
+
var ObjectListItemUnControlledContent = import_react67.css`
|
|
6593
6651
|
margin-top: var(--spacing-sm);
|
|
6594
6652
|
grid-column: 1 / -1;
|
|
6595
6653
|
`;
|
|
@@ -6607,11 +6665,6 @@ var ObjectSearchListItem = ({
|
|
|
6607
6665
|
isMulti,
|
|
6608
6666
|
disabled,
|
|
6609
6667
|
children,
|
|
6610
|
-
editLink,
|
|
6611
|
-
editLinkIcon,
|
|
6612
|
-
createdAt,
|
|
6613
|
-
publishStatus,
|
|
6614
|
-
publishedAt,
|
|
6615
6668
|
...props
|
|
6616
6669
|
}) => {
|
|
6617
6670
|
const { onSelectItem, selectedListItems, isMulti: globalIsMulti } = useObjectSearchContext();
|
|
@@ -6664,19 +6717,202 @@ var ObjectSearchListItemLoadingSkeleton = () => {
|
|
|
6664
6717
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6665
6718
|
};
|
|
6666
6719
|
|
|
6667
|
-
// src/components/ObjectSearch/
|
|
6668
|
-
var
|
|
6669
|
-
var
|
|
6720
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6721
|
+
var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
|
|
6722
|
+
var ObjectSearchContainer = ({
|
|
6723
|
+
label,
|
|
6724
|
+
enableDynamicInputToResultId,
|
|
6725
|
+
searchFilters,
|
|
6726
|
+
resultList,
|
|
6727
|
+
children
|
|
6728
|
+
}) => {
|
|
6729
|
+
var _a, _b;
|
|
6730
|
+
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6731
|
+
const { flatVariables } = useVariables(true);
|
|
6732
|
+
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6733
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6734
|
+
import_design_system35.ScrollableList,
|
|
6735
|
+
{
|
|
6736
|
+
role: "list",
|
|
6737
|
+
css: import_react68.css`
|
|
6738
|
+
> div {
|
|
6739
|
+
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6740
|
+
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6741
|
+
}
|
|
6742
|
+
`,
|
|
6743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DefaultResultList, {})
|
|
6744
|
+
}
|
|
6745
|
+
);
|
|
6746
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6747
|
+
searchFilters,
|
|
6748
|
+
listItems
|
|
6749
|
+
] });
|
|
6750
|
+
const handleSelectedVariableChange = (selectedValue) => {
|
|
6751
|
+
var _a2;
|
|
6752
|
+
if (!selectedValue) {
|
|
6753
|
+
onSelectItem([]);
|
|
6754
|
+
return;
|
|
6755
|
+
}
|
|
6756
|
+
const { result, errors } = (0, import_canvas9.bindVariables)({
|
|
6757
|
+
value: selectedValue,
|
|
6758
|
+
variables: flatVariables,
|
|
6759
|
+
errorPrefix: "Dynamic input"
|
|
6760
|
+
});
|
|
6761
|
+
if (!result) {
|
|
6762
|
+
onSelectItem([]);
|
|
6763
|
+
return;
|
|
6764
|
+
}
|
|
6765
|
+
const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
|
|
6766
|
+
onSelectItem([
|
|
6767
|
+
{
|
|
6768
|
+
title: selectedValue,
|
|
6769
|
+
contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
|
|
6770
|
+
// spread any matched list item, overriding the above default props
|
|
6771
|
+
...item,
|
|
6772
|
+
// we want to make sure the ID is our dynamic value
|
|
6773
|
+
id: selectedValue
|
|
6774
|
+
}
|
|
6775
|
+
]);
|
|
6776
|
+
};
|
|
6777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6778
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6779
|
+
InputVariables,
|
|
6780
|
+
{
|
|
6781
|
+
label,
|
|
6782
|
+
value: inputValue,
|
|
6783
|
+
onChange: (value) => {
|
|
6784
|
+
if (value === inputValue) {
|
|
6785
|
+
return;
|
|
6786
|
+
}
|
|
6787
|
+
handleSelectedVariableChange(value);
|
|
6788
|
+
},
|
|
6789
|
+
inputWhenNoVariables: body,
|
|
6790
|
+
disableVariables: !enableDynamicInputToResultId
|
|
6791
|
+
}
|
|
6792
|
+
) : body }),
|
|
6793
|
+
children
|
|
6794
|
+
] }) });
|
|
6795
|
+
};
|
|
6796
|
+
var DefaultResultList = () => {
|
|
6797
|
+
var _a;
|
|
6798
|
+
const { list } = useObjectSearchContext();
|
|
6799
|
+
if (!list.items) {
|
|
6800
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6801
|
+
}
|
|
6802
|
+
if (list.items.length === 0) {
|
|
6803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Callout, { type: "info", children: "No results were found" });
|
|
6804
|
+
}
|
|
6805
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
6806
|
+
};
|
|
6670
6807
|
|
|
6671
|
-
// src/components/ObjectSearch/
|
|
6808
|
+
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6672
6809
|
var import_design_system36 = require("@uniformdev/design-system");
|
|
6810
|
+
var import_react70 = require("react");
|
|
6811
|
+
|
|
6812
|
+
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6813
|
+
var import_react69 = require("@emotion/react");
|
|
6814
|
+
var ObjectSearchFilterContainerLabel = import_react69.css`
|
|
6815
|
+
align-items: center;
|
|
6816
|
+
display: flex;
|
|
6817
|
+
font-size: var(--fs-sm);
|
|
6818
|
+
font-weight: var(--fw-bold);
|
|
6819
|
+
line-height: 1rem;
|
|
6820
|
+
margin-bottom: var(--spacing-sm);
|
|
6821
|
+
`;
|
|
6822
|
+
var ObjectSearchFilterContainer = import_react69.css`
|
|
6823
|
+
display: grid;
|
|
6824
|
+
gap: var(--spacing-base);
|
|
6825
|
+
`;
|
|
6826
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react69.css`
|
|
6827
|
+
display: grid;
|
|
6828
|
+
grid-template-columns: ${gridColumns};
|
|
6829
|
+
gap: var(--spacing-base);
|
|
6830
|
+
`;
|
|
6831
|
+
|
|
6832
|
+
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6833
|
+
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6834
|
+
var ObjectSearchFilter = ({
|
|
6835
|
+
requireContentType,
|
|
6836
|
+
typeSelectorAllTypesOptionText = "All content types",
|
|
6837
|
+
searchInputName = "searchText",
|
|
6838
|
+
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
6839
|
+
selectLabel = "Content Type Select",
|
|
6840
|
+
selectOptions
|
|
6841
|
+
}) => {
|
|
6842
|
+
var _a, _b;
|
|
6843
|
+
const { query, onSetQuery } = useObjectSearchContext();
|
|
6844
|
+
const [searchState, setSearchState] = (0, import_react70.useState)({
|
|
6845
|
+
contentType: (_a = query.contentType) != null ? _a : "",
|
|
6846
|
+
keyword: (_b = query.keyword) != null ? _b : ""
|
|
6847
|
+
});
|
|
6848
|
+
const handleFilterChange = (value) => {
|
|
6849
|
+
setSearchState((prev) => {
|
|
6850
|
+
return { ...prev, ...value };
|
|
6851
|
+
});
|
|
6852
|
+
onSetQuery({ ...query, ...value });
|
|
6853
|
+
};
|
|
6854
|
+
const memoizedSelectOptions = (0, import_react70.useMemo)(() => {
|
|
6855
|
+
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6856
|
+
return [];
|
|
6857
|
+
}
|
|
6858
|
+
return [
|
|
6859
|
+
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
6860
|
+
...selectOptions != null ? selectOptions : []
|
|
6861
|
+
];
|
|
6862
|
+
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6863
|
+
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6865
|
+
"fieldset",
|
|
6866
|
+
{
|
|
6867
|
+
css: [
|
|
6868
|
+
ObjectSearchFilterContainer,
|
|
6869
|
+
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6870
|
+
],
|
|
6871
|
+
children: [
|
|
6872
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6873
|
+
import_design_system36.InputSelect,
|
|
6874
|
+
{
|
|
6875
|
+
label: selectLabel,
|
|
6876
|
+
showLabel: false,
|
|
6877
|
+
onChange: (e) => handleFilterChange({ contentType: e.target.value }),
|
|
6878
|
+
options: memoizedSelectOptions,
|
|
6879
|
+
value: query.contentType
|
|
6880
|
+
}
|
|
6881
|
+
) : null,
|
|
6882
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6883
|
+
import_design_system36.DebouncedInputKeywordSearch,
|
|
6884
|
+
{
|
|
6885
|
+
inputFieldName: searchInputName,
|
|
6886
|
+
placeholder: searchInputPlaceholderText,
|
|
6887
|
+
onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
|
|
6888
|
+
disabledFieldSubmission: true,
|
|
6889
|
+
defaultValue: searchState.keyword,
|
|
6890
|
+
delay: 300
|
|
6891
|
+
}
|
|
6892
|
+
)
|
|
6893
|
+
]
|
|
6894
|
+
}
|
|
6895
|
+
);
|
|
6896
|
+
};
|
|
6897
|
+
|
|
6898
|
+
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6899
|
+
var import_jsx_runtime63 = require("@emotion/react/jsx-runtime");
|
|
6900
|
+
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { children: [
|
|
6902
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6903
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6904
|
+
] });
|
|
6905
|
+
};
|
|
6906
|
+
|
|
6907
|
+
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6908
|
+
var import_design_system38 = require("@uniformdev/design-system");
|
|
6673
6909
|
var import_timeago3 = require("timeago.js");
|
|
6674
6910
|
|
|
6675
6911
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6676
|
-
var
|
|
6677
|
-
var
|
|
6678
|
-
var ButtonStyles =
|
|
6679
|
-
${
|
|
6912
|
+
var import_react71 = require("@emotion/react");
|
|
6913
|
+
var import_design_system37 = require("@uniformdev/design-system");
|
|
6914
|
+
var ButtonStyles = import_react71.css`
|
|
6915
|
+
${import_design_system37.button}
|
|
6680
6916
|
background: transparent;
|
|
6681
6917
|
border: 1px solid var(--typography-base);
|
|
6682
6918
|
color: var(--typography-base);
|
|
@@ -6702,20 +6938,20 @@ var ButtonStyles = import_react69.css`
|
|
|
6702
6938
|
text-decoration: none;
|
|
6703
6939
|
}
|
|
6704
6940
|
`;
|
|
6705
|
-
var ButtonIcon =
|
|
6941
|
+
var ButtonIcon = import_react71.css`
|
|
6706
6942
|
width: 1rem;
|
|
6707
6943
|
height: 1rem;
|
|
6708
6944
|
`;
|
|
6709
6945
|
|
|
6710
6946
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6711
|
-
var
|
|
6947
|
+
var import_jsx_runtime64 = require("@emotion/react/jsx-runtime");
|
|
6712
6948
|
var ObjectSearchResultItemButton = ({
|
|
6713
6949
|
text,
|
|
6714
6950
|
icon,
|
|
6715
6951
|
...props
|
|
6716
6952
|
}) => {
|
|
6717
|
-
return /* @__PURE__ */ (0,
|
|
6718
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
6954
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6719
6955
|
text
|
|
6720
6956
|
] });
|
|
6721
6957
|
};
|
|
@@ -6724,15 +6960,15 @@ var LinkButton = ({
|
|
|
6724
6960
|
icon,
|
|
6725
6961
|
...props
|
|
6726
6962
|
}) => {
|
|
6727
|
-
return /* @__PURE__ */ (0,
|
|
6728
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6964
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6729
6965
|
text
|
|
6730
6966
|
] });
|
|
6731
6967
|
};
|
|
6732
6968
|
|
|
6733
6969
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6734
|
-
var
|
|
6735
|
-
var ObjectSearchResultItemContainer =
|
|
6970
|
+
var import_react72 = require("@emotion/react");
|
|
6971
|
+
var ObjectSearchResultItemContainer = import_react72.css`
|
|
6736
6972
|
align-items: center;
|
|
6737
6973
|
border: 1px solid var(--gray-300);
|
|
6738
6974
|
border-radius: var(--rounded-base);
|
|
@@ -6748,7 +6984,7 @@ var ObjectSearchResultItemContainer = import_react70.css`
|
|
|
6748
6984
|
}
|
|
6749
6985
|
}
|
|
6750
6986
|
`;
|
|
6751
|
-
var ObjectSearchDragHandle =
|
|
6987
|
+
var ObjectSearchDragHandle = import_react72.css`
|
|
6752
6988
|
border-left: 2px dotted var(--gray-300);
|
|
6753
6989
|
border-right: 2px dotted var(--gray-300);
|
|
6754
6990
|
position: absolute;
|
|
@@ -6757,41 +6993,41 @@ var ObjectSearchDragHandle = import_react70.css`
|
|
|
6757
6993
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6758
6994
|
opacity: 0;
|
|
6759
6995
|
`;
|
|
6760
|
-
var ObjectSearchResultItemSubtitle =
|
|
6996
|
+
var ObjectSearchResultItemSubtitle = import_react72.css`
|
|
6761
6997
|
color: var(--gray-500);
|
|
6762
6998
|
display: block;
|
|
6763
6999
|
font-size: var(--fs-xs);
|
|
6764
7000
|
line-height: 1;
|
|
6765
7001
|
`;
|
|
6766
|
-
var ObjectSearchResultItemTitle =
|
|
7002
|
+
var ObjectSearchResultItemTitle = import_react72.css`
|
|
6767
7003
|
align-items: center;
|
|
6768
7004
|
color: var(--typography-base);
|
|
6769
7005
|
display: flex;
|
|
6770
7006
|
gap: var(--spacing-xs);
|
|
6771
7007
|
`;
|
|
6772
|
-
var ObjectSearchResultItemTimeStamp =
|
|
7008
|
+
var ObjectSearchResultItemTimeStamp = import_react72.css`
|
|
6773
7009
|
color: var(--gray-500);
|
|
6774
7010
|
font-size: var(--fs-xs);
|
|
6775
7011
|
`;
|
|
6776
|
-
var ObjectSearchAuthorStateGroup =
|
|
7012
|
+
var ObjectSearchAuthorStateGroup = import_react72.css`
|
|
6777
7013
|
align-items: center;
|
|
6778
7014
|
display: flex;
|
|
6779
7015
|
gap: var(--spacing-sm);
|
|
6780
7016
|
`;
|
|
6781
|
-
var ObjectSearchUpdateGroup =
|
|
7017
|
+
var ObjectSearchUpdateGroup = import_react72.css`
|
|
6782
7018
|
display: grid;
|
|
6783
7019
|
`;
|
|
6784
|
-
var ObjectSearchContentContainer =
|
|
7020
|
+
var ObjectSearchContentContainer = import_react72.css`
|
|
6785
7021
|
display: flex;
|
|
6786
7022
|
gap: var(--spacing-base);
|
|
6787
7023
|
`;
|
|
6788
|
-
var ObjectSearchImage =
|
|
7024
|
+
var ObjectSearchImage = import_react72.css`
|
|
6789
7025
|
width: 56px;
|
|
6790
7026
|
object-fit: contain;
|
|
6791
7027
|
`;
|
|
6792
7028
|
|
|
6793
7029
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6794
|
-
var
|
|
7030
|
+
var import_jsx_runtime65 = require("@emotion/react/jsx-runtime");
|
|
6795
7031
|
var ObjectSearchResultItem = ({
|
|
6796
7032
|
id,
|
|
6797
7033
|
title,
|
|
@@ -6815,66 +7051,70 @@ var ObjectSearchResultItem = ({
|
|
|
6815
7051
|
onSelectItem({ id, title: id });
|
|
6816
7052
|
onRemove == null ? void 0 : onRemove();
|
|
6817
7053
|
};
|
|
6818
|
-
return /* @__PURE__ */ (0,
|
|
6819
|
-
disableDnD ? null : /* @__PURE__ */ (0,
|
|
6820
|
-
/* @__PURE__ */ (0,
|
|
6821
|
-
!imageUrl ? null : /* @__PURE__ */ (0,
|
|
6822
|
-
/* @__PURE__ */ (0,
|
|
6823
|
-
/* @__PURE__ */ (0,
|
|
6824
|
-
/* @__PURE__ */ (0,
|
|
7054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
|
|
7055
|
+
disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
7056
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchContentContainer, children: [
|
|
7057
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
7058
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { children: [
|
|
7059
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
7060
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
6825
7061
|
title != null ? title : name,
|
|
6826
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
7062
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6827
7063
|
] }),
|
|
6828
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0,
|
|
6829
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0,
|
|
6830
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0,
|
|
6831
|
-
!createdAt ? null : /* @__PURE__ */ (0,
|
|
6832
|
-
/* @__PURE__ */ (0,
|
|
7064
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
7065
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
7066
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
|
|
7067
|
+
!createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
7068
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("strong", { children: "Last updated: " }),
|
|
6833
7069
|
(0, import_timeago3.format)(createdAt)
|
|
6834
7070
|
] }),
|
|
6835
|
-
!publishedAt ? null : /* @__PURE__ */ (0,
|
|
6836
|
-
/* @__PURE__ */ (0,
|
|
7071
|
+
!publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
7072
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("strong", { children: "Last published: " }),
|
|
6837
7073
|
(0, import_timeago3.format)(publishedAt)
|
|
6838
7074
|
] })
|
|
6839
7075
|
] })
|
|
6840
7076
|
] }),
|
|
6841
|
-
/* @__PURE__ */ (0,
|
|
7077
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children })
|
|
6842
7078
|
] })
|
|
6843
7079
|
] }) }),
|
|
6844
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6845
|
-
!editLink ? null : /* @__PURE__ */ (0,
|
|
6846
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
7080
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
7081
|
+
!editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
7082
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
6847
7083
|
] })
|
|
6848
7084
|
] });
|
|
6849
7085
|
};
|
|
6850
7086
|
|
|
7087
|
+
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
7088
|
+
var import_design_system39 = require("@uniformdev/design-system");
|
|
7089
|
+
var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
|
|
7090
|
+
|
|
6851
7091
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6852
|
-
var
|
|
6853
|
-
var ObjectSearchResultListContainer =
|
|
7092
|
+
var import_react73 = require("@emotion/react");
|
|
7093
|
+
var ObjectSearchResultListContainer = import_react73.css`
|
|
6854
7094
|
align-items: center;
|
|
6855
7095
|
display: flex;
|
|
6856
7096
|
gap: var(--spacing-sm);
|
|
6857
7097
|
justify-content: space-between;
|
|
6858
7098
|
`;
|
|
6859
|
-
var ObjectSearchDragContainer =
|
|
7099
|
+
var ObjectSearchDragContainer = import_react73.css`
|
|
6860
7100
|
margin: 0 0 var(--spacing-sm);
|
|
6861
7101
|
`;
|
|
6862
|
-
var ObjectSearchContainerDragging =
|
|
7102
|
+
var ObjectSearchContainerDragging = import_react73.css`
|
|
6863
7103
|
box-shadow: var(--shadow-base);
|
|
6864
7104
|
opacity: var(--opacity-50);
|
|
6865
7105
|
`;
|
|
6866
|
-
var ObjectSearchResultListCounterContainer =
|
|
7106
|
+
var ObjectSearchResultListCounterContainer = import_react73.css`
|
|
6867
7107
|
align-items: center;
|
|
6868
7108
|
display: flex;
|
|
6869
7109
|
gap: var(--spacing-sm);
|
|
6870
7110
|
`;
|
|
6871
|
-
var ObjectSearchResultListTitle =
|
|
7111
|
+
var ObjectSearchResultListTitle = import_react73.css`
|
|
6872
7112
|
font-weight: var(--fw-bold);
|
|
6873
7113
|
line-height: 1;
|
|
6874
7114
|
`;
|
|
6875
7115
|
|
|
6876
7116
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6877
|
-
var
|
|
7117
|
+
var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
|
|
6878
7118
|
function ObjectSearchResultList({
|
|
6879
7119
|
resultLabelText = "Selected",
|
|
6880
7120
|
removeButtonText = "Remove all",
|
|
@@ -6882,13 +7122,13 @@ function ObjectSearchResultList({
|
|
|
6882
7122
|
hideRemoveButton = false,
|
|
6883
7123
|
resultLabelOverride,
|
|
6884
7124
|
additionalButtons,
|
|
6885
|
-
renderResultComponent = (value) => /* @__PURE__ */ (0,
|
|
7125
|
+
renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ObjectSearchResultItem, { ...value }),
|
|
6886
7126
|
multiSelectId,
|
|
6887
7127
|
disableDnD = false,
|
|
6888
7128
|
getContainerForDnDReparenting,
|
|
6889
|
-
whenNothingSelected
|
|
7129
|
+
whenNothingSelected = null
|
|
6890
7130
|
}) {
|
|
6891
|
-
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem
|
|
7131
|
+
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useObjectSearchContext();
|
|
6892
7132
|
const handleRemoveAllSelectedItems = () => {
|
|
6893
7133
|
onRemoveAllSelectedItems();
|
|
6894
7134
|
onRemoveAllSelected == null ? void 0 : onRemoveAllSelected();
|
|
@@ -6909,7 +7149,7 @@ function ObjectSearchResultList({
|
|
|
6909
7149
|
...item,
|
|
6910
7150
|
disableDnD: selectedListItems.length === 1 || disableDnD
|
|
6911
7151
|
});
|
|
6912
|
-
return /* @__PURE__ */ (0,
|
|
7152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6913
7153
|
"div",
|
|
6914
7154
|
{
|
|
6915
7155
|
css: [
|
|
@@ -6924,20 +7164,17 @@ function ObjectSearchResultList({
|
|
|
6924
7164
|
}
|
|
6925
7165
|
);
|
|
6926
7166
|
};
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
6932
|
-
!resultLabelOverride ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
6933
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
7167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
7168
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
7169
|
+
!resultLabelOverride ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
7170
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
6934
7171
|
" ",
|
|
6935
|
-
!selectedListItems.length ? null : /* @__PURE__ */ (0,
|
|
7172
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_design_system39.Counter, { count: selectedListItems.length })
|
|
6936
7173
|
] }) : resultLabelOverride,
|
|
6937
|
-
/* @__PURE__ */ (0,
|
|
7174
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
6938
7175
|
additionalButtons,
|
|
6939
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6940
|
-
|
|
7176
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7177
|
+
import_design_system39.Button,
|
|
6941
7178
|
{
|
|
6942
7179
|
buttonType: "ghostDestructive",
|
|
6943
7180
|
size: "xs",
|
|
@@ -6948,17 +7185,15 @@ function ObjectSearchResultList({
|
|
|
6948
7185
|
)
|
|
6949
7186
|
] })
|
|
6950
7187
|
] }),
|
|
6951
|
-
|
|
6952
|
-
showEmptyResults ? whenNothingSelected : null,
|
|
6953
|
-
showResults ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7188
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6954
7189
|
import_react_beautiful_dnd4.Droppable,
|
|
6955
7190
|
{
|
|
6956
7191
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
6957
7192
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
6958
7193
|
getContainerForClone: getContainerForDnDReparenting,
|
|
6959
|
-
children: (provided) => /* @__PURE__ */ (0,
|
|
7194
|
+
children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
6960
7195
|
selectedListItems.map((item, i) => {
|
|
6961
|
-
return /* @__PURE__ */ (0,
|
|
7196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6962
7197
|
import_react_beautiful_dnd4.Draggable,
|
|
6963
7198
|
{
|
|
6964
7199
|
draggableId: item.id,
|
|
@@ -6972,293 +7207,29 @@ function ObjectSearchResultList({
|
|
|
6972
7207
|
provided.placeholder
|
|
6973
7208
|
] })
|
|
6974
7209
|
}
|
|
6975
|
-
) })
|
|
7210
|
+
) })
|
|
6976
7211
|
] });
|
|
6977
7212
|
}
|
|
6978
7213
|
|
|
6979
|
-
// src/components/ObjectSearch/
|
|
6980
|
-
var
|
|
6981
|
-
var
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
{
|
|
6999
|
-
role: "list",
|
|
7000
|
-
css: import_react72.css`
|
|
7001
|
-
> div {
|
|
7002
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
7003
|
-
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
7004
|
-
}
|
|
7005
|
-
`,
|
|
7006
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DefaultResultList, {})
|
|
7007
|
-
}
|
|
7008
|
-
);
|
|
7009
|
-
const handleSelectedVariableChange = (selectedValue) => {
|
|
7010
|
-
var _a2;
|
|
7011
|
-
if (!selectedValue) {
|
|
7012
|
-
onSelectItem([]);
|
|
7013
|
-
return;
|
|
7014
|
-
}
|
|
7015
|
-
const { result, errors } = (0, import_canvas9.bindVariables)({
|
|
7016
|
-
value: selectedValue,
|
|
7017
|
-
variables: flatVariables,
|
|
7018
|
-
errorPrefix: "Dynamic input"
|
|
7019
|
-
});
|
|
7020
|
-
if (!result) {
|
|
7021
|
-
onSelectItem([]);
|
|
7022
|
-
return;
|
|
7023
|
-
}
|
|
7024
|
-
const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
|
|
7025
|
-
onSelectItem([
|
|
7026
|
-
{
|
|
7027
|
-
title: selectedValue,
|
|
7028
|
-
contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
|
|
7029
|
-
// spread any matched list item, overriding the above default props
|
|
7030
|
-
...item,
|
|
7031
|
-
// we want to make sure the ID is our dynamic value
|
|
7032
|
-
id: selectedValue
|
|
7033
|
-
}
|
|
7034
|
-
]);
|
|
7035
|
-
if (hasReferencedVariables(selectedValue)) {
|
|
7036
|
-
onSetQuery({ ...query, dynamicEntryId: selectedValue });
|
|
7037
|
-
}
|
|
7038
|
-
};
|
|
7039
|
-
const showSearchList = !label || !isDynamicEntryIdAvailable || !enableDynamicInputToResultId;
|
|
7040
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_design_system38.VerticalRhythm, { children: [
|
|
7041
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_design_system38.VerticalRhythm, { children: [
|
|
7042
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
7043
|
-
InputVariables,
|
|
7044
|
-
{
|
|
7045
|
-
id: "entryId",
|
|
7046
|
-
label,
|
|
7047
|
-
value: inputValue,
|
|
7048
|
-
onChange: (value) => {
|
|
7049
|
-
if (value === inputValue) {
|
|
7050
|
-
return;
|
|
7051
|
-
}
|
|
7052
|
-
handleSelectedVariableChange(value);
|
|
7053
|
-
},
|
|
7054
|
-
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: searchFilters }),
|
|
7055
|
-
disableVariables: !enableDynamicInputToResultId
|
|
7056
|
-
}
|
|
7057
|
-
) : searchFilters,
|
|
7058
|
-
showSearchList ? listItems : null
|
|
7059
|
-
] }) }),
|
|
7060
|
-
children
|
|
7061
|
-
] }) });
|
|
7062
|
-
};
|
|
7063
|
-
var DefaultResultList = () => {
|
|
7064
|
-
var _a, _b;
|
|
7065
|
-
const { list, isListLoading } = useObjectSearchContext();
|
|
7066
|
-
if (isListLoading || !list.items) {
|
|
7067
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
7068
|
-
}
|
|
7069
|
-
if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
|
|
7070
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.Callout, { type: "info", children: "No results were found" });
|
|
7071
|
-
}
|
|
7072
|
-
return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
7073
|
-
};
|
|
7074
|
-
|
|
7075
|
-
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
7076
|
-
var import_design_system39 = require("@uniformdev/design-system");
|
|
7077
|
-
var import_react76 = require("react");
|
|
7078
|
-
var import_react_use5 = require("react-use");
|
|
7079
|
-
|
|
7080
|
-
// src/utils/createLocationValidator.ts
|
|
7081
|
-
function createLocationValidator(setValue, validate) {
|
|
7082
|
-
return (dispatch) => setValue((previous) => {
|
|
7083
|
-
const { newValue, options } = dispatch(previous);
|
|
7084
|
-
return { newValue, options: validate(newValue, options) };
|
|
7085
|
-
});
|
|
7086
|
-
}
|
|
7087
|
-
|
|
7088
|
-
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7089
|
-
var import_canvas10 = require("@uniformdev/canvas");
|
|
7090
|
-
var import_react74 = require("react");
|
|
7091
|
-
function useContentDataResourceLocaleInfo({
|
|
7092
|
-
locale,
|
|
7093
|
-
setLocale,
|
|
7094
|
-
dynamicInputs
|
|
7095
|
-
}) {
|
|
7096
|
-
var _a;
|
|
7097
|
-
const setLocaleRef = (0, import_react74.useRef)(setLocale);
|
|
7098
|
-
setLocaleRef.current = setLocale;
|
|
7099
|
-
const { flatVariables } = useVariables();
|
|
7100
|
-
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
7101
|
-
const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7102
|
-
(0, import_react74.useEffect)(() => {
|
|
7103
|
-
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7104
|
-
setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
|
|
7105
|
-
}
|
|
7106
|
-
}, [locale, effectiveLocale]);
|
|
7107
|
-
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
7108
|
-
}
|
|
7109
|
-
|
|
7110
|
-
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
7111
|
-
var import_react75 = require("@emotion/react");
|
|
7112
|
-
var ObjectSearchFilterContainerLabel = import_react75.css`
|
|
7113
|
-
align-items: center;
|
|
7114
|
-
display: flex;
|
|
7115
|
-
font-size: var(--fs-sm);
|
|
7116
|
-
font-weight: var(--fw-bold);
|
|
7117
|
-
line-height: 1rem;
|
|
7118
|
-
margin-bottom: var(--spacing-sm);
|
|
7119
|
-
`;
|
|
7120
|
-
var ObjectSearchFilterContainer = import_react75.css`
|
|
7121
|
-
display: grid;
|
|
7122
|
-
gap: var(--spacing-base);
|
|
7123
|
-
`;
|
|
7124
|
-
var ObjectSearchFilterGrid = (gridColumns) => import_react75.css`
|
|
7125
|
-
display: grid;
|
|
7126
|
-
grid-template-columns: ${gridColumns};
|
|
7127
|
-
gap: var(--spacing-base);
|
|
7128
|
-
`;
|
|
7129
|
-
|
|
7130
|
-
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
7131
|
-
var import_jsx_runtime65 = require("@emotion/react/jsx-runtime");
|
|
7132
|
-
var ObjectSearchFilter = ({
|
|
7133
|
-
requireContentType,
|
|
7134
|
-
typeSelectorAllTypesOptionText = "All content types",
|
|
7135
|
-
searchInputName = "searchText",
|
|
7136
|
-
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
7137
|
-
selectLabel = "Content Type Select",
|
|
7138
|
-
localeFilterLabel = "Filter by locale",
|
|
7139
|
-
selectOptions
|
|
7140
|
-
}) => {
|
|
7141
|
-
var _a, _b, _c;
|
|
7142
|
-
const { query, onSetQuery, localeOptions, enableFilterByLocale } = useObjectSearchContext();
|
|
7143
|
-
const dynamicInputs = useDataResourceDynamicInputs();
|
|
7144
|
-
const { boundLocale = "", effectiveLocale } = useContentDataResourceLocaleInfo({
|
|
7145
|
-
locale: query.locale,
|
|
7146
|
-
dynamicInputs: dynamicInputs != null ? dynamicInputs : {},
|
|
7147
|
-
setLocale: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" })
|
|
7148
|
-
});
|
|
7149
|
-
const [searchState, setSearchState] = (0, import_react76.useState)({
|
|
7150
|
-
keyword: (_a = query.keyword) != null ? _a : "",
|
|
7151
|
-
contentType: (_b = query.contentType) != null ? _b : "",
|
|
7152
|
-
locale: (_c = query.locale) != null ? _c : ""
|
|
7153
|
-
});
|
|
7154
|
-
const handleFilterChange = (value) => {
|
|
7155
|
-
setSearchState((prev) => {
|
|
7156
|
-
return { ...prev, ...value };
|
|
7157
|
-
});
|
|
7158
|
-
};
|
|
7159
|
-
(0, import_react_use5.useDebounce)(
|
|
7160
|
-
() => {
|
|
7161
|
-
onSetQuery({ ...query, ...searchState });
|
|
7162
|
-
},
|
|
7163
|
-
500,
|
|
7164
|
-
[searchState]
|
|
7165
|
-
);
|
|
7166
|
-
const memoizedSelectOptions = (0, import_react76.useMemo)(() => {
|
|
7167
|
-
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
7168
|
-
return [];
|
|
7169
|
-
}
|
|
7170
|
-
return [
|
|
7171
|
-
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
7172
|
-
...selectOptions != null ? selectOptions : []
|
|
7173
|
-
];
|
|
7174
|
-
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
7175
|
-
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
7176
|
-
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_design_system39.VerticalRhythm, { gap: "base", children: [
|
|
7177
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
7178
|
-
"fieldset",
|
|
7179
|
-
{
|
|
7180
|
-
css: [
|
|
7181
|
-
ObjectSearchFilterContainer,
|
|
7182
|
-
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
7183
|
-
],
|
|
7184
|
-
children: [
|
|
7185
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7186
|
-
import_design_system39.InputSelect,
|
|
7187
|
-
{
|
|
7188
|
-
label: selectLabel,
|
|
7189
|
-
showLabel: false,
|
|
7190
|
-
onChange: (e) => handleFilterChange({ contentType: e.target.value }),
|
|
7191
|
-
options: memoizedSelectOptions,
|
|
7192
|
-
value: query.contentType,
|
|
7193
|
-
"data-testid": "select-entry"
|
|
7194
|
-
}
|
|
7195
|
-
) : null,
|
|
7196
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7197
|
-
import_design_system39.DebouncedInputKeywordSearch,
|
|
7198
|
-
{
|
|
7199
|
-
inputFieldName: searchInputName,
|
|
7200
|
-
placeholder: searchInputPlaceholderText,
|
|
7201
|
-
onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
|
|
7202
|
-
disabledFieldSubmission: true,
|
|
7203
|
-
defaultValue: searchState.keyword,
|
|
7204
|
-
delay: 300
|
|
7205
|
-
}
|
|
7206
|
-
)
|
|
7207
|
-
]
|
|
7208
|
-
}
|
|
7209
|
-
),
|
|
7210
|
-
enableFilterByLocale && (localeOptions == null ? void 0 : localeOptions.length) && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7211
|
-
InputVariables,
|
|
7212
|
-
{
|
|
7213
|
-
label: localeFilterLabel,
|
|
7214
|
-
id: "locale",
|
|
7215
|
-
value: effectiveLocale,
|
|
7216
|
-
onChange: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" }),
|
|
7217
|
-
disableInlineMenu: true,
|
|
7218
|
-
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7219
|
-
import_design_system39.InputSelect,
|
|
7220
|
-
{
|
|
7221
|
-
id: "locale",
|
|
7222
|
-
options: localeOptions,
|
|
7223
|
-
name: "locale",
|
|
7224
|
-
label: "",
|
|
7225
|
-
value: boundLocale,
|
|
7226
|
-
onChange: (e) => handleFilterChange({ locale: e.target.value })
|
|
7227
|
-
}
|
|
7228
|
-
)
|
|
7229
|
-
}
|
|
7230
|
-
)
|
|
7231
|
-
] });
|
|
7232
|
-
};
|
|
7233
|
-
|
|
7234
|
-
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
7235
|
-
var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
|
|
7236
|
-
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
7237
|
-
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { children: [
|
|
7238
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
7239
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
7240
|
-
] });
|
|
7241
|
-
};
|
|
7242
|
-
|
|
7243
|
-
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7244
|
-
var import_design_system40 = require("@uniformdev/design-system");
|
|
7245
|
-
var import_react77 = require("react");
|
|
7246
|
-
var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
|
|
7247
|
-
var QueryFilter = ({
|
|
7248
|
-
requireContentType,
|
|
7249
|
-
queryFilterTitle = "Configure Query",
|
|
7250
|
-
contentTypeLabel = "Filter by content type",
|
|
7251
|
-
typeSelectorAllTypesOptionText = "All content types",
|
|
7252
|
-
contentTypeOptions,
|
|
7253
|
-
searchInputName = "searchText",
|
|
7254
|
-
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
7255
|
-
searchInputLabel = "Query",
|
|
7256
|
-
countLabel = "Count",
|
|
7257
|
-
countValue = 5,
|
|
7258
|
-
sortLabel = "Sort By",
|
|
7259
|
-
sortOptions,
|
|
7260
|
-
sortOrderLabel = "Sort Order",
|
|
7261
|
-
sortOrderOptions = [
|
|
7214
|
+
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7215
|
+
var import_design_system40 = require("@uniformdev/design-system");
|
|
7216
|
+
var import_react74 = require("react");
|
|
7217
|
+
var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
|
|
7218
|
+
var QueryFilter = ({
|
|
7219
|
+
requireContentType,
|
|
7220
|
+
queryFilterTitle = "Configure Query",
|
|
7221
|
+
contentTypeLabel = "Filter by content type",
|
|
7222
|
+
typeSelectorAllTypesOptionText = "All content types",
|
|
7223
|
+
contentTypeOptions,
|
|
7224
|
+
searchInputName = "searchText",
|
|
7225
|
+
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
7226
|
+
searchInputLabel = "Query",
|
|
7227
|
+
countLabel = "Count",
|
|
7228
|
+
countValue = 5,
|
|
7229
|
+
sortLabel = "Sort By",
|
|
7230
|
+
sortOptions,
|
|
7231
|
+
sortOrderLabel = "Sort Order",
|
|
7232
|
+
sortOrderOptions = [
|
|
7262
7233
|
{
|
|
7263
7234
|
value: "asc",
|
|
7264
7235
|
label: "Ascending"
|
|
@@ -7272,7 +7243,7 @@ var QueryFilter = ({
|
|
|
7272
7243
|
}) => {
|
|
7273
7244
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
7274
7245
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
7275
|
-
const [queryState, setQueryState] = (0,
|
|
7246
|
+
const [queryState, setQueryState] = (0, import_react74.useState)({
|
|
7276
7247
|
contentType: (_a = query.contentType) != null ? _a : "",
|
|
7277
7248
|
keyword: (_b = query.keyword) != null ? _b : "",
|
|
7278
7249
|
count: (_c = query.count) != null ? _c : countValue,
|
|
@@ -7283,7 +7254,7 @@ var QueryFilter = ({
|
|
|
7283
7254
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7284
7255
|
onSetQuery({ ...query, ...value });
|
|
7285
7256
|
};
|
|
7286
|
-
(0,
|
|
7257
|
+
(0, import_react74.useEffect)(() => {
|
|
7287
7258
|
onSetQuery(queryState);
|
|
7288
7259
|
}, []);
|
|
7289
7260
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("fieldset", { children: [
|
|
@@ -7408,106 +7379,9 @@ var QueryFilter = ({
|
|
|
7408
7379
|
] });
|
|
7409
7380
|
};
|
|
7410
7381
|
|
|
7411
|
-
// src/components/ObjectSearch/ObjectSearchListOfSearchResults.tsx
|
|
7412
|
-
var import_design_system41 = require("@uniformdev/design-system");
|
|
7413
|
-
var import_jsx_runtime68 = require("@emotion/react/jsx-runtime");
|
|
7414
|
-
function ObjectSearchListOfSearchResults() {
|
|
7415
|
-
var _a, _b;
|
|
7416
|
-
const { list, isListLoading } = useObjectSearchContext();
|
|
7417
|
-
if (isListLoading) {
|
|
7418
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
7419
|
-
}
|
|
7420
|
-
if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
|
|
7421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system41.Callout, { type: "info", children: "No results were found" });
|
|
7422
|
-
}
|
|
7423
|
-
return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
7424
|
-
}
|
|
7425
|
-
|
|
7426
|
-
// src/components/ObjectSearch/hooks/ControlledObjectSearchProvider.tsx
|
|
7427
|
-
var import_react78 = require("react");
|
|
7428
|
-
var import_jsx_runtime69 = require("@emotion/react/jsx-runtime");
|
|
7429
|
-
var ControlledObjectSearchProvider = ({
|
|
7430
|
-
selectedItems,
|
|
7431
|
-
searchResultItems,
|
|
7432
|
-
isSelectedItemsListLoading,
|
|
7433
|
-
isSearchResultsLoading,
|
|
7434
|
-
onSelectItemsChange,
|
|
7435
|
-
isMulti = false,
|
|
7436
|
-
children,
|
|
7437
|
-
onQueryChange = () => {
|
|
7438
|
-
},
|
|
7439
|
-
query = {},
|
|
7440
|
-
enableFilterByLocale,
|
|
7441
|
-
localeOptions,
|
|
7442
|
-
dynamicEntryId
|
|
7443
|
-
}) => {
|
|
7444
|
-
const { flatVariables } = useVariables(true);
|
|
7445
|
-
const querySearchDeferred = (0, import_react78.useDeferredValue)(query);
|
|
7446
|
-
const onSetQuery = (0, import_react78.useCallback)(
|
|
7447
|
-
(value2) => {
|
|
7448
|
-
const newQuery = { ...query, ...value2 };
|
|
7449
|
-
onQueryChange(newQuery);
|
|
7450
|
-
},
|
|
7451
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7452
|
-
[onQueryChange]
|
|
7453
|
-
);
|
|
7454
|
-
const onSelectItem = (0, import_react78.useCallback)(
|
|
7455
|
-
(selectedResult) => {
|
|
7456
|
-
if (Array.isArray(selectedResult)) {
|
|
7457
|
-
onSelectItemsChange(selectedResult);
|
|
7458
|
-
} else {
|
|
7459
|
-
if (selectedItems == null ? void 0 : selectedItems.some((item) => item.id === selectedResult.id)) {
|
|
7460
|
-
onSelectItemsChange(selectedItems.filter((item) => item.id !== selectedResult.id));
|
|
7461
|
-
} else {
|
|
7462
|
-
onSelectItemsChange([...selectedItems != null ? selectedItems : [], selectedResult]);
|
|
7463
|
-
}
|
|
7464
|
-
}
|
|
7465
|
-
},
|
|
7466
|
-
[onSelectItemsChange, selectedItems]
|
|
7467
|
-
);
|
|
7468
|
-
const onRemoveAllSelectedItems = (0, import_react78.useCallback)(() => {
|
|
7469
|
-
onSelectItemsChange([]);
|
|
7470
|
-
}, [onSelectItemsChange]);
|
|
7471
|
-
const list = (0, import_react78.useMemo)(() => ({ items: searchResultItems }), [searchResultItems]);
|
|
7472
|
-
const boundQuery = (0, import_react78.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
7473
|
-
const value = (0, import_react78.useMemo)(
|
|
7474
|
-
() => ({
|
|
7475
|
-
boundQuery,
|
|
7476
|
-
onSetQuery,
|
|
7477
|
-
query: querySearchDeferred,
|
|
7478
|
-
onSelectItem,
|
|
7479
|
-
selectedListItems: selectedItems != null ? selectedItems : [],
|
|
7480
|
-
onRemoveAllSelectedItems,
|
|
7481
|
-
list,
|
|
7482
|
-
isSelectedItemsListLoading,
|
|
7483
|
-
isListLoading: isSearchResultsLoading,
|
|
7484
|
-
isMulti,
|
|
7485
|
-
localeOptions,
|
|
7486
|
-
enableFilterByLocale,
|
|
7487
|
-
dynamicEntryId
|
|
7488
|
-
}),
|
|
7489
|
-
[
|
|
7490
|
-
boundQuery,
|
|
7491
|
-
onSetQuery,
|
|
7492
|
-
querySearchDeferred,
|
|
7493
|
-
onSelectItem,
|
|
7494
|
-
selectedItems,
|
|
7495
|
-
isSelectedItemsListLoading,
|
|
7496
|
-
isSearchResultsLoading,
|
|
7497
|
-
onRemoveAllSelectedItems,
|
|
7498
|
-
list,
|
|
7499
|
-
isMulti,
|
|
7500
|
-
localeOptions,
|
|
7501
|
-
enableFilterByLocale,
|
|
7502
|
-
dynamicEntryId
|
|
7503
|
-
]
|
|
7504
|
-
);
|
|
7505
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
7506
|
-
};
|
|
7507
|
-
|
|
7508
7382
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
7509
|
-
var
|
|
7510
|
-
var
|
|
7383
|
+
var import_react75 = require("react");
|
|
7384
|
+
var import_jsx_runtime68 = require("@emotion/react/jsx-runtime");
|
|
7511
7385
|
function ParamTypeDynamicDataProvider(props) {
|
|
7512
7386
|
const { children } = props;
|
|
7513
7387
|
const {
|
|
@@ -7515,11 +7389,11 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
7515
7389
|
} = useMeshLocation("paramType");
|
|
7516
7390
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
7517
7391
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
7518
|
-
const variables = (0,
|
|
7392
|
+
const variables = (0, import_react75.useMemo)(
|
|
7519
7393
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
7520
7394
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
7521
7395
|
);
|
|
7522
|
-
return /* @__PURE__ */ (0,
|
|
7396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(VariablesProvider, { value: variables, onChange: () => {
|
|
7523
7397
|
}, editVariableComponent: JsonMeshVariableEditor, children });
|
|
7524
7398
|
}
|
|
7525
7399
|
var JsonMeshVariableEditor = ({
|
|
@@ -7528,9 +7402,9 @@ var JsonMeshVariableEditor = ({
|
|
|
7528
7402
|
variable,
|
|
7529
7403
|
context
|
|
7530
7404
|
}) => {
|
|
7531
|
-
const sillyRef = (0,
|
|
7405
|
+
const sillyRef = (0, import_react75.useRef)(false);
|
|
7532
7406
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
7533
|
-
(0,
|
|
7407
|
+
(0, import_react75.useEffect)(() => {
|
|
7534
7408
|
if (sillyRef.current) {
|
|
7535
7409
|
return;
|
|
7536
7410
|
}
|
|
@@ -7558,59 +7432,2054 @@ var JsonMeshVariableEditor = ({
|
|
|
7558
7432
|
return null;
|
|
7559
7433
|
};
|
|
7560
7434
|
|
|
7561
|
-
// src/components/SearchAndFilter/
|
|
7562
|
-
var
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7435
|
+
// src/components/SearchAndFilter/constants.ts
|
|
7436
|
+
var NUMBER_OPERATORS = [
|
|
7437
|
+
{
|
|
7438
|
+
label: "equals...",
|
|
7439
|
+
symbol: "=",
|
|
7440
|
+
value: "eq",
|
|
7441
|
+
editorType: "number"
|
|
7442
|
+
},
|
|
7443
|
+
{
|
|
7444
|
+
label: "does not equal...",
|
|
7445
|
+
symbol: "\u2260",
|
|
7446
|
+
value: "neq",
|
|
7447
|
+
editorType: "number"
|
|
7448
|
+
},
|
|
7449
|
+
{
|
|
7450
|
+
label: "greater than...",
|
|
7451
|
+
symbol: ">",
|
|
7452
|
+
value: "gt",
|
|
7453
|
+
editorType: "number"
|
|
7454
|
+
},
|
|
7455
|
+
{
|
|
7456
|
+
label: "greater than or equal to...",
|
|
7457
|
+
symbol: "\u2265",
|
|
7458
|
+
value: "gte",
|
|
7459
|
+
editorType: "number"
|
|
7460
|
+
},
|
|
7461
|
+
{
|
|
7462
|
+
label: "less than...",
|
|
7463
|
+
symbol: "<",
|
|
7464
|
+
value: "lt",
|
|
7465
|
+
editorType: "number"
|
|
7466
|
+
},
|
|
7467
|
+
{
|
|
7468
|
+
label: "less than or equal to...",
|
|
7469
|
+
symbol: "\u2264",
|
|
7470
|
+
value: "lte",
|
|
7471
|
+
editorType: "number"
|
|
7472
|
+
},
|
|
7473
|
+
{
|
|
7474
|
+
label: "is empty",
|
|
7475
|
+
value: "ndef",
|
|
7476
|
+
editorType: "empty"
|
|
7477
|
+
},
|
|
7478
|
+
{
|
|
7479
|
+
label: "is between...",
|
|
7480
|
+
value: "between",
|
|
7481
|
+
editorType: "numberRange"
|
|
7482
|
+
},
|
|
7483
|
+
{
|
|
7484
|
+
label: "is not empty",
|
|
7485
|
+
value: "def",
|
|
7486
|
+
editorType: "empty"
|
|
7487
|
+
}
|
|
7488
|
+
];
|
|
7489
|
+
var DATE_OPERATORS = [
|
|
7490
|
+
{
|
|
7491
|
+
label: "is...",
|
|
7492
|
+
value: "eq",
|
|
7493
|
+
editorType: "date"
|
|
7494
|
+
},
|
|
7495
|
+
{
|
|
7496
|
+
label: "is between...",
|
|
7497
|
+
value: "between",
|
|
7498
|
+
editorType: "dateRange"
|
|
7499
|
+
},
|
|
7500
|
+
{
|
|
7501
|
+
label: "is before...",
|
|
7502
|
+
value: "lt",
|
|
7503
|
+
editorType: "date"
|
|
7504
|
+
},
|
|
7505
|
+
{
|
|
7506
|
+
label: "is after...",
|
|
7507
|
+
value: "gt",
|
|
7508
|
+
editorType: "date"
|
|
7509
|
+
},
|
|
7510
|
+
{
|
|
7511
|
+
label: "is on or before...",
|
|
7512
|
+
value: "lte",
|
|
7513
|
+
editorType: "date"
|
|
7514
|
+
},
|
|
7515
|
+
{
|
|
7516
|
+
label: "is on or after...",
|
|
7517
|
+
value: "gte",
|
|
7518
|
+
editorType: "date"
|
|
7519
|
+
},
|
|
7520
|
+
{
|
|
7521
|
+
label: "is empty",
|
|
7522
|
+
value: "ndef",
|
|
7523
|
+
editorType: "empty"
|
|
7524
|
+
},
|
|
7525
|
+
{
|
|
7526
|
+
label: "is not...",
|
|
7527
|
+
value: "neq",
|
|
7528
|
+
editorType: "date"
|
|
7529
|
+
},
|
|
7530
|
+
{
|
|
7531
|
+
label: "is not empty",
|
|
7532
|
+
value: "def",
|
|
7533
|
+
editorType: "empty"
|
|
7534
|
+
}
|
|
7535
|
+
];
|
|
7536
|
+
var TEXTBOX_OPERATORS = [
|
|
7537
|
+
{
|
|
7538
|
+
label: "is...",
|
|
7539
|
+
value: "eq",
|
|
7540
|
+
editorType: "text"
|
|
7541
|
+
},
|
|
7542
|
+
{
|
|
7543
|
+
label: "is empty",
|
|
7544
|
+
value: "ndef",
|
|
7545
|
+
editorType: "empty"
|
|
7546
|
+
},
|
|
7547
|
+
{
|
|
7548
|
+
label: "contains...",
|
|
7549
|
+
value: "match",
|
|
7550
|
+
editorType: "text"
|
|
7551
|
+
},
|
|
7552
|
+
{
|
|
7553
|
+
label: "starts with...",
|
|
7554
|
+
value: "starts",
|
|
7555
|
+
editorType: "text"
|
|
7556
|
+
},
|
|
7557
|
+
{
|
|
7558
|
+
label: "is not...",
|
|
7559
|
+
value: "neq",
|
|
7560
|
+
editorType: "text"
|
|
7561
|
+
},
|
|
7562
|
+
{
|
|
7563
|
+
label: "is not empty",
|
|
7564
|
+
value: "def",
|
|
7565
|
+
editorType: "empty"
|
|
7566
|
+
}
|
|
7567
|
+
];
|
|
7568
|
+
var USER_OPERATORS = [
|
|
7569
|
+
{
|
|
7570
|
+
label: "is...",
|
|
7571
|
+
value: "eq",
|
|
7572
|
+
editorType: "text"
|
|
7573
|
+
},
|
|
7574
|
+
{
|
|
7575
|
+
label: "contains...",
|
|
7576
|
+
value: "match",
|
|
7577
|
+
editorType: "text"
|
|
7578
|
+
},
|
|
7579
|
+
{
|
|
7580
|
+
label: "starts with...",
|
|
7581
|
+
value: "starts",
|
|
7582
|
+
editorType: "text"
|
|
7583
|
+
},
|
|
7584
|
+
{
|
|
7585
|
+
label: "is not...",
|
|
7586
|
+
value: "neq",
|
|
7587
|
+
editorType: "text"
|
|
7588
|
+
}
|
|
7589
|
+
];
|
|
7590
|
+
var SYSTEM_DATE_OPERATORS = [
|
|
7591
|
+
{
|
|
7592
|
+
label: "is...",
|
|
7593
|
+
value: "sys-date-eq",
|
|
7594
|
+
editorType: "date"
|
|
7595
|
+
},
|
|
7596
|
+
{
|
|
7597
|
+
label: "is between...",
|
|
7598
|
+
value: "sys-date-between",
|
|
7599
|
+
editorType: "dateRange"
|
|
7600
|
+
},
|
|
7601
|
+
{
|
|
7602
|
+
label: "is before...",
|
|
7603
|
+
value: "sys-date-lt",
|
|
7604
|
+
editorType: "date"
|
|
7605
|
+
},
|
|
7606
|
+
{
|
|
7607
|
+
label: "is after...",
|
|
7608
|
+
value: "sys-date-gt",
|
|
7609
|
+
editorType: "date"
|
|
7610
|
+
},
|
|
7611
|
+
{
|
|
7612
|
+
label: "is on or before...",
|
|
7613
|
+
value: "sys-date-lte",
|
|
7614
|
+
editorType: "date"
|
|
7615
|
+
},
|
|
7616
|
+
{
|
|
7617
|
+
label: "is on or after...",
|
|
7618
|
+
value: "sys-date-gte",
|
|
7619
|
+
editorType: "date"
|
|
7620
|
+
},
|
|
7621
|
+
{
|
|
7622
|
+
label: "is not...",
|
|
7623
|
+
value: "sys-date-neq",
|
|
7624
|
+
editorType: "date"
|
|
7625
|
+
}
|
|
7626
|
+
];
|
|
7627
|
+
var RICHTEXT_OPERATORS = [
|
|
7628
|
+
{
|
|
7629
|
+
label: "is empty",
|
|
7630
|
+
value: "ndef",
|
|
7631
|
+
editorType: "empty"
|
|
7632
|
+
},
|
|
7633
|
+
{
|
|
7634
|
+
label: "contains...",
|
|
7635
|
+
value: "match",
|
|
7636
|
+
editorType: "text"
|
|
7637
|
+
},
|
|
7638
|
+
{
|
|
7639
|
+
label: "starts with...",
|
|
7640
|
+
value: "starts",
|
|
7641
|
+
editorType: "text"
|
|
7642
|
+
},
|
|
7643
|
+
{
|
|
7644
|
+
label: "is not empty",
|
|
7645
|
+
value: "def",
|
|
7646
|
+
editorType: "empty"
|
|
7647
|
+
}
|
|
7648
|
+
];
|
|
7649
|
+
var CHECKBOX_OPERATORS = [
|
|
7650
|
+
{
|
|
7651
|
+
label: "is checked...",
|
|
7652
|
+
value: "def",
|
|
7653
|
+
editorType: "empty"
|
|
7654
|
+
},
|
|
7655
|
+
{
|
|
7656
|
+
label: "is not checked...",
|
|
7657
|
+
value: "ndef",
|
|
7658
|
+
editorType: "empty"
|
|
7659
|
+
}
|
|
7660
|
+
];
|
|
7661
|
+
var SYSTEM_FIELD_OPERATORS = [
|
|
7662
|
+
{
|
|
7663
|
+
label: "is...",
|
|
7664
|
+
value: "eq",
|
|
7665
|
+
editorType: "singleChoice"
|
|
7666
|
+
},
|
|
7667
|
+
{
|
|
7668
|
+
label: "is any of...",
|
|
7669
|
+
value: "in",
|
|
7670
|
+
editorType: "multiChoice"
|
|
7671
|
+
},
|
|
7672
|
+
{
|
|
7673
|
+
label: "is not...",
|
|
7674
|
+
value: "neq",
|
|
7675
|
+
editorType: "singleChoice"
|
|
7676
|
+
},
|
|
7677
|
+
{
|
|
7678
|
+
label: "is none of...",
|
|
7679
|
+
value: "nin",
|
|
7680
|
+
editorType: "multiChoice"
|
|
7681
|
+
}
|
|
7682
|
+
];
|
|
7683
|
+
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
7684
|
+
{
|
|
7685
|
+
label: "is...",
|
|
7686
|
+
value: "eq",
|
|
7687
|
+
editorType: "statusSingleChoice"
|
|
7688
|
+
},
|
|
7689
|
+
{
|
|
7690
|
+
label: "is any of...",
|
|
7691
|
+
value: "in",
|
|
7692
|
+
editorType: "statusMultiChoice"
|
|
7693
|
+
},
|
|
7694
|
+
{
|
|
7695
|
+
label: "is not...",
|
|
7696
|
+
value: "neq",
|
|
7697
|
+
editorType: "statusSingleChoice"
|
|
7698
|
+
},
|
|
7699
|
+
{
|
|
7700
|
+
label: "is none of...",
|
|
7701
|
+
value: "nin",
|
|
7702
|
+
editorType: "statusMultiChoice"
|
|
7703
|
+
}
|
|
7704
|
+
];
|
|
7705
|
+
|
|
7706
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7707
|
+
var import_design_system42 = require("@uniformdev/design-system");
|
|
7708
|
+
|
|
7709
|
+
// src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
|
|
7710
|
+
var import_react76 = require("@emotion/react");
|
|
7711
|
+
var import_design_system41 = require("@uniformdev/design-system");
|
|
7712
|
+
var SearchAndFilterControlsWrapper = (gridColumns) => import_react76.css`
|
|
7713
|
+
align-items: stretch;
|
|
7714
|
+
display: grid;
|
|
7715
|
+
grid-template-columns: ${gridColumns};
|
|
7716
|
+
gap: var(--spacing-sm);
|
|
7717
|
+
`;
|
|
7718
|
+
var SearchAndFilterOutterControlWrapper = (gridColumns) => import_react76.css`
|
|
7719
|
+
align-items: stretch;
|
|
7720
|
+
display: grid;
|
|
7721
|
+
grid-template-columns: ${gridColumns};
|
|
7722
|
+
gap: var(--spacing-sm);
|
|
7723
|
+
`;
|
|
7724
|
+
var ConditionalFilterRow = import_react76.css`
|
|
7725
|
+
display: grid;
|
|
7726
|
+
grid-template-columns: 35px 1fr;
|
|
7727
|
+
gap: var(--spacing-sm);
|
|
7728
|
+
margin-left: var(--spacing-base);
|
|
7729
|
+
|
|
7730
|
+
${(0, import_design_system41.cq)("380px")} {
|
|
7731
|
+
align-items: center;
|
|
7732
|
+
|
|
7733
|
+
&:after {
|
|
7734
|
+
content: '';
|
|
7735
|
+
display: block;
|
|
7736
|
+
height: 1px;
|
|
7737
|
+
background: var(--gray-300);
|
|
7738
|
+
width: calc(100% - var(--spacing-base));
|
|
7739
|
+
margin-left: var(--spacing-base);
|
|
7740
|
+
}
|
|
7741
|
+
&:last-of-type:after {
|
|
7742
|
+
display: none;
|
|
7743
|
+
}
|
|
7744
|
+
}
|
|
7745
|
+
|
|
7746
|
+
&:nth-of-type(2) {
|
|
7747
|
+
margin-left: 0;
|
|
7748
|
+
grid-template-columns: 50px 1fr;
|
|
7749
|
+
}
|
|
7750
|
+
|
|
7751
|
+
${(0, import_design_system41.cq)("580px")} {
|
|
7752
|
+
&:after {
|
|
7753
|
+
display: none;
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
|
|
7757
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
7758
|
+
animation: ${import_design_system41.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
7759
|
+
}
|
|
7760
|
+
`;
|
|
7761
|
+
var ConditionalInputRow = import_react76.css`
|
|
7762
|
+
display: flex;
|
|
7763
|
+
gap: var(--spacing-sm);
|
|
7764
|
+
flex-wrap: wrap;
|
|
7765
|
+
|
|
7766
|
+
${(0, import_design_system41.cq)("380px")} {
|
|
7767
|
+
& > div:nth-child(-n + 2) {
|
|
7768
|
+
width: calc(50% - var(--spacing-sm));
|
|
7769
|
+
}
|
|
7770
|
+
|
|
7771
|
+
& > div:nth-child(n + 3) {
|
|
7772
|
+
width: calc(100% - 48px);
|
|
7773
|
+
}
|
|
7774
|
+
}
|
|
7775
|
+
${(0, import_design_system41.cq)("764px")} {
|
|
7776
|
+
display: grid;
|
|
7777
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
7778
|
+
|
|
7779
|
+
& > div:nth-child(n) {
|
|
7780
|
+
width: auto;
|
|
7781
|
+
}
|
|
7782
|
+
}
|
|
7783
|
+
`;
|
|
7784
|
+
var SearchInput = import_react76.css`
|
|
7785
|
+
max-height: 40px;
|
|
7786
|
+
min-height: unset;
|
|
7787
|
+
`;
|
|
7788
|
+
var BindableKeywordSearchInputStyles = import_react76.css`
|
|
7789
|
+
position: relative;
|
|
7790
|
+
width: 100%;
|
|
7791
|
+
|
|
7792
|
+
& [data-lexical-editor='true'] {
|
|
7793
|
+
padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
7794
|
+
font-size: var(--fs-sm);
|
|
7795
|
+
border-radius: var(--rounded-full);
|
|
7796
|
+
max-height: 40px;
|
|
7797
|
+
min-height: unset;
|
|
7798
|
+
width: 100%;
|
|
7799
|
+
position: relative;
|
|
7800
|
+
white-space: nowrap;
|
|
7801
|
+
}
|
|
7802
|
+
`;
|
|
7803
|
+
var ClearSearchButtonContainer = import_react76.css`
|
|
7804
|
+
align-items: center;
|
|
7805
|
+
display: flex;
|
|
7806
|
+
position: absolute;
|
|
7807
|
+
inset: 0 var(--spacing-lg) 0 auto;
|
|
7808
|
+
`;
|
|
7809
|
+
var ClearSearchButtonStyles = import_react76.css`
|
|
7810
|
+
background: none;
|
|
7811
|
+
border: none;
|
|
7812
|
+
padding: 0;
|
|
7813
|
+
pointer-events: all;
|
|
7814
|
+
`;
|
|
7815
|
+
var FilterButton = import_react76.css`
|
|
7816
|
+
align-items: center;
|
|
7817
|
+
background: var(--white);
|
|
7818
|
+
border: 1px solid var(--gray-300);
|
|
7819
|
+
border-radius: var(--rounded-full);
|
|
7820
|
+
color: var(--typography-base);
|
|
7821
|
+
display: flex;
|
|
7822
|
+
font-size: var(--fs-sm);
|
|
7823
|
+
gap: var(--spacing-sm);
|
|
7824
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
7825
|
+
max-height: 40px;
|
|
7826
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
7827
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
7828
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
7829
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
7830
|
+
|
|
7831
|
+
svg {
|
|
7832
|
+
color: var(--gray-300);
|
|
7833
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7834
|
+
}
|
|
7835
|
+
|
|
7836
|
+
&:hover,
|
|
7837
|
+
:where([aria-expanded='true']) {
|
|
7838
|
+
outline: none;
|
|
7839
|
+
background: var(--gray-200);
|
|
7840
|
+
border-color: var(--gray-300);
|
|
7841
|
+
|
|
7842
|
+
svg {
|
|
7843
|
+
color: var(--typography-base);
|
|
7844
|
+
}
|
|
7845
|
+
}
|
|
7846
|
+
|
|
7847
|
+
&:disabled {
|
|
7848
|
+
opacity: var(--opacity-50);
|
|
7849
|
+
}
|
|
7850
|
+
`;
|
|
7851
|
+
var FilterButtonText = import_react76.css`
|
|
7852
|
+
overflow: hidden;
|
|
7853
|
+
text-overflow: ellipsis;
|
|
7854
|
+
white-space: nowrap;
|
|
7855
|
+
max-width: 14ch;
|
|
7856
|
+
`;
|
|
7857
|
+
var FilterButtonSelected = import_react76.css`
|
|
7858
|
+
background: var(--gray-100);
|
|
7859
|
+
border-color: var(--gray-300);
|
|
7860
|
+
|
|
7861
|
+
svg {
|
|
7862
|
+
color: var(--accent-dark);
|
|
7863
|
+
}
|
|
7864
|
+
`;
|
|
7865
|
+
var FilterButtonWithOptions = import_react76.css`
|
|
7866
|
+
:where([aria-expanded='true']) {
|
|
7867
|
+
background: var(--purple-rain-100);
|
|
7868
|
+
border-color: var(--accent-light);
|
|
7869
|
+
color: var(--typography-base);
|
|
7870
|
+
box-shadow: var(--elevation-100);
|
|
7871
|
+
|
|
7872
|
+
svg {
|
|
7873
|
+
color: var(--accent-dark);
|
|
7874
|
+
}
|
|
7875
|
+
}
|
|
7876
|
+
`;
|
|
7877
|
+
var SearchIcon = import_react76.css`
|
|
7878
|
+
color: var(--icon-color);
|
|
7879
|
+
position: absolute;
|
|
7880
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
7881
|
+
margin: auto;
|
|
7882
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7883
|
+
`;
|
|
7884
|
+
var AddConditionalBtn = import_react76.css`
|
|
7885
|
+
align-items: center;
|
|
7886
|
+
background: transparent;
|
|
7887
|
+
border: none;
|
|
7888
|
+
color: var(--primary-action-default);
|
|
7889
|
+
display: flex;
|
|
7890
|
+
gap: var(--spacing-sm);
|
|
7891
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7892
|
+
padding: 0;
|
|
7893
|
+
|
|
7894
|
+
&:hover,
|
|
7895
|
+
&:focus {
|
|
7896
|
+
color: var(--primary-action-hover);
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7899
|
+
&:disabled {
|
|
7900
|
+
color: var(--gray-400);
|
|
7901
|
+
}
|
|
7902
|
+
`;
|
|
7903
|
+
var Title = import_react76.css`
|
|
7904
|
+
color: var(--typography-light);
|
|
7905
|
+
|
|
7906
|
+
&:focus {
|
|
7907
|
+
outline: none;
|
|
7908
|
+
}
|
|
7909
|
+
`;
|
|
7910
|
+
var ResetConditionsBtn = import_react76.css`
|
|
7911
|
+
background: transparent;
|
|
7912
|
+
border: none;
|
|
7913
|
+
color: var(--action-destructive-default);
|
|
7914
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7915
|
+
padding: 0;
|
|
7916
|
+
|
|
7917
|
+
&:hover,
|
|
7918
|
+
&:focus {
|
|
7919
|
+
color: var(--action-destructive-hover);
|
|
7920
|
+
}
|
|
7921
|
+
`;
|
|
7922
|
+
var IconBtn = import_react76.css`
|
|
7923
|
+
background: transparent;
|
|
7924
|
+
border: none;
|
|
7925
|
+
padding: var(--spacing-sm);
|
|
7926
|
+
`;
|
|
7927
|
+
var SearchAndFilterOptionsContainer = import_react76.css`
|
|
7928
|
+
background: var(--gray-50);
|
|
7929
|
+
border: 1px solid var(--gray-300);
|
|
7930
|
+
border-radius: var(--rounded-base);
|
|
7931
|
+
container-type: inline-size;
|
|
7932
|
+
display: flex;
|
|
7933
|
+
flex-direction: column;
|
|
7934
|
+
gap: var(--spacing-sm);
|
|
7935
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
7936
|
+
will-change: height;
|
|
7937
|
+
position: relative;
|
|
7938
|
+
z-index: 1;
|
|
7939
|
+
`;
|
|
7940
|
+
var SearchAndFilterOptionsInnerContainer = import_react76.css`
|
|
7941
|
+
display: flex;
|
|
7942
|
+
flex-direction: column;
|
|
7943
|
+
gap: var(--spacing-sm);
|
|
7944
|
+
padding-inline: var(--spacing-md);
|
|
7945
|
+
`;
|
|
7946
|
+
var SearchAndFilterButtonGroup = import_react76.css`
|
|
7947
|
+
margin-top: var(--spacing-xs);
|
|
7948
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
7949
|
+
`;
|
|
7950
|
+
|
|
7951
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7952
|
+
var import_jsx_runtime69 = require("@emotion/react/jsx-runtime");
|
|
7953
|
+
var FilterButton2 = ({
|
|
7954
|
+
text = "Filters",
|
|
7955
|
+
icon = "filter-add",
|
|
7956
|
+
filterCount,
|
|
7957
|
+
hasSelectedValue,
|
|
7958
|
+
dataTestId,
|
|
7959
|
+
...props
|
|
7960
|
+
}) => {
|
|
7961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
7962
|
+
"button",
|
|
7963
|
+
{
|
|
7964
|
+
type: "button",
|
|
7965
|
+
css: [
|
|
7966
|
+
FilterButton,
|
|
7967
|
+
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
7968
|
+
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
7969
|
+
],
|
|
7970
|
+
...props,
|
|
7971
|
+
"data-testid": dataTestId,
|
|
7972
|
+
children: [
|
|
7973
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_design_system42.Icon, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
7974
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { css: FilterButtonText, children: text }),
|
|
7975
|
+
filterCount ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_design_system42.Counter, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
7976
|
+
]
|
|
7977
|
+
}
|
|
7978
|
+
);
|
|
7979
|
+
};
|
|
7980
|
+
|
|
7981
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
7982
|
+
var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
|
|
7983
|
+
var import_design_system45 = require("@uniformdev/design-system");
|
|
7984
|
+
var import_lexical11 = require("lexical");
|
|
7985
|
+
var import_react79 = require("react");
|
|
7986
|
+
var import_react_use6 = require("react-use");
|
|
7987
|
+
var import_uuid3 = require("uuid");
|
|
7988
|
+
|
|
7989
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
7990
|
+
var import_design_system44 = require("@uniformdev/design-system");
|
|
7991
|
+
var import_react78 = require("react");
|
|
7992
|
+
|
|
7993
|
+
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
7994
|
+
var import_design_system43 = require("@uniformdev/design-system");
|
|
7995
|
+
var import_react77 = require("react");
|
|
7996
|
+
var import_react_use5 = require("react-use");
|
|
7997
|
+
var import_jsx_runtime70 = require("@emotion/react/jsx-runtime");
|
|
7998
|
+
var readOnlyAttributes = {
|
|
7999
|
+
isSearchable: false,
|
|
8000
|
+
menuIsOpen: false,
|
|
8001
|
+
isClearable: false
|
|
8002
|
+
};
|
|
8003
|
+
var FilterMultiChoiceEditor = ({
|
|
8004
|
+
value,
|
|
8005
|
+
options,
|
|
8006
|
+
disabled,
|
|
8007
|
+
readOnly,
|
|
8008
|
+
valueTestId,
|
|
8009
|
+
...props
|
|
8010
|
+
}) => {
|
|
8011
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8012
|
+
const isClearable = !readOnly || !disabled;
|
|
8013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8014
|
+
import_design_system43.InputComboBox,
|
|
8015
|
+
{
|
|
8016
|
+
...props,
|
|
8017
|
+
placeholder: "Type to search...",
|
|
8018
|
+
options,
|
|
8019
|
+
isMulti: true,
|
|
8020
|
+
isClearable,
|
|
8021
|
+
isDisabled: disabled,
|
|
8022
|
+
onChange: (e) => {
|
|
8023
|
+
var _a;
|
|
8024
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
8025
|
+
},
|
|
8026
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
8027
|
+
"aria-readonly": readOnly,
|
|
8028
|
+
styles: {
|
|
8029
|
+
menu(base) {
|
|
8030
|
+
return {
|
|
8031
|
+
...base,
|
|
8032
|
+
minWidth: "max-content"
|
|
8033
|
+
};
|
|
8034
|
+
}
|
|
8035
|
+
},
|
|
8036
|
+
...readOnlyProps
|
|
8037
|
+
}
|
|
8038
|
+
) });
|
|
8039
|
+
};
|
|
8040
|
+
var FilterSingleChoiceEditor = ({
|
|
8041
|
+
options,
|
|
8042
|
+
value,
|
|
8043
|
+
disabled,
|
|
8044
|
+
readOnly,
|
|
8045
|
+
onChange,
|
|
8046
|
+
valueTestId
|
|
8047
|
+
}) => {
|
|
8048
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8050
|
+
import_design_system43.InputComboBox,
|
|
8051
|
+
{
|
|
8052
|
+
placeholder: "Type to search...",
|
|
8053
|
+
options,
|
|
8054
|
+
isClearable: true,
|
|
8055
|
+
onChange: (e) => {
|
|
8056
|
+
var _a;
|
|
8057
|
+
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
8058
|
+
},
|
|
8059
|
+
isDisabled: disabled,
|
|
8060
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
8061
|
+
"aria-readonly": readOnly,
|
|
8062
|
+
styles: {
|
|
8063
|
+
menu(base) {
|
|
8064
|
+
return {
|
|
8065
|
+
...base,
|
|
8066
|
+
minWidth: "max-content"
|
|
8067
|
+
};
|
|
8068
|
+
}
|
|
8069
|
+
},
|
|
8070
|
+
...readOnlyProps
|
|
8071
|
+
}
|
|
8072
|
+
) });
|
|
8073
|
+
};
|
|
8074
|
+
var CustomOptions = ({ label, value }) => {
|
|
8075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_design_system43.StatusBullet, { status: label, message: value });
|
|
8076
|
+
};
|
|
8077
|
+
var StatusMultiEditor = ({
|
|
8078
|
+
options,
|
|
8079
|
+
value,
|
|
8080
|
+
disabled,
|
|
8081
|
+
readOnly,
|
|
8082
|
+
onChange,
|
|
8083
|
+
valueTestId
|
|
8084
|
+
}) => {
|
|
8085
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8087
|
+
import_design_system43.InputComboBox,
|
|
8088
|
+
{
|
|
8089
|
+
options,
|
|
8090
|
+
isMulti: true,
|
|
8091
|
+
onChange: (e) => {
|
|
8092
|
+
var _a;
|
|
8093
|
+
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
8094
|
+
},
|
|
8095
|
+
formatOptionLabel: CustomOptions,
|
|
8096
|
+
"aria-readonly": readOnly,
|
|
8097
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
8098
|
+
isDisabled: disabled,
|
|
8099
|
+
styles: {
|
|
8100
|
+
menu(base) {
|
|
8101
|
+
return {
|
|
8102
|
+
...base,
|
|
8103
|
+
minWidth: "max-content"
|
|
8104
|
+
};
|
|
8105
|
+
}
|
|
8106
|
+
},
|
|
8107
|
+
...readOnlyProps
|
|
8108
|
+
}
|
|
8109
|
+
) });
|
|
8110
|
+
};
|
|
8111
|
+
var StatusSingleEditor = ({
|
|
8112
|
+
options,
|
|
8113
|
+
value,
|
|
8114
|
+
disabled,
|
|
8115
|
+
readOnly,
|
|
8116
|
+
onChange,
|
|
8117
|
+
valueTestId
|
|
8118
|
+
}) => {
|
|
8119
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8121
|
+
import_design_system43.InputComboBox,
|
|
8122
|
+
{
|
|
8123
|
+
options,
|
|
8124
|
+
onChange: (e) => {
|
|
8125
|
+
var _a;
|
|
8126
|
+
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
8127
|
+
},
|
|
8128
|
+
formatOptionLabel: CustomOptions,
|
|
8129
|
+
"aria-readonly": readOnly,
|
|
8130
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
8131
|
+
isDisabled: disabled,
|
|
8132
|
+
styles: {
|
|
8133
|
+
menu(base) {
|
|
8134
|
+
return {
|
|
8135
|
+
...base,
|
|
8136
|
+
minWidth: "max-content"
|
|
8137
|
+
};
|
|
8138
|
+
}
|
|
8139
|
+
},
|
|
8140
|
+
...readOnlyProps
|
|
8141
|
+
}
|
|
8142
|
+
) });
|
|
8143
|
+
};
|
|
8144
|
+
var TextEditor = ({
|
|
8145
|
+
onChange,
|
|
8146
|
+
ariaLabel,
|
|
8147
|
+
value,
|
|
8148
|
+
readOnly,
|
|
8149
|
+
valueTestId
|
|
8150
|
+
}) => {
|
|
8151
|
+
const [innerValue, setInnerValue] = (0, import_react77.useState)(value != null ? value : "");
|
|
8152
|
+
(0, import_react_use5.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8154
|
+
import_design_system43.Input,
|
|
8155
|
+
{
|
|
8156
|
+
showLabel: false,
|
|
8157
|
+
label: ariaLabel,
|
|
8158
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8159
|
+
placeholder: "Enter phrase to search\u2026",
|
|
8160
|
+
value: innerValue,
|
|
8161
|
+
readOnly,
|
|
8162
|
+
"data-testid": valueTestId
|
|
8163
|
+
}
|
|
8164
|
+
);
|
|
8165
|
+
};
|
|
8166
|
+
var NumberRangeEditor = ({
|
|
8167
|
+
onChange,
|
|
8168
|
+
disabled,
|
|
8169
|
+
ariaLabel,
|
|
8170
|
+
value,
|
|
8171
|
+
readOnly,
|
|
8172
|
+
valueTestId
|
|
8173
|
+
}) => {
|
|
8174
|
+
const [minValue, setMinValue] = (0, import_react77.useState)("");
|
|
8175
|
+
const [maxValue, setMaxValue] = (0, import_react77.useState)("");
|
|
8176
|
+
const [error, setError] = (0, import_react77.useState)("");
|
|
8177
|
+
(0, import_react_use5.useDebounce)(
|
|
8178
|
+
() => {
|
|
8179
|
+
if (minValue && maxValue && !error) {
|
|
8180
|
+
onChange([minValue, maxValue]);
|
|
8181
|
+
} else {
|
|
8182
|
+
onChange([]);
|
|
8183
|
+
}
|
|
8184
|
+
},
|
|
8185
|
+
500,
|
|
8186
|
+
[minValue, maxValue]
|
|
8187
|
+
);
|
|
8188
|
+
(0, import_react77.useEffect)(() => {
|
|
8189
|
+
if (!maxValue && !minValue) {
|
|
8190
|
+
return;
|
|
8191
|
+
}
|
|
8192
|
+
const max = Number(maxValue);
|
|
8193
|
+
const min = Number(minValue);
|
|
8194
|
+
if (max < min || min > max) {
|
|
8195
|
+
setError("Please enter a valid numeric range");
|
|
8196
|
+
return;
|
|
8197
|
+
}
|
|
8198
|
+
if (maxValue && !minValue || minValue && !maxValue) {
|
|
8199
|
+
setError("Please enter both a low and high number");
|
|
8200
|
+
return;
|
|
8201
|
+
}
|
|
8202
|
+
if (error) {
|
|
8203
|
+
setError("");
|
|
8204
|
+
}
|
|
8205
|
+
if (min && max) {
|
|
8206
|
+
setMinValue(minValue);
|
|
8207
|
+
setMaxValue(maxValue);
|
|
8208
|
+
}
|
|
8209
|
+
}, [maxValue, minValue, setError]);
|
|
8210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
8211
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8212
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8213
|
+
import_design_system43.Input,
|
|
8214
|
+
{
|
|
8215
|
+
label: `${ariaLabel}-min`,
|
|
8216
|
+
type: "number",
|
|
8217
|
+
showLabel: false,
|
|
8218
|
+
min: 0,
|
|
8219
|
+
placeholder: "Low",
|
|
8220
|
+
onChange: (e) => setMinValue(e.currentTarget.value),
|
|
8221
|
+
"aria-invalid": !error ? false : true,
|
|
8222
|
+
disabled,
|
|
8223
|
+
value: value ? value[0] : "",
|
|
8224
|
+
readOnly,
|
|
8225
|
+
"data-testid": "value-low"
|
|
8226
|
+
}
|
|
8227
|
+
),
|
|
8228
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8229
|
+
import_design_system43.Input,
|
|
8230
|
+
{
|
|
8231
|
+
type: "number",
|
|
8232
|
+
label: `${ariaLabel}-max`,
|
|
8233
|
+
showLabel: false,
|
|
8234
|
+
min: 0,
|
|
8235
|
+
placeholder: "High",
|
|
8236
|
+
onChange: (e) => setMaxValue(e.currentTarget.value),
|
|
8237
|
+
"aria-invalid": !error ? false : true,
|
|
8238
|
+
disabled,
|
|
8239
|
+
value: value ? value[1] : "",
|
|
8240
|
+
readOnly,
|
|
8241
|
+
"data-testid": "value-high"
|
|
8242
|
+
}
|
|
8243
|
+
)
|
|
8244
|
+
] }),
|
|
8245
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorContainer, { errorMessage: error })
|
|
8246
|
+
] });
|
|
8247
|
+
};
|
|
8248
|
+
var NumberEditor = ({
|
|
8249
|
+
ariaLabel,
|
|
8250
|
+
onChange,
|
|
8251
|
+
disabled,
|
|
8252
|
+
value,
|
|
8253
|
+
readOnly,
|
|
8254
|
+
valueTestId
|
|
8255
|
+
}) => {
|
|
8256
|
+
const [innerValue, setInnerValue] = (0, import_react77.useState)(value != null ? value : "");
|
|
8257
|
+
(0, import_react_use5.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8259
|
+
import_design_system43.Input,
|
|
8260
|
+
{
|
|
8261
|
+
label: ariaLabel,
|
|
8262
|
+
type: "number",
|
|
8263
|
+
showLabel: false,
|
|
8264
|
+
min: 0,
|
|
8265
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8266
|
+
disabled,
|
|
8267
|
+
value: innerValue,
|
|
8268
|
+
readOnly,
|
|
8269
|
+
"data-testid": valueTestId
|
|
8270
|
+
}
|
|
8271
|
+
);
|
|
8272
|
+
};
|
|
8273
|
+
var DateEditor = ({
|
|
8274
|
+
onChange,
|
|
8275
|
+
ariaLabel,
|
|
8276
|
+
disabled,
|
|
8277
|
+
value,
|
|
8278
|
+
readOnly,
|
|
8279
|
+
valueTestId
|
|
8280
|
+
}) => {
|
|
8281
|
+
const [innerValue, setInnerValue] = (0, import_react77.useState)(value != null ? value : "");
|
|
8282
|
+
(0, import_react_use5.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8284
|
+
import_design_system43.Input,
|
|
8285
|
+
{
|
|
8286
|
+
type: "date",
|
|
8287
|
+
label: ariaLabel,
|
|
8288
|
+
showLabel: false,
|
|
8289
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8290
|
+
disabled,
|
|
8291
|
+
value: innerValue,
|
|
8292
|
+
readOnly,
|
|
8293
|
+
"data-testid": valueTestId
|
|
8294
|
+
}
|
|
8295
|
+
);
|
|
8296
|
+
};
|
|
8297
|
+
var DateRangeEditor = ({
|
|
8298
|
+
ariaLabel,
|
|
8299
|
+
onChange,
|
|
8300
|
+
disabled,
|
|
8301
|
+
value,
|
|
8302
|
+
readOnly,
|
|
8303
|
+
valueTestId
|
|
8304
|
+
}) => {
|
|
8305
|
+
const [minDateValue, setMinDateValue] = (0, import_react77.useState)(value ? value[0] : "");
|
|
8306
|
+
const [maxDateValue, setMaxDateValue] = (0, import_react77.useState)(value ? value[1] : "");
|
|
8307
|
+
const [error, setError] = (0, import_react77.useState)("");
|
|
8308
|
+
(0, import_react_use5.useDebounce)(
|
|
8309
|
+
() => {
|
|
8310
|
+
if (minDateValue && maxDateValue && !error) {
|
|
8311
|
+
onChange([minDateValue, maxDateValue]);
|
|
8312
|
+
} else {
|
|
8313
|
+
onChange([]);
|
|
8314
|
+
}
|
|
8315
|
+
},
|
|
8316
|
+
500,
|
|
8317
|
+
[minDateValue, maxDateValue]
|
|
8318
|
+
);
|
|
8319
|
+
(0, import_react77.useEffect)(() => {
|
|
8320
|
+
if (!minDateValue || !maxDateValue) {
|
|
8321
|
+
return;
|
|
8322
|
+
}
|
|
8323
|
+
const minDate = new Date(minDateValue);
|
|
8324
|
+
const maxDate = new Date(maxDateValue);
|
|
8325
|
+
if (maxDate < minDate) {
|
|
8326
|
+
setError("The max date cannot be lower than the min date");
|
|
8327
|
+
return;
|
|
8328
|
+
}
|
|
8329
|
+
if (maxDate && !minDate) {
|
|
8330
|
+
setError("Please enter both a low and high date");
|
|
8331
|
+
return;
|
|
8332
|
+
}
|
|
8333
|
+
const minDateString = minDate.toDateString();
|
|
8334
|
+
const maxDateString = maxDate.toDateString();
|
|
8335
|
+
if (minDateString === maxDateString || maxDateString === minDateString) {
|
|
8336
|
+
setError("The min and max date cannot be the same");
|
|
8337
|
+
return;
|
|
8338
|
+
}
|
|
8339
|
+
if (minDate > maxDate) {
|
|
8340
|
+
setError("The min date cannot be higher than the max date");
|
|
8341
|
+
return;
|
|
8342
|
+
}
|
|
8343
|
+
if (error) {
|
|
8344
|
+
setError("");
|
|
8345
|
+
}
|
|
8346
|
+
if (minDate && maxDate) {
|
|
8347
|
+
setMinDateValue(minDateValue);
|
|
8348
|
+
setMaxDateValue(maxDateValue);
|
|
8349
|
+
} else {
|
|
8350
|
+
setMinDateValue("");
|
|
8351
|
+
setMaxDateValue("");
|
|
8352
|
+
}
|
|
8353
|
+
}, [minDateValue, maxDateValue, setError]);
|
|
8354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
8355
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8356
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8357
|
+
import_design_system43.Input,
|
|
8358
|
+
{
|
|
8359
|
+
label: `${ariaLabel}-min-date`,
|
|
8360
|
+
type: "date",
|
|
8361
|
+
showLabel: false,
|
|
8362
|
+
value: minDateValue,
|
|
8363
|
+
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
8364
|
+
"aria-invalid": !error ? false : true,
|
|
8365
|
+
disabled,
|
|
8366
|
+
readOnly
|
|
8367
|
+
}
|
|
8368
|
+
),
|
|
8369
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8370
|
+
import_design_system43.Input,
|
|
8371
|
+
{
|
|
8372
|
+
label: `${ariaLabel}-max-date`,
|
|
8373
|
+
type: "date",
|
|
8374
|
+
showLabel: false,
|
|
8375
|
+
value: maxDateValue,
|
|
8376
|
+
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
8377
|
+
"aria-invalid": !error ? false : true,
|
|
8378
|
+
disabled,
|
|
8379
|
+
readOnly
|
|
8380
|
+
}
|
|
8381
|
+
)
|
|
8382
|
+
] }),
|
|
8383
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorContainer, { errorMessage: error })
|
|
8384
|
+
] });
|
|
8385
|
+
};
|
|
8386
|
+
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
8387
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
8388
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
8389
|
+
if (!Editor) {
|
|
8390
|
+
return null;
|
|
8391
|
+
}
|
|
8392
|
+
if (editorType === "empty") {
|
|
8393
|
+
return null;
|
|
8394
|
+
}
|
|
8395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Editor, { ...props });
|
|
8396
|
+
};
|
|
8397
|
+
var filterMapper = {
|
|
8398
|
+
multiChoice: FilterMultiChoiceEditor,
|
|
8399
|
+
singleChoice: FilterSingleChoiceEditor,
|
|
8400
|
+
date: DateEditor,
|
|
8401
|
+
dateRange: DateRangeEditor,
|
|
8402
|
+
text: TextEditor,
|
|
8403
|
+
numberRange: NumberRangeEditor,
|
|
8404
|
+
number: NumberEditor,
|
|
8405
|
+
statusMultiChoice: StatusMultiEditor,
|
|
8406
|
+
statusSingleChoice: StatusSingleEditor,
|
|
8407
|
+
empty: null
|
|
8408
|
+
};
|
|
8409
|
+
function withInputVariables(WrappedComponent) {
|
|
8410
|
+
const WithInputVariables = (props) => {
|
|
8411
|
+
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(WrappedComponent, { ...props });
|
|
8413
|
+
}
|
|
8414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8415
|
+
InputVariables,
|
|
8416
|
+
{
|
|
8417
|
+
disableInlineMenu: true,
|
|
8418
|
+
showMenuPosition: "inline-right",
|
|
8419
|
+
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8420
|
+
value: props.value,
|
|
8421
|
+
disabled: props.disabled,
|
|
8422
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(WrappedComponent, { ...props })
|
|
8423
|
+
}
|
|
8424
|
+
);
|
|
8425
|
+
};
|
|
8426
|
+
return WithInputVariables;
|
|
8427
|
+
}
|
|
8428
|
+
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
8429
|
+
const WithInputVariables = (props) => {
|
|
7586
8430
|
var _a;
|
|
7587
8431
|
if (!props.bindable || props.disabled || props.readOnly) {
|
|
7588
|
-
return /* @__PURE__ */ (0,
|
|
8432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(WrappedComponent, { ...props });
|
|
8433
|
+
}
|
|
8434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8435
|
+
InputVariables,
|
|
8436
|
+
{
|
|
8437
|
+
disableInlineMenu: true,
|
|
8438
|
+
showMenuPosition: "inline-right",
|
|
8439
|
+
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
8440
|
+
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
8441
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(WrappedComponent, { ...props })
|
|
8442
|
+
}
|
|
8443
|
+
);
|
|
8444
|
+
};
|
|
8445
|
+
return WithInputVariables;
|
|
8446
|
+
}
|
|
8447
|
+
var bindableFiltersMapper = {
|
|
8448
|
+
...filterMapper,
|
|
8449
|
+
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8450
|
+
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8451
|
+
date: withInputVariables(DateEditor),
|
|
8452
|
+
text: withInputVariables(TextEditor),
|
|
8453
|
+
number: withInputVariables(NumberEditor)
|
|
8454
|
+
};
|
|
8455
|
+
var ErrorContainer = ({ errorMessage }) => {
|
|
8456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8457
|
+
"div",
|
|
8458
|
+
{
|
|
8459
|
+
css: {
|
|
8460
|
+
gridColumn: "span 6",
|
|
8461
|
+
order: 6
|
|
8462
|
+
},
|
|
8463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_design_system43.FieldMessage, { errorMessage })
|
|
8464
|
+
}
|
|
8465
|
+
);
|
|
8466
|
+
};
|
|
8467
|
+
var twoColumnGrid = {
|
|
8468
|
+
display: "grid",
|
|
8469
|
+
gridTemplateColumns: "1fr 1fr",
|
|
8470
|
+
gap: "var(--spacing-sm);"
|
|
8471
|
+
};
|
|
8472
|
+
|
|
8473
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8474
|
+
var import_jsx_runtime71 = require("@emotion/react/jsx-runtime");
|
|
8475
|
+
var SearchAndFilterContext = (0, import_react78.createContext)({
|
|
8476
|
+
searchTerm: "",
|
|
8477
|
+
setSearchTerm: () => {
|
|
8478
|
+
},
|
|
8479
|
+
filterVisibility: void 0,
|
|
8480
|
+
setFilterVisibility: () => {
|
|
8481
|
+
},
|
|
8482
|
+
filters: [],
|
|
8483
|
+
setFilters: () => {
|
|
8484
|
+
},
|
|
8485
|
+
handleAddFilter: () => {
|
|
8486
|
+
},
|
|
8487
|
+
handleResetFilters: () => {
|
|
8488
|
+
},
|
|
8489
|
+
handleDeleteFilter: () => {
|
|
8490
|
+
},
|
|
8491
|
+
filterOptions: [],
|
|
8492
|
+
validFilterQuery: [],
|
|
8493
|
+
filterMapper: {},
|
|
8494
|
+
totalResults: 0
|
|
8495
|
+
});
|
|
8496
|
+
var SearchAndFilterProvider = ({
|
|
8497
|
+
filters,
|
|
8498
|
+
filterOptions,
|
|
8499
|
+
filterVisible = false,
|
|
8500
|
+
defaultSearchTerm = "",
|
|
8501
|
+
onSearchChange,
|
|
8502
|
+
onChange,
|
|
8503
|
+
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
8504
|
+
totalResults,
|
|
8505
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
8506
|
+
children
|
|
8507
|
+
}) => {
|
|
8508
|
+
const [searchTerm, setSearchTerm] = (0, import_react78.useState)(defaultSearchTerm);
|
|
8509
|
+
const deferredSearchTerm = (0, import_react78.useDeferredValue)(searchTerm);
|
|
8510
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react78.useState)(filterVisible);
|
|
8511
|
+
const handleSearchTerm = (0, import_react78.useCallback)(
|
|
8512
|
+
(term) => {
|
|
8513
|
+
setSearchTerm(term);
|
|
8514
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
8515
|
+
},
|
|
8516
|
+
[setSearchTerm, onSearchChange]
|
|
8517
|
+
);
|
|
8518
|
+
const handleToggleFilterVisibility = (0, import_react78.useCallback)(
|
|
8519
|
+
(visible) => setFilterVisibility(visible),
|
|
8520
|
+
[setFilterVisibility]
|
|
8521
|
+
);
|
|
8522
|
+
const handleAddFilter = (0, import_react78.useCallback)(() => {
|
|
8523
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
8524
|
+
}, [filters, onChange]);
|
|
8525
|
+
const handleResetFilters = (0, import_react78.useCallback)(() => {
|
|
8526
|
+
onChange(resetFilterValues);
|
|
8527
|
+
}, [onChange, resetFilterValues]);
|
|
8528
|
+
const handleDeleteFilter = (0, import_react78.useCallback)(
|
|
8529
|
+
(index) => {
|
|
8530
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
8531
|
+
onChange(remainingFilters);
|
|
8532
|
+
},
|
|
8533
|
+
[filters, onChange]
|
|
8534
|
+
);
|
|
8535
|
+
const validFilterQuery = (0, import_react78.useMemo)(() => {
|
|
8536
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
8537
|
+
if (hasValidFilters) {
|
|
8538
|
+
return filters;
|
|
8539
|
+
}
|
|
8540
|
+
}, [filters]);
|
|
8541
|
+
(0, import_react78.useEffect)(() => {
|
|
8542
|
+
if (filterVisibility) {
|
|
8543
|
+
const handleEscKeyFilterClose = (e) => {
|
|
8544
|
+
if (e.key === "Escape") {
|
|
8545
|
+
setFilterVisibility(false);
|
|
8546
|
+
}
|
|
8547
|
+
};
|
|
8548
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8549
|
+
return () => {
|
|
8550
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8551
|
+
};
|
|
8552
|
+
}
|
|
8553
|
+
}, [filterVisibility]);
|
|
8554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
8555
|
+
SearchAndFilterContext.Provider,
|
|
8556
|
+
{
|
|
8557
|
+
value: {
|
|
8558
|
+
searchTerm: deferredSearchTerm,
|
|
8559
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
8560
|
+
filterVisibility,
|
|
8561
|
+
setFilterVisibility: (e) => handleToggleFilterVisibility(e),
|
|
8562
|
+
filters,
|
|
8563
|
+
setFilters: (e) => onChange(e),
|
|
8564
|
+
handleAddFilter,
|
|
8565
|
+
handleResetFilters,
|
|
8566
|
+
handleDeleteFilter,
|
|
8567
|
+
filterOptions,
|
|
8568
|
+
validFilterQuery,
|
|
8569
|
+
totalResults,
|
|
8570
|
+
filterMapper: filterMapper2
|
|
8571
|
+
},
|
|
8572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system44.VerticalRhythm, { children })
|
|
8573
|
+
}
|
|
8574
|
+
);
|
|
8575
|
+
};
|
|
8576
|
+
var useSearchAndFilter = () => {
|
|
8577
|
+
const value = (0, import_react78.useContext)(SearchAndFilterContext);
|
|
8578
|
+
return { ...value };
|
|
8579
|
+
};
|
|
8580
|
+
|
|
8581
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8582
|
+
var import_jsx_runtime72 = require("@emotion/react/jsx-runtime");
|
|
8583
|
+
var FilterControls = ({
|
|
8584
|
+
children,
|
|
8585
|
+
hideSearchInput
|
|
8586
|
+
}) => {
|
|
8587
|
+
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
8588
|
+
const editorRef = (0, import_react79.useRef)(null);
|
|
8589
|
+
const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
|
|
8590
|
+
const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react79.useState)("data-resource-search-term-input");
|
|
8591
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react79.useState)(searchTerm);
|
|
8592
|
+
(0, import_react_use6.useDebounce)(
|
|
8593
|
+
() => {
|
|
8594
|
+
setSearchTerm(localeSearchTerm);
|
|
8595
|
+
},
|
|
8596
|
+
300,
|
|
8597
|
+
[localeSearchTerm]
|
|
8598
|
+
);
|
|
8599
|
+
(0, import_react79.useEffect)(() => {
|
|
8600
|
+
if (searchTerm === "") {
|
|
8601
|
+
setLocaleSearchTerm("");
|
|
8602
|
+
setIdToResetInputVariables(`data-resource-search-term-input-${(0, import_uuid3.v4)()}`);
|
|
8603
|
+
}
|
|
8604
|
+
}, [searchTerm]);
|
|
8605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
8606
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8607
|
+
FilterButton2,
|
|
8608
|
+
{
|
|
8609
|
+
"aria-controls": "search-and-filter-options",
|
|
8610
|
+
"aria-label": "filter options",
|
|
8611
|
+
"aria-haspopup": "true",
|
|
8612
|
+
text: "Filter/Sort",
|
|
8613
|
+
"aria-expanded": filterVisibility === true,
|
|
8614
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
8615
|
+
onClick: () => setFilterVisibility(!filterVisibility),
|
|
8616
|
+
dataTestId: "filters-button"
|
|
8617
|
+
}
|
|
8618
|
+
),
|
|
8619
|
+
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { css: BindableKeywordSearchInputStyles, children: [
|
|
8620
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8621
|
+
InputVariables,
|
|
8622
|
+
{
|
|
8623
|
+
label: "",
|
|
8624
|
+
id: idToResetInputVariables,
|
|
8625
|
+
showMenuPosition: "inline-right",
|
|
8626
|
+
editorRef,
|
|
8627
|
+
value: localeSearchTerm,
|
|
8628
|
+
onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
|
|
8629
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8630
|
+
import_design_system45.InputKeywordSearch,
|
|
8631
|
+
{
|
|
8632
|
+
placeholder: "Search...",
|
|
8633
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
8634
|
+
value: localeSearchTerm,
|
|
8635
|
+
compact: true,
|
|
8636
|
+
rounded: true,
|
|
8637
|
+
css: SearchInput
|
|
8638
|
+
}
|
|
8639
|
+
)
|
|
8640
|
+
}
|
|
8641
|
+
),
|
|
8642
|
+
hasVariableInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8643
|
+
"button",
|
|
8644
|
+
{
|
|
8645
|
+
css: ClearSearchButtonStyles,
|
|
8646
|
+
onClick: () => {
|
|
8647
|
+
setLocaleSearchTerm("");
|
|
8648
|
+
if (editorRef.current) {
|
|
8649
|
+
if (editorRef.current.getRootElement() !== document.activeElement) {
|
|
8650
|
+
editorRef.current.dispatchCommand(import_lexical11.CLEAR_EDITOR_COMMAND, void 0);
|
|
8651
|
+
}
|
|
8652
|
+
}
|
|
8653
|
+
},
|
|
8654
|
+
type: "button",
|
|
8655
|
+
"data-testid": "keyword-search-clear-button",
|
|
8656
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system45.Icon, { icon: import_CgClose5.CgClose, iconColor: "red", size: "1rem" })
|
|
8657
|
+
}
|
|
8658
|
+
) }) : null
|
|
8659
|
+
] }),
|
|
8660
|
+
children
|
|
8661
|
+
] });
|
|
8662
|
+
};
|
|
8663
|
+
|
|
8664
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8665
|
+
var import_design_system47 = require("@uniformdev/design-system");
|
|
8666
|
+
var import_react81 = require("react");
|
|
8667
|
+
|
|
8668
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8669
|
+
var import_design_system46 = require("@uniformdev/design-system");
|
|
8670
|
+
var import_react80 = __toESM(require("react"));
|
|
8671
|
+
var import_jsx_runtime73 = require("@emotion/react/jsx-runtime");
|
|
8672
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
8673
|
+
buttonRow,
|
|
8674
|
+
additionalFiltersContainer,
|
|
8675
|
+
children
|
|
8676
|
+
}) => {
|
|
8677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8678
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8679
|
+
buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
8680
|
+
import_design_system46.HorizontalRhythm,
|
|
8681
|
+
{
|
|
8682
|
+
css: SearchAndFilterButtonGroup,
|
|
8683
|
+
gap: "sm",
|
|
8684
|
+
align: "center",
|
|
8685
|
+
justify: "space-between",
|
|
8686
|
+
children: buttonRow
|
|
8687
|
+
}
|
|
8688
|
+
) : null,
|
|
8689
|
+
additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { children: additionalFiltersContainer }) : null
|
|
8690
|
+
] });
|
|
8691
|
+
};
|
|
8692
|
+
var FilterMenu = ({
|
|
8693
|
+
id,
|
|
8694
|
+
filterTitle = "Show results",
|
|
8695
|
+
menuControls,
|
|
8696
|
+
additionalFiltersContainer,
|
|
8697
|
+
children,
|
|
8698
|
+
dataTestId,
|
|
8699
|
+
resetButtonText = "reset"
|
|
8700
|
+
}) => {
|
|
8701
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8702
|
+
const innerMenuRef = import_react80.default.useRef(null);
|
|
8703
|
+
(0, import_react80.useEffect)(() => {
|
|
8704
|
+
var _a;
|
|
8705
|
+
if (filterVisibility) {
|
|
8706
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
8707
|
+
}
|
|
8708
|
+
}, [filterVisibility]);
|
|
8709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_design_system46.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
8710
|
+
SearchAndFilterOptionsContainer2,
|
|
8711
|
+
{
|
|
8712
|
+
buttonRow: menuControls,
|
|
8713
|
+
additionalFiltersContainer,
|
|
8714
|
+
children: [
|
|
8715
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_design_system46.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
8716
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
8717
|
+
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
8718
|
+
"button",
|
|
8719
|
+
{
|
|
8720
|
+
type: "button",
|
|
8721
|
+
css: ResetConditionsBtn,
|
|
8722
|
+
onClick: () => {
|
|
8723
|
+
handleResetFilters();
|
|
8724
|
+
setFilterVisibility(false);
|
|
8725
|
+
},
|
|
8726
|
+
"data-testid": "reset-filters",
|
|
8727
|
+
children: resetButtonText
|
|
8728
|
+
}
|
|
8729
|
+
) : null
|
|
8730
|
+
] }),
|
|
8731
|
+
children
|
|
8732
|
+
]
|
|
8733
|
+
}
|
|
8734
|
+
) : null });
|
|
8735
|
+
};
|
|
8736
|
+
|
|
8737
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8738
|
+
var import_jsx_runtime74 = require("@emotion/react/jsx-runtime");
|
|
8739
|
+
var FilterItem = ({
|
|
8740
|
+
index,
|
|
8741
|
+
paramOptions,
|
|
8742
|
+
operatorOptions,
|
|
8743
|
+
valueOptions,
|
|
8744
|
+
onParamChange,
|
|
8745
|
+
onOperatorChange,
|
|
8746
|
+
onValueChange
|
|
8747
|
+
}) => {
|
|
8748
|
+
var _a, _b;
|
|
8749
|
+
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
8750
|
+
const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
|
|
8751
|
+
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
8752
|
+
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
8753
|
+
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
8754
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react81.useMemo)(() => {
|
|
8755
|
+
var _a2;
|
|
8756
|
+
const currentSelectedFilter = filterOptions.find((item) => {
|
|
8757
|
+
var _a3;
|
|
8758
|
+
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
8759
|
+
});
|
|
8760
|
+
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
8761
|
+
return filters[index].field === item.value;
|
|
8762
|
+
});
|
|
8763
|
+
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
8764
|
+
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
8765
|
+
return filters[index].operator === item.value;
|
|
8766
|
+
});
|
|
8767
|
+
return {
|
|
8768
|
+
selectedFieldValue: selectedFieldValue2,
|
|
8769
|
+
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
8770
|
+
selectedMetaValue: filters[index].value,
|
|
8771
|
+
readOnly: isCurrentFieldReadOnly,
|
|
8772
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
8773
|
+
};
|
|
8774
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
8775
|
+
const readOnlyProps = readOnly ? {
|
|
8776
|
+
"aria-readonly": true,
|
|
8777
|
+
isSearchable: false,
|
|
8778
|
+
menuIsOpen: false,
|
|
8779
|
+
isClearable: false
|
|
8780
|
+
} : {};
|
|
8781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
8782
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: index === 0 ? "Where" : "and" }),
|
|
8783
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { css: ConditionalInputRow, children: [
|
|
8784
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8785
|
+
import_design_system47.InputComboBox,
|
|
8786
|
+
{
|
|
8787
|
+
"aria-label": label,
|
|
8788
|
+
options: paramOptions,
|
|
8789
|
+
onChange: (e) => {
|
|
8790
|
+
var _a2;
|
|
8791
|
+
onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8792
|
+
},
|
|
8793
|
+
isOptionDisabled: (option) => {
|
|
8794
|
+
var _a2;
|
|
8795
|
+
return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
|
|
8796
|
+
},
|
|
8797
|
+
styles: {
|
|
8798
|
+
menu(base) {
|
|
8799
|
+
return {
|
|
8800
|
+
...base,
|
|
8801
|
+
minWidth: "max-content"
|
|
8802
|
+
};
|
|
8803
|
+
}
|
|
8804
|
+
},
|
|
8805
|
+
value: selectedFieldValue,
|
|
8806
|
+
...readOnlyProps,
|
|
8807
|
+
id: "filter-field",
|
|
8808
|
+
name: `filter-field-${index}`
|
|
8809
|
+
}
|
|
8810
|
+
),
|
|
8811
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8812
|
+
import_design_system47.InputComboBox,
|
|
8813
|
+
{
|
|
8814
|
+
"aria-label": operatorLabel,
|
|
8815
|
+
options: operatorOptions,
|
|
8816
|
+
onChange: (e) => {
|
|
8817
|
+
var _a2;
|
|
8818
|
+
return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8819
|
+
},
|
|
8820
|
+
isDisabled: !filters[index].field,
|
|
8821
|
+
value: selectedOperatorValue,
|
|
8822
|
+
styles: {
|
|
8823
|
+
menu(base) {
|
|
8824
|
+
return {
|
|
8825
|
+
...base,
|
|
8826
|
+
minWidth: "max-content"
|
|
8827
|
+
};
|
|
8828
|
+
}
|
|
8829
|
+
},
|
|
8830
|
+
...readOnlyProps,
|
|
8831
|
+
id: "filter-operator",
|
|
8832
|
+
name: `filter-operator-${index}`
|
|
8833
|
+
}
|
|
8834
|
+
),
|
|
8835
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8836
|
+
FilterEditorRenderer,
|
|
8837
|
+
{
|
|
8838
|
+
"aria-label": metaDataLabel,
|
|
8839
|
+
editorType: metaDataPossibleOptions,
|
|
8840
|
+
options: valueOptions,
|
|
8841
|
+
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
8842
|
+
readOnly,
|
|
8843
|
+
bindable,
|
|
8844
|
+
disabled: !filters[index].operator,
|
|
8845
|
+
value: selectedMetaValue,
|
|
8846
|
+
valueTestId: "filter-value"
|
|
8847
|
+
}
|
|
8848
|
+
),
|
|
8849
|
+
readOnly || index === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8850
|
+
"button",
|
|
8851
|
+
{
|
|
8852
|
+
type: "button",
|
|
8853
|
+
onClick: () => handleDeleteFilter(index),
|
|
8854
|
+
"aria-label": "delete filter",
|
|
8855
|
+
css: IconBtn,
|
|
8856
|
+
"data-testid": "delete-filter",
|
|
8857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_design_system47.Icon, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
8858
|
+
}
|
|
8859
|
+
)
|
|
8860
|
+
] })
|
|
8861
|
+
] });
|
|
8862
|
+
};
|
|
8863
|
+
var FilterItems = ({
|
|
8864
|
+
addButtonText = "add condition",
|
|
8865
|
+
additionalFiltersContainer
|
|
8866
|
+
}) => {
|
|
8867
|
+
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
8868
|
+
const handleUpdateFilter = (index, prop, value) => {
|
|
8869
|
+
var _a, _b, _c, _d, _e;
|
|
8870
|
+
const next = [...filters];
|
|
8871
|
+
next[index] = { ...next[index], [prop]: value };
|
|
8872
|
+
if (prop === "operator") {
|
|
8873
|
+
if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
|
|
8874
|
+
next[index].value = next[index].value[0];
|
|
8875
|
+
}
|
|
8876
|
+
if (filters[index].operator === "ndef" || filters[index].operator === "def") {
|
|
8877
|
+
next[index].value = "";
|
|
8878
|
+
}
|
|
8879
|
+
if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
8880
|
+
next[index].value = [next[index].value, ""];
|
|
8881
|
+
}
|
|
8882
|
+
if (value === "def" || value === "true") {
|
|
8883
|
+
next[index].value = "true";
|
|
8884
|
+
}
|
|
8885
|
+
if (value === "ndef" || value === "false") {
|
|
8886
|
+
next[index].value = "false";
|
|
8887
|
+
}
|
|
8888
|
+
}
|
|
8889
|
+
if (prop === "field") {
|
|
8890
|
+
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
8891
|
+
var _a2;
|
|
8892
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
|
|
8893
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
|
|
8894
|
+
next[index].operator = firstOperatorInAvailableOperators;
|
|
8895
|
+
next[index].value = "";
|
|
8896
|
+
}
|
|
8897
|
+
setFilters(next);
|
|
8898
|
+
};
|
|
8899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8900
|
+
FilterMenu,
|
|
8901
|
+
{
|
|
8902
|
+
id: "search-and-filter-options",
|
|
8903
|
+
dataTestId: "search-and-filter-options",
|
|
8904
|
+
menuControls: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
8905
|
+
"button",
|
|
8906
|
+
{
|
|
8907
|
+
type: "button",
|
|
8908
|
+
css: AddConditionalBtn,
|
|
8909
|
+
onClick: handleAddFilter,
|
|
8910
|
+
"data-testid": "add-filter",
|
|
8911
|
+
children: [
|
|
8912
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_design_system47.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
8913
|
+
addButtonText
|
|
8914
|
+
]
|
|
8915
|
+
}
|
|
8916
|
+
),
|
|
8917
|
+
additionalFiltersContainer,
|
|
8918
|
+
children: filters.map((item, i) => {
|
|
8919
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8920
|
+
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
8921
|
+
var _a2;
|
|
8922
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
|
|
8923
|
+
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
8924
|
+
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
8925
|
+
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
8926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8927
|
+
FilterItem,
|
|
8928
|
+
{
|
|
8929
|
+
index: i,
|
|
8930
|
+
paramOptions: filterOptions,
|
|
8931
|
+
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
8932
|
+
operatorOptions: possibleOperators,
|
|
8933
|
+
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
8934
|
+
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
8935
|
+
valueOptions: possibleValueOptions
|
|
8936
|
+
},
|
|
8937
|
+
i
|
|
8938
|
+
);
|
|
8939
|
+
})
|
|
8940
|
+
}
|
|
8941
|
+
);
|
|
8942
|
+
};
|
|
8943
|
+
|
|
8944
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
8945
|
+
var import_design_system49 = require("@uniformdev/design-system");
|
|
8946
|
+
|
|
8947
|
+
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
8948
|
+
var import_design_system48 = require("@uniformdev/design-system");
|
|
8949
|
+
var import_jsx_runtime75 = require("@emotion/react/jsx-runtime");
|
|
8950
|
+
var SearchAndFilterResultContainer = ({
|
|
8951
|
+
buttonText,
|
|
8952
|
+
clearButtonLabel = "clear",
|
|
8953
|
+
calloutTitle,
|
|
8954
|
+
calloutText,
|
|
8955
|
+
onHandleClear,
|
|
8956
|
+
hideClearButton
|
|
8957
|
+
}) => {
|
|
8958
|
+
const { searchTerm, setSearchTerm, totalResults, setFilters, filters } = useSearchAndFilter();
|
|
8959
|
+
const automateCalloutTitle = () => {
|
|
8960
|
+
if (searchTerm && !filters.length) {
|
|
8961
|
+
return "No search results found";
|
|
8962
|
+
}
|
|
8963
|
+
if (filters.length && !searchTerm) {
|
|
8964
|
+
return "No results match the selected filters";
|
|
8965
|
+
}
|
|
8966
|
+
return "No matching results found";
|
|
8967
|
+
};
|
|
8968
|
+
const handleResetFilters = () => {
|
|
8969
|
+
if (searchTerm && !filters.length) {
|
|
8970
|
+
setSearchTerm("");
|
|
8971
|
+
return;
|
|
8972
|
+
} else if (!searchTerm && filters.length) {
|
|
8973
|
+
setFilters([{ field: "", operator: "", value: "" }]);
|
|
8974
|
+
return;
|
|
8975
|
+
} else {
|
|
8976
|
+
setSearchTerm("");
|
|
8977
|
+
setFilters([{ field: "", operator: "", value: "" }]);
|
|
8978
|
+
return;
|
|
8979
|
+
}
|
|
8980
|
+
};
|
|
8981
|
+
if (totalResults && totalResults > 0) {
|
|
8982
|
+
return null;
|
|
8983
|
+
}
|
|
8984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
8985
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_design_system48.HorizontalRhythm, { children: [
|
|
8986
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("span", { children: [
|
|
8987
|
+
totalResults,
|
|
8988
|
+
" results ",
|
|
8989
|
+
searchTerm ? `for "${searchTerm}"` : null
|
|
8990
|
+
] }),
|
|
8991
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_design_system48.Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
|
|
8992
|
+
] }),
|
|
8993
|
+
totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_design_system48.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
8994
|
+
calloutText ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_design_system48.Paragraph, { children: calloutText }) : null,
|
|
8995
|
+
hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_design_system48.Button, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
|
|
8996
|
+
] }) : null
|
|
8997
|
+
] });
|
|
8998
|
+
};
|
|
8999
|
+
|
|
9000
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9001
|
+
var import_jsx_runtime76 = require("@emotion/react/jsx-runtime");
|
|
9002
|
+
var SearchAndFilter = ({
|
|
9003
|
+
filters,
|
|
9004
|
+
filterOptions,
|
|
9005
|
+
filterVisible,
|
|
9006
|
+
filterControls,
|
|
9007
|
+
viewSwitchControls,
|
|
9008
|
+
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SearchAndFilterResultContainer, {}),
|
|
9009
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
9010
|
+
additionalFiltersContainer,
|
|
9011
|
+
onChange,
|
|
9012
|
+
defaultSearchTerm,
|
|
9013
|
+
onSearchChange,
|
|
9014
|
+
totalResults,
|
|
9015
|
+
resetFilterValues = []
|
|
9016
|
+
}) => {
|
|
9017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9018
|
+
SearchAndFilterProvider,
|
|
9019
|
+
{
|
|
9020
|
+
filters,
|
|
9021
|
+
filterOptions,
|
|
9022
|
+
filterVisible,
|
|
9023
|
+
onChange,
|
|
9024
|
+
defaultSearchTerm,
|
|
9025
|
+
onSearchChange,
|
|
9026
|
+
totalResults,
|
|
9027
|
+
resetFilterValues,
|
|
9028
|
+
filterMapper: filterMapper2,
|
|
9029
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_design_system49.VerticalRhythm, { "data-testid": "search-and-filter", children: [
|
|
9030
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
9031
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9032
|
+
"div",
|
|
9033
|
+
{
|
|
9034
|
+
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
9035
|
+
children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
9036
|
+
}
|
|
9037
|
+
),
|
|
9038
|
+
viewSwitchControls
|
|
9039
|
+
] }),
|
|
9040
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FilterItems, { additionalFiltersContainer }),
|
|
9041
|
+
resultsContainerView
|
|
9042
|
+
] })
|
|
9043
|
+
}
|
|
9044
|
+
);
|
|
9045
|
+
};
|
|
9046
|
+
|
|
9047
|
+
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
9048
|
+
var import_design_system50 = require("@uniformdev/design-system");
|
|
9049
|
+
var import_react82 = require("react");
|
|
9050
|
+
var import_react_use7 = require("react-use");
|
|
9051
|
+
var import_jsx_runtime77 = require("@emotion/react/jsx-runtime");
|
|
9052
|
+
var SearchOnlyContext = (0, import_react82.createContext)({
|
|
9053
|
+
searchTerm: "",
|
|
9054
|
+
setSearchTerm: () => {
|
|
9055
|
+
}
|
|
9056
|
+
});
|
|
9057
|
+
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
9058
|
+
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
9059
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react82.useState)("");
|
|
9060
|
+
(0, import_react_use7.useDebounce)(
|
|
9061
|
+
() => {
|
|
9062
|
+
setSearchTerm(localeSearchTerm);
|
|
9063
|
+
onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
|
|
9064
|
+
},
|
|
9065
|
+
300,
|
|
9066
|
+
[localeSearchTerm]
|
|
9067
|
+
);
|
|
9068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
9069
|
+
SearchOnlyContext.Provider,
|
|
9070
|
+
{
|
|
9071
|
+
value: {
|
|
9072
|
+
searchTerm,
|
|
9073
|
+
setSearchTerm: setLocaleSearchTerm
|
|
9074
|
+
},
|
|
9075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
9076
|
+
import_design_system50.InputKeywordSearch,
|
|
9077
|
+
{
|
|
9078
|
+
placeholder: "Search...",
|
|
9079
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
9080
|
+
value: localeSearchTerm,
|
|
9081
|
+
compact: true,
|
|
9082
|
+
rounded: true
|
|
9083
|
+
}
|
|
9084
|
+
) })
|
|
9085
|
+
}
|
|
9086
|
+
);
|
|
9087
|
+
};
|
|
9088
|
+
|
|
9089
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
9090
|
+
var import_design_system52 = require("@uniformdev/design-system");
|
|
9091
|
+
|
|
9092
|
+
// src/components/SearchAndFilter/styles/SortItems.styles.ts
|
|
9093
|
+
var import_react83 = require("@emotion/react");
|
|
9094
|
+
var import_design_system51 = require("@uniformdev/design-system");
|
|
9095
|
+
var ConditionalFilterRow2 = import_react83.css`
|
|
9096
|
+
display: grid;
|
|
9097
|
+
grid-template-columns: 35px 1fr;
|
|
9098
|
+
gap: var(--spacing-sm);
|
|
9099
|
+
margin-left: var(--spacing-base);
|
|
9100
|
+
|
|
9101
|
+
${(0, import_design_system51.cq)("380px")} {
|
|
9102
|
+
align-items: center;
|
|
9103
|
+
|
|
9104
|
+
&:after {
|
|
9105
|
+
content: '';
|
|
9106
|
+
display: block;
|
|
9107
|
+
height: 1px;
|
|
9108
|
+
background: var(--gray-300);
|
|
9109
|
+
width: calc(100% - var(--spacing-base));
|
|
9110
|
+
margin-left: var(--spacing-base);
|
|
9111
|
+
}
|
|
9112
|
+
&:last-of-type:after {
|
|
9113
|
+
display: none;
|
|
9114
|
+
}
|
|
9115
|
+
}
|
|
9116
|
+
|
|
9117
|
+
&:nth-of-type(2) {
|
|
9118
|
+
margin-left: 0;
|
|
9119
|
+
grid-template-columns: 50px 1fr;
|
|
9120
|
+
}
|
|
9121
|
+
|
|
9122
|
+
${(0, import_design_system51.cq)("580px")} {
|
|
9123
|
+
&:after {
|
|
9124
|
+
display: none;
|
|
9125
|
+
}
|
|
9126
|
+
}
|
|
9127
|
+
|
|
9128
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
9129
|
+
animation: ${import_design_system51.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
9130
|
+
}
|
|
9131
|
+
`;
|
|
9132
|
+
var ConditionalInputRow2 = import_react83.css`
|
|
9133
|
+
display: flex;
|
|
9134
|
+
gap: var(--spacing-sm);
|
|
9135
|
+
flex-wrap: wrap;
|
|
9136
|
+
|
|
9137
|
+
${(0, import_design_system51.cq)("380px")} {
|
|
9138
|
+
& > div:nth-child(-n + 2) {
|
|
9139
|
+
width: calc(50% - var(--spacing-sm));
|
|
9140
|
+
}
|
|
9141
|
+
|
|
9142
|
+
& > div:nth-child(n + 3) {
|
|
9143
|
+
width: calc(100% - 48px);
|
|
9144
|
+
}
|
|
9145
|
+
}
|
|
9146
|
+
${(0, import_design_system51.cq)("580px")} {
|
|
9147
|
+
display: grid;
|
|
9148
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
9149
|
+
|
|
9150
|
+
& > div:nth-child(n) {
|
|
9151
|
+
width: auto;
|
|
9152
|
+
}
|
|
9153
|
+
}
|
|
9154
|
+
`;
|
|
9155
|
+
var SearchInput2 = import_react83.css`
|
|
9156
|
+
max-height: 40px;
|
|
9157
|
+
min-height: unset;
|
|
9158
|
+
`;
|
|
9159
|
+
var FilterButton3 = import_react83.css`
|
|
9160
|
+
align-items: center;
|
|
9161
|
+
background: var(--white);
|
|
9162
|
+
border: 1px solid var(--gray-300);
|
|
9163
|
+
border-radius: var(--rounded-full);
|
|
9164
|
+
color: var(--typography-base);
|
|
9165
|
+
display: flex;
|
|
9166
|
+
font-size: var(--fs-sm);
|
|
9167
|
+
gap: var(--spacing-sm);
|
|
9168
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
9169
|
+
max-height: 40px;
|
|
9170
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
9171
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
9172
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
9173
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
9174
|
+
|
|
9175
|
+
svg {
|
|
9176
|
+
color: var(--gray-300);
|
|
9177
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9178
|
+
}
|
|
9179
|
+
|
|
9180
|
+
&:hover,
|
|
9181
|
+
:where([aria-expanded='true']) {
|
|
9182
|
+
outline: none;
|
|
9183
|
+
background: var(--gray-200);
|
|
9184
|
+
border-color: var(--gray-300);
|
|
9185
|
+
|
|
9186
|
+
svg {
|
|
9187
|
+
color: var(--typography-base);
|
|
9188
|
+
}
|
|
9189
|
+
}
|
|
9190
|
+
|
|
9191
|
+
&:disabled {
|
|
9192
|
+
opacity: var(--opacity-50);
|
|
9193
|
+
}
|
|
9194
|
+
`;
|
|
9195
|
+
var FilterButtonText2 = import_react83.css`
|
|
9196
|
+
overflow: hidden;
|
|
9197
|
+
text-overflow: ellipsis;
|
|
9198
|
+
white-space: nowrap;
|
|
9199
|
+
max-width: 14ch;
|
|
9200
|
+
`;
|
|
9201
|
+
var FilterButtonSelected2 = import_react83.css`
|
|
9202
|
+
background: var(--gray-100);
|
|
9203
|
+
border-color: var(--gray-300);
|
|
9204
|
+
|
|
9205
|
+
svg {
|
|
9206
|
+
color: var(--accent-dark);
|
|
9207
|
+
}
|
|
9208
|
+
`;
|
|
9209
|
+
var FilterButtonWithOptions2 = import_react83.css`
|
|
9210
|
+
:where([aria-expanded='true']) {
|
|
9211
|
+
background: var(--purple-rain-100);
|
|
9212
|
+
border-color: var(--accent-light);
|
|
9213
|
+
color: var(--typography-base);
|
|
9214
|
+
box-shadow: var(--elevation-100);
|
|
9215
|
+
|
|
9216
|
+
svg {
|
|
9217
|
+
color: var(--accent-dark);
|
|
7589
9218
|
}
|
|
7590
|
-
|
|
9219
|
+
}
|
|
9220
|
+
`;
|
|
9221
|
+
var SearchIcon2 = import_react83.css`
|
|
9222
|
+
color: var(--icon-color);
|
|
9223
|
+
position: absolute;
|
|
9224
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
9225
|
+
margin: auto;
|
|
9226
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9227
|
+
`;
|
|
9228
|
+
var AddConditionalBtn2 = import_react83.css`
|
|
9229
|
+
align-items: center;
|
|
9230
|
+
background: transparent;
|
|
9231
|
+
border: none;
|
|
9232
|
+
color: var(--primary-action-default);
|
|
9233
|
+
display: flex;
|
|
9234
|
+
gap: var(--spacing-sm);
|
|
9235
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9236
|
+
padding: 0;
|
|
9237
|
+
|
|
9238
|
+
&:hover,
|
|
9239
|
+
&:focus {
|
|
9240
|
+
color: var(--primary-action-hover);
|
|
9241
|
+
}
|
|
9242
|
+
|
|
9243
|
+
&:disabled {
|
|
9244
|
+
color: var(--gray-400);
|
|
9245
|
+
}
|
|
9246
|
+
`;
|
|
9247
|
+
var Title2 = import_react83.css`
|
|
9248
|
+
color: var(--typography-light);
|
|
9249
|
+
|
|
9250
|
+
&:focus {
|
|
9251
|
+
outline: none;
|
|
9252
|
+
}
|
|
9253
|
+
`;
|
|
9254
|
+
var ResetConditionsBtn2 = import_react83.css`
|
|
9255
|
+
background: transparent;
|
|
9256
|
+
border: none;
|
|
9257
|
+
color: var(--action-destructive-default);
|
|
9258
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9259
|
+
padding: 0;
|
|
9260
|
+
|
|
9261
|
+
&:hover,
|
|
9262
|
+
&:focus {
|
|
9263
|
+
color: var(--action-destructive-hover);
|
|
9264
|
+
}
|
|
9265
|
+
`;
|
|
9266
|
+
var IconBtn2 = import_react83.css`
|
|
9267
|
+
background: transparent;
|
|
9268
|
+
border: none;
|
|
9269
|
+
padding: var(--spacing-sm);
|
|
9270
|
+
`;
|
|
9271
|
+
var SearchAndFilterOptionsContainer3 = import_react83.css`
|
|
9272
|
+
background: var(--gray-50);
|
|
9273
|
+
border: 1px solid var(--gray-300);
|
|
9274
|
+
border-radius: var(--rounded-base);
|
|
9275
|
+
container-type: inline-size;
|
|
9276
|
+
display: flex;
|
|
9277
|
+
flex-direction: column;
|
|
9278
|
+
gap: var(--spacing-sm);
|
|
9279
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
9280
|
+
will-change: height;
|
|
9281
|
+
position: relative;
|
|
9282
|
+
z-index: 1;
|
|
9283
|
+
`;
|
|
9284
|
+
var SearchAndFilterOptionsInnerContainer2 = import_react83.css`
|
|
9285
|
+
display: flex;
|
|
9286
|
+
flex-direction: column;
|
|
9287
|
+
gap: var(--spacing-sm);
|
|
9288
|
+
padding-inline: var(--spacing-md);
|
|
9289
|
+
`;
|
|
9290
|
+
var SearchAndFilterButtonGroup2 = import_react83.css`
|
|
9291
|
+
margin-top: var(--spacing-xs);
|
|
9292
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
9293
|
+
`;
|
|
9294
|
+
var SortFilterWrapper = (hiddenLocaleInput) => import_react83.css`
|
|
9295
|
+
align-items: center;
|
|
9296
|
+
border-top: 1px solid var(--gray-300);
|
|
9297
|
+
display: flex;
|
|
9298
|
+
flex-wrap: wrap;
|
|
9299
|
+
gap: var(--spacing-base);
|
|
9300
|
+
padding: var(--spacing-base) var(--spacing-md) 0;
|
|
9301
|
+
position: relative;
|
|
9302
|
+
z-index: 0;
|
|
9303
|
+
|
|
9304
|
+
${(0, import_design_system51.cq)("420px")} {
|
|
9305
|
+
display: grid;
|
|
9306
|
+
grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
|
|
9307
|
+
}
|
|
9308
|
+
`;
|
|
9309
|
+
var SortFilterInputRow = import_react83.css`
|
|
9310
|
+
align-items: center;
|
|
9311
|
+
display: grid;
|
|
9312
|
+
grid-template-columns: 1fr auto;
|
|
9313
|
+
gap: var(--spacing-base);
|
|
9314
|
+
`;
|
|
9315
|
+
var InputVariableWrapper = import_react83.css`
|
|
9316
|
+
flex-grow: 1;
|
|
9317
|
+
|
|
9318
|
+
// we need to override label styles nested within the input variable
|
|
9319
|
+
// as these are slightly different from the default label styles
|
|
9320
|
+
label > span {
|
|
9321
|
+
color: var(--typography-light);
|
|
9322
|
+
}
|
|
9323
|
+
`;
|
|
9324
|
+
|
|
9325
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
9326
|
+
var import_jsx_runtime78 = require("@emotion/react/jsx-runtime");
|
|
9327
|
+
var SortItems = ({
|
|
9328
|
+
sortByLabel = "Sort by",
|
|
9329
|
+
localeLabel = "Show locale",
|
|
9330
|
+
sortOptions,
|
|
9331
|
+
sortByValue,
|
|
9332
|
+
onSortChange,
|
|
9333
|
+
localeValue,
|
|
9334
|
+
localeOptions,
|
|
9335
|
+
onLocaleChange,
|
|
9336
|
+
disableSortBinding
|
|
9337
|
+
}) => {
|
|
9338
|
+
var _a, _b;
|
|
9339
|
+
const hideLocaleOptions = !localeOptions || !onLocaleChange;
|
|
9340
|
+
const values = sortByValue == null ? void 0 : sortByValue.split("_");
|
|
9341
|
+
const sortDirection = values == null ? void 0 : values.pop();
|
|
9342
|
+
const sortField = values == null ? void 0 : values.join("_");
|
|
9343
|
+
const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
|
|
9344
|
+
var _a2;
|
|
9345
|
+
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
9346
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
9347
|
+
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9349
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_design_system52.VerticalRhythm, { gap: "xs", children: [
|
|
9350
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { css: Title2, children: sortByLabel }),
|
|
9351
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { css: SortFilterInputRow, children: [
|
|
9352
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9353
|
+
InputVariables,
|
|
9354
|
+
{
|
|
9355
|
+
disableInlineMenu: disableSortBinding,
|
|
9356
|
+
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9357
|
+
value: sortField,
|
|
9358
|
+
valueToResetTo: "created_at",
|
|
9359
|
+
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9360
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9361
|
+
import_design_system52.InputComboBox,
|
|
9362
|
+
{
|
|
9363
|
+
id: "sort-by-field",
|
|
9364
|
+
"aria-label": "Sort by",
|
|
9365
|
+
options: sortOptions,
|
|
9366
|
+
onChange: (e) => {
|
|
9367
|
+
const fieldName = e == null ? void 0 : e.value;
|
|
9368
|
+
onSortChange(`${fieldName}_${sortDirection}`);
|
|
9369
|
+
},
|
|
9370
|
+
styles: {
|
|
9371
|
+
menu(base) {
|
|
9372
|
+
return {
|
|
9373
|
+
...base,
|
|
9374
|
+
minWidth: "max-content"
|
|
9375
|
+
};
|
|
9376
|
+
}
|
|
9377
|
+
},
|
|
9378
|
+
value: currentSelectedOption
|
|
9379
|
+
}
|
|
9380
|
+
)
|
|
9381
|
+
}
|
|
9382
|
+
),
|
|
9383
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9384
|
+
InputVariables,
|
|
9385
|
+
{
|
|
9386
|
+
disableInlineMenu: disableSortBinding,
|
|
9387
|
+
value: sortDirection,
|
|
9388
|
+
valueToResetTo: "DESC",
|
|
9389
|
+
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9390
|
+
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9391
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9392
|
+
import_design_system52.SegmentedControl,
|
|
9393
|
+
{
|
|
9394
|
+
noCheckmark: true,
|
|
9395
|
+
name: "sortBy",
|
|
9396
|
+
hideOptionText: true,
|
|
9397
|
+
iconSize: "1rem",
|
|
9398
|
+
size: "xl",
|
|
9399
|
+
options: [
|
|
9400
|
+
{
|
|
9401
|
+
label: "Ascending",
|
|
9402
|
+
icon: "arrow-up",
|
|
9403
|
+
value: `ASC`,
|
|
9404
|
+
tooltip: "Ascending (e.g. A-Z, oldest to newest)",
|
|
9405
|
+
"data-testid": "sort-ascending"
|
|
9406
|
+
},
|
|
9407
|
+
{
|
|
9408
|
+
label: "Descending",
|
|
9409
|
+
icon: "arrow-down",
|
|
9410
|
+
value: `DESC`,
|
|
9411
|
+
tooltip: "Descending (e.g. Z-A, newest to oldest)",
|
|
9412
|
+
"data-testid": "sort-descending"
|
|
9413
|
+
}
|
|
9414
|
+
],
|
|
9415
|
+
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9416
|
+
value: sortDirection
|
|
9417
|
+
}
|
|
9418
|
+
)
|
|
9419
|
+
}
|
|
9420
|
+
)
|
|
9421
|
+
] })
|
|
9422
|
+
] }),
|
|
9423
|
+
hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_design_system52.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
7591
9424
|
InputVariables,
|
|
7592
9425
|
{
|
|
7593
|
-
|
|
9426
|
+
label: localeLabelValue,
|
|
9427
|
+
value: localeValue,
|
|
7594
9428
|
showMenuPosition: "inline-right",
|
|
7595
|
-
onChange: (
|
|
7596
|
-
|
|
7597
|
-
|
|
9429
|
+
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9430
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9431
|
+
import_design_system52.InputSelect,
|
|
9432
|
+
{
|
|
9433
|
+
name: "localeReturned",
|
|
9434
|
+
"aria-label": localeLabelValue,
|
|
9435
|
+
label: localeLabelValue,
|
|
9436
|
+
showLabel: false,
|
|
9437
|
+
"data-testid": "context-locale",
|
|
9438
|
+
onChange: (e) => {
|
|
9439
|
+
var _a2;
|
|
9440
|
+
return onLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
|
|
9441
|
+
},
|
|
9442
|
+
options: localeOptions,
|
|
9443
|
+
value: localeValue
|
|
9444
|
+
}
|
|
9445
|
+
)
|
|
7598
9446
|
}
|
|
7599
|
-
)
|
|
7600
|
-
};
|
|
7601
|
-
return WithInputVariables;
|
|
7602
|
-
}
|
|
7603
|
-
var bindableFiltersMapper = {
|
|
7604
|
-
...import_design_system42.filterMapper,
|
|
7605
|
-
multiChoice: withInputVariablesForMultiValue(import_design_system42.FilterMultiChoiceEditor),
|
|
7606
|
-
singleChoice: withInputVariables(import_design_system43.FilterSingleChoiceEditor),
|
|
7607
|
-
date: withInputVariables(import_design_system43.DateEditor),
|
|
7608
|
-
text: withInputVariables(import_design_system43.TextEditor),
|
|
7609
|
-
number: withInputVariables(import_design_system43.NumberEditor)
|
|
9447
|
+
) })
|
|
9448
|
+
] });
|
|
7610
9449
|
};
|
|
7611
9450
|
|
|
9451
|
+
// src/utils/createLocationValidator.ts
|
|
9452
|
+
function createLocationValidator(setValue, validate) {
|
|
9453
|
+
return (dispatch) => setValue((previous) => {
|
|
9454
|
+
const { newValue, options } = dispatch(previous);
|
|
9455
|
+
return { newValue, options: validate(newValue, options) };
|
|
9456
|
+
});
|
|
9457
|
+
}
|
|
9458
|
+
|
|
9459
|
+
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
9460
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
9461
|
+
var import_react84 = require("react");
|
|
9462
|
+
function useContentDataResourceLocaleInfo({
|
|
9463
|
+
locale,
|
|
9464
|
+
setLocale,
|
|
9465
|
+
dynamicInputs
|
|
9466
|
+
}) {
|
|
9467
|
+
var _a;
|
|
9468
|
+
const setLocaleRef = (0, import_react84.useRef)(setLocale);
|
|
9469
|
+
setLocaleRef.current = setLocale;
|
|
9470
|
+
const { flatVariables } = useVariables();
|
|
9471
|
+
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
9472
|
+
const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
9473
|
+
(0, import_react84.useEffect)(() => {
|
|
9474
|
+
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
9475
|
+
setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
|
|
9476
|
+
}
|
|
9477
|
+
}, [locale, effectiveLocale]);
|
|
9478
|
+
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
9479
|
+
}
|
|
9480
|
+
|
|
7612
9481
|
// src/index.ts
|
|
7613
|
-
var
|
|
9482
|
+
var import_design_system53 = require("@uniformdev/design-system");
|
|
7614
9483
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
7615
9484
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7616
9485
|
0 && (module.exports = {
|
|
@@ -7618,23 +9487,33 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7618
9487
|
$isVariableNode,
|
|
7619
9488
|
AddListButton,
|
|
7620
9489
|
Button,
|
|
9490
|
+
CHECKBOX_OPERATORS,
|
|
7621
9491
|
Callout,
|
|
7622
|
-
ControlledObjectSearchProvider,
|
|
7623
9492
|
ControlledValuePlugin,
|
|
9493
|
+
DATE_OPERATORS,
|
|
7624
9494
|
DISCONNECT_VARIABLE_COMMAND,
|
|
7625
9495
|
DamSelectedItem,
|
|
7626
9496
|
DataRefreshButton,
|
|
7627
9497
|
DataResourceDynamicInputProvider,
|
|
7628
|
-
DataResourceInputContext,
|
|
7629
9498
|
DataResourceVariablesList,
|
|
7630
9499
|
DataResourceVariablesListExplicit,
|
|
7631
9500
|
DataSourceEditor,
|
|
7632
9501
|
DataTypeEditor,
|
|
9502
|
+
DateEditor,
|
|
9503
|
+
DateRangeEditor,
|
|
7633
9504
|
DefaultSearchRow,
|
|
7634
9505
|
DefaultSelectedItem,
|
|
7635
9506
|
DrawerContent,
|
|
7636
9507
|
EDIT_VARIABLE_COMMAND,
|
|
7637
9508
|
EntrySearch,
|
|
9509
|
+
FilterButton,
|
|
9510
|
+
FilterControls,
|
|
9511
|
+
FilterEditorRenderer,
|
|
9512
|
+
FilterItem,
|
|
9513
|
+
FilterItems,
|
|
9514
|
+
FilterMenu,
|
|
9515
|
+
FilterMultiChoiceEditor,
|
|
9516
|
+
FilterSingleChoiceEditor,
|
|
7638
9517
|
Heading,
|
|
7639
9518
|
INSERT_VARIABLE_COMMAND,
|
|
7640
9519
|
Icons,
|
|
@@ -7651,18 +9530,20 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7651
9530
|
Menu,
|
|
7652
9531
|
MenuItem,
|
|
7653
9532
|
MeshApp,
|
|
9533
|
+
NUMBER_OPERATORS,
|
|
9534
|
+
NumberEditor,
|
|
9535
|
+
NumberRangeEditor,
|
|
7654
9536
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
7655
9537
|
ObjectSearchContainer,
|
|
7656
|
-
ObjectSearchContext,
|
|
7657
9538
|
ObjectSearchFilter,
|
|
7658
9539
|
ObjectSearchFilterContainer,
|
|
7659
9540
|
ObjectSearchListItem,
|
|
7660
9541
|
ObjectSearchListItemLoadingSkeleton,
|
|
7661
|
-
ObjectSearchListOfSearchResults,
|
|
7662
9542
|
ObjectSearchProvider,
|
|
7663
9543
|
ObjectSearchResultItem,
|
|
7664
9544
|
ObjectSearchResultItemButton,
|
|
7665
9545
|
ObjectSearchResultList,
|
|
9546
|
+
PUBLISH_STATUS_FIELD_OPERATORS,
|
|
7666
9547
|
ParamTypeDynamicDataProvider,
|
|
7667
9548
|
ParameterConnectionIndicator,
|
|
7668
9549
|
ParameterGroup,
|
|
@@ -7690,6 +9571,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7690
9571
|
ProductSearchRow,
|
|
7691
9572
|
ProductSelectedItem,
|
|
7692
9573
|
QueryFilter,
|
|
9574
|
+
RICHTEXT_OPERATORS,
|
|
7693
9575
|
RequestBody,
|
|
7694
9576
|
RequestHeaders,
|
|
7695
9577
|
RequestMethodSelect,
|
|
@@ -7699,20 +9581,34 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7699
9581
|
RequestUrl,
|
|
7700
9582
|
RequestUrlInput,
|
|
7701
9583
|
ResolvableLoadingValue,
|
|
9584
|
+
SYSTEM_DATE_OPERATORS,
|
|
9585
|
+
SYSTEM_FIELD_OPERATORS,
|
|
7702
9586
|
ScrollableList,
|
|
7703
9587
|
ScrollableListItem,
|
|
9588
|
+
SearchAndFilter,
|
|
9589
|
+
SearchAndFilterContext,
|
|
9590
|
+
SearchAndFilterOptionsContainer,
|
|
9591
|
+
SearchAndFilterProvider,
|
|
9592
|
+
SearchAndFilterResultContainer,
|
|
9593
|
+
SearchOnlyContext,
|
|
9594
|
+
SearchOnlyFilter,
|
|
7704
9595
|
SelectionField,
|
|
9596
|
+
SortItems,
|
|
9597
|
+
StatusMultiEditor,
|
|
9598
|
+
StatusSingleEditor,
|
|
7705
9599
|
Switch,
|
|
9600
|
+
TEXTBOX_OPERATORS,
|
|
9601
|
+
TextEditor,
|
|
7706
9602
|
TextVariableRenderer,
|
|
7707
9603
|
Textarea,
|
|
7708
9604
|
Theme,
|
|
9605
|
+
USER_OPERATORS,
|
|
7709
9606
|
VariableEditor,
|
|
7710
9607
|
VariableNode,
|
|
7711
9608
|
VariablesList,
|
|
7712
9609
|
VariablesPlugin,
|
|
7713
9610
|
VariablesProvider,
|
|
7714
9611
|
badgeIcon,
|
|
7715
|
-
bindQuery,
|
|
7716
9612
|
bindableFiltersMapper,
|
|
7717
9613
|
convertConnectedDataToVariable,
|
|
7718
9614
|
createLocationValidator,
|
|
@@ -7744,6 +9640,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7744
9640
|
entrySearchSelectInput,
|
|
7745
9641
|
entrySearchSelectOption,
|
|
7746
9642
|
entrySearchWrapper,
|
|
9643
|
+
filterMapper,
|
|
7747
9644
|
hasReferencedVariables,
|
|
7748
9645
|
prettifyBindExpression,
|
|
7749
9646
|
productSearchRowActiveIcon,
|
|
@@ -7785,7 +9682,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7785
9682
|
urlEncodeRequestUrl,
|
|
7786
9683
|
useConnectedDataAsVariables,
|
|
7787
9684
|
useContentDataResourceLocaleInfo,
|
|
7788
|
-
useDataResourceDynamicInputs,
|
|
7789
9685
|
useDynamicInputsAsVariables,
|
|
7790
9686
|
useMeshLocation,
|
|
7791
9687
|
useObjectSearchContext,
|
|
@@ -7795,6 +9691,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7795
9691
|
useRequest,
|
|
7796
9692
|
useRequestHeader,
|
|
7797
9693
|
useRequestParameter,
|
|
9694
|
+
useSearchAndFilter,
|
|
7798
9695
|
useUniformMeshSdk,
|
|
7799
9696
|
useVariableEditor,
|
|
7800
9697
|
useVariables,
|