@uniformdev/mesh-sdk-react 19.140.2-alpha.7 → 19.142.0
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 +458 -18
- package/dist/index.d.ts +458 -18
- package/dist/index.esm.js +1787 -171
- package/dist/index.js +1807 -163
- package/dist/index.mjs +1787 -171
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -33,10 +33,12 @@ var src_exports = {};
|
|
|
33
33
|
__export(src_exports, {
|
|
34
34
|
$createVariableNode: () => $createVariableNode,
|
|
35
35
|
$isVariableNode: () => $isVariableNode,
|
|
36
|
-
AddListButton: () =>
|
|
37
|
-
Button: () =>
|
|
38
|
-
|
|
36
|
+
AddListButton: () => import_design_system51.AddListButton,
|
|
37
|
+
Button: () => import_design_system51.Button,
|
|
38
|
+
CHECKBOX_OPERATORS: () => CHECKBOX_OPERATORS,
|
|
39
|
+
Callout: () => import_design_system51.Callout,
|
|
39
40
|
ControlledValuePlugin: () => ControlledValuePlugin,
|
|
41
|
+
DATE_OPERATORS: () => DATE_OPERATORS,
|
|
40
42
|
DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
|
|
41
43
|
DamSelectedItem: () => DamSelectedItem,
|
|
42
44
|
DataRefreshButton: () => DataRefreshButton,
|
|
@@ -45,27 +47,40 @@ __export(src_exports, {
|
|
|
45
47
|
DataResourceVariablesListExplicit: () => DataResourceVariablesListExplicit,
|
|
46
48
|
DataSourceEditor: () => DataSourceEditor,
|
|
47
49
|
DataTypeEditor: () => DataTypeEditor,
|
|
50
|
+
DateEditor: () => DateEditor,
|
|
51
|
+
DateRangeEditor: () => DateRangeEditor,
|
|
48
52
|
DefaultSearchRow: () => DefaultSearchRow,
|
|
49
53
|
DefaultSelectedItem: () => DefaultSelectedItem,
|
|
50
|
-
DrawerContent: () =>
|
|
54
|
+
DrawerContent: () => import_design_system51.DrawerContent,
|
|
51
55
|
EDIT_VARIABLE_COMMAND: () => EDIT_VARIABLE_COMMAND,
|
|
52
56
|
EntrySearch: () => EntrySearch,
|
|
53
|
-
|
|
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_system51.Heading,
|
|
54
66
|
INSERT_VARIABLE_COMMAND: () => INSERT_VARIABLE_COMMAND,
|
|
55
67
|
Icons: () => icons_exports,
|
|
56
|
-
Input: () =>
|
|
57
|
-
InputComboBox: () =>
|
|
58
|
-
InputKeywordSearch: () =>
|
|
59
|
-
InputSelect: () =>
|
|
60
|
-
InputToggle: () =>
|
|
68
|
+
Input: () => import_design_system51.Input,
|
|
69
|
+
InputComboBox: () => import_design_system51.InputComboBox,
|
|
70
|
+
InputKeywordSearch: () => import_design_system51.InputKeywordSearch,
|
|
71
|
+
InputSelect: () => import_design_system51.InputSelect,
|
|
72
|
+
InputToggle: () => import_design_system51.InputToggle,
|
|
61
73
|
InputVariables: () => InputVariables,
|
|
62
|
-
Label: () =>
|
|
74
|
+
Label: () => import_design_system51.Label,
|
|
63
75
|
LinkButton: () => LinkButton,
|
|
64
|
-
LoadingIndicator: () =>
|
|
65
|
-
LoadingOverlay: () =>
|
|
66
|
-
Menu: () =>
|
|
67
|
-
MenuItem: () =>
|
|
76
|
+
LoadingIndicator: () => import_design_system51.LoadingIndicator,
|
|
77
|
+
LoadingOverlay: () => import_design_system51.LoadingOverlay,
|
|
78
|
+
Menu: () => import_design_system51.Menu,
|
|
79
|
+
MenuItem: () => import_design_system51.MenuItem,
|
|
68
80
|
MeshApp: () => MeshApp,
|
|
81
|
+
NUMBER_OPERATORS: () => NUMBER_OPERATORS,
|
|
82
|
+
NumberEditor: () => NumberEditor,
|
|
83
|
+
NumberRangeEditor: () => NumberRangeEditor,
|
|
69
84
|
OPEN_INSERT_VARIABLE_COMMAND: () => OPEN_INSERT_VARIABLE_COMMAND,
|
|
70
85
|
ObjectSearchContainer: () => ObjectSearchContainer,
|
|
71
86
|
ObjectSearchFilter: () => ObjectSearchFilter,
|
|
@@ -76,24 +91,25 @@ __export(src_exports, {
|
|
|
76
91
|
ObjectSearchResultItem: () => ObjectSearchResultItem,
|
|
77
92
|
ObjectSearchResultItemButton: () => ObjectSearchResultItemButton,
|
|
78
93
|
ObjectSearchResultList: () => ObjectSearchResultList,
|
|
94
|
+
PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
|
|
79
95
|
ParamTypeDynamicDataProvider: () => ParamTypeDynamicDataProvider,
|
|
80
96
|
ParameterConnectionIndicator: () => ParameterConnectionIndicator,
|
|
81
|
-
ParameterGroup: () =>
|
|
82
|
-
ParameterImage: () =>
|
|
83
|
-
ParameterImageInner: () =>
|
|
84
|
-
ParameterInput: () =>
|
|
85
|
-
ParameterInputInner: () =>
|
|
86
|
-
ParameterLabel: () =>
|
|
87
|
-
ParameterMenuButton: () =>
|
|
97
|
+
ParameterGroup: () => import_design_system51.ParameterGroup,
|
|
98
|
+
ParameterImage: () => import_design_system51.ParameterImage,
|
|
99
|
+
ParameterImageInner: () => import_design_system51.ParameterImageInner,
|
|
100
|
+
ParameterInput: () => import_design_system51.ParameterInput,
|
|
101
|
+
ParameterInputInner: () => import_design_system51.ParameterInputInner,
|
|
102
|
+
ParameterLabel: () => import_design_system51.ParameterLabel,
|
|
103
|
+
ParameterMenuButton: () => import_design_system51.ParameterMenuButton,
|
|
88
104
|
ParameterOrSingleVariable: () => ParameterOrSingleVariable,
|
|
89
|
-
ParameterSelect: () =>
|
|
90
|
-
ParameterSelectInner: () =>
|
|
91
|
-
ParameterShell: () =>
|
|
105
|
+
ParameterSelect: () => import_design_system51.ParameterSelect,
|
|
106
|
+
ParameterSelectInner: () => import_design_system51.ParameterSelectInner,
|
|
107
|
+
ParameterShell: () => import_design_system51.ParameterShell,
|
|
92
108
|
ParameterShellContext: () => import_design_system14.ParameterShellContext,
|
|
93
|
-
ParameterTextarea: () =>
|
|
94
|
-
ParameterTextareaInner: () =>
|
|
95
|
-
ParameterToggle: () =>
|
|
96
|
-
ParameterToggleInner: () =>
|
|
109
|
+
ParameterTextarea: () => import_design_system51.ParameterTextarea,
|
|
110
|
+
ParameterTextareaInner: () => import_design_system51.ParameterTextareaInner,
|
|
111
|
+
ParameterToggle: () => import_design_system51.ParameterToggle,
|
|
112
|
+
ParameterToggleInner: () => import_design_system51.ParameterToggleInner,
|
|
97
113
|
ParameterVariables: () => ParameterVariables,
|
|
98
114
|
ProductPreviewList: () => ProductPreviewList,
|
|
99
115
|
ProductQuery: () => ProductQuery,
|
|
@@ -103,6 +119,7 @@ __export(src_exports, {
|
|
|
103
119
|
ProductSearchRow: () => ProductSearchRow,
|
|
104
120
|
ProductSelectedItem: () => ProductSelectedItem,
|
|
105
121
|
QueryFilter: () => QueryFilter,
|
|
122
|
+
RICHTEXT_OPERATORS: () => RICHTEXT_OPERATORS,
|
|
106
123
|
RequestBody: () => RequestBody,
|
|
107
124
|
RequestHeaders: () => RequestHeaders,
|
|
108
125
|
RequestMethodSelect: () => RequestMethodSelect,
|
|
@@ -112,13 +129,27 @@ __export(src_exports, {
|
|
|
112
129
|
RequestUrl: () => RequestUrl,
|
|
113
130
|
RequestUrlInput: () => RequestUrlInput,
|
|
114
131
|
ResolvableLoadingValue: () => ResolvableLoadingValue,
|
|
115
|
-
|
|
116
|
-
|
|
132
|
+
SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
|
|
133
|
+
SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
|
|
134
|
+
ScrollableList: () => import_design_system51.ScrollableList,
|
|
135
|
+
ScrollableListItem: () => import_design_system51.ScrollableListItem,
|
|
136
|
+
SearchAndFilter: () => SearchAndFilter,
|
|
137
|
+
SearchAndFilterContext: () => SearchAndFilterContext,
|
|
138
|
+
SearchAndFilterOptionsContainer: () => SearchAndFilterOptionsContainer2,
|
|
139
|
+
SearchAndFilterProvider: () => SearchAndFilterProvider,
|
|
140
|
+
SearchAndFilterResultContainer: () => SearchAndFilterResultContainer,
|
|
141
|
+
SearchOnlyContext: () => SearchOnlyContext,
|
|
142
|
+
SearchOnlyFilter: () => SearchOnlyFilter,
|
|
117
143
|
SelectionField: () => SelectionField,
|
|
118
|
-
|
|
144
|
+
StatusMultiEditor: () => StatusMultiEditor,
|
|
145
|
+
StatusSingleEditor: () => StatusSingleEditor,
|
|
146
|
+
Switch: () => import_design_system51.Switch,
|
|
147
|
+
TEXTBOX_OPERATORS: () => TEXTBOX_OPERATORS,
|
|
148
|
+
TextEditor: () => TextEditor,
|
|
119
149
|
TextVariableRenderer: () => TextVariableRenderer,
|
|
120
|
-
Textarea: () =>
|
|
121
|
-
Theme: () =>
|
|
150
|
+
Textarea: () => import_design_system51.Textarea,
|
|
151
|
+
Theme: () => import_design_system51.Theme,
|
|
152
|
+
USER_OPERATORS: () => USER_OPERATORS,
|
|
122
153
|
VariableEditor: () => VariableEditor,
|
|
123
154
|
VariableNode: () => VariableNode,
|
|
124
155
|
VariablesList: () => VariablesList,
|
|
@@ -156,6 +187,7 @@ __export(src_exports, {
|
|
|
156
187
|
entrySearchSelectInput: () => entrySearchSelectInput,
|
|
157
188
|
entrySearchSelectOption: () => entrySearchSelectOption,
|
|
158
189
|
entrySearchWrapper: () => entrySearchWrapper,
|
|
190
|
+
filterMapper: () => filterMapper,
|
|
159
191
|
hasReferencedVariables: () => hasReferencedVariables,
|
|
160
192
|
prettifyBindExpression: () => prettifyBindExpression,
|
|
161
193
|
productSearchRowActiveIcon: () => productSearchRowActiveIcon,
|
|
@@ -206,6 +238,7 @@ __export(src_exports, {
|
|
|
206
238
|
useRequest: () => useRequest,
|
|
207
239
|
useRequestHeader: () => useRequestHeader,
|
|
208
240
|
useRequestParameter: () => useRequestParameter,
|
|
241
|
+
useSearchAndFilter: () => useSearchAndFilter,
|
|
209
242
|
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
210
243
|
useVariableEditor: () => useVariableEditor,
|
|
211
244
|
useVariables: () => useVariables,
|
|
@@ -3139,7 +3172,8 @@ var import_react40 = require("react");
|
|
|
3139
3172
|
|
|
3140
3173
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
3141
3174
|
function prettifyBindExpression(bindExpression) {
|
|
3142
|
-
|
|
3175
|
+
const [, expression] = bindExpression.split(":");
|
|
3176
|
+
return expression;
|
|
3143
3177
|
}
|
|
3144
3178
|
|
|
3145
3179
|
// src/components/Variables/composer/VariableChip.tsx
|
|
@@ -3159,42 +3193,58 @@ function VariableChip({
|
|
|
3159
3193
|
}) {
|
|
3160
3194
|
const hasClickEvent = !!onClick;
|
|
3161
3195
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
3162
|
-
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
|
|
3196
|
+
const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
|
|
3163
3197
|
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
3198
|
+
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 }) });
|
|
3199
|
+
if (tooltip) {
|
|
3200
|
+
const tip = tooltip ? `${tooltip}${extraTitle ? `
|
|
3201
|
+
|
|
3202
|
+
${extraTitle}` : ""}` : extraTitle != null ? extraTitle : "";
|
|
3203
|
+
const tipLines = tip.split("\n");
|
|
3204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3205
|
+
import_design_system15.Tooltip,
|
|
3206
|
+
{
|
|
3207
|
+
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)) }),
|
|
3208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: chippy })
|
|
3209
|
+
}
|
|
3210
|
+
);
|
|
3211
|
+
}
|
|
3212
|
+
return chippy;
|
|
3213
|
+
}
|
|
3214
|
+
function UndefinedVariableReference({ children }) {
|
|
3164
3215
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3165
|
-
|
|
3216
|
+
"span",
|
|
3166
3217
|
{
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference })
|
|
3218
|
+
style: {
|
|
3219
|
+
textDecoration: "underline",
|
|
3220
|
+
textDecorationStyle: "wavy",
|
|
3221
|
+
textDecorationColor: "var(--error)"
|
|
3222
|
+
},
|
|
3223
|
+
children
|
|
3174
3224
|
}
|
|
3175
3225
|
);
|
|
3176
3226
|
}
|
|
3177
|
-
function
|
|
3227
|
+
function InfoVariableReference({ children }) {
|
|
3178
3228
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3179
3229
|
"span",
|
|
3180
3230
|
{
|
|
3181
3231
|
style: {
|
|
3182
3232
|
textDecoration: "underline",
|
|
3183
3233
|
textDecorationStyle: "wavy",
|
|
3184
|
-
textDecorationColor: "
|
|
3234
|
+
textDecorationColor: "var(--primary-action-default)"
|
|
3185
3235
|
},
|
|
3186
3236
|
children
|
|
3187
3237
|
}
|
|
3188
3238
|
);
|
|
3189
3239
|
}
|
|
3190
|
-
function
|
|
3240
|
+
function WarningVariableReference({ children }) {
|
|
3191
3241
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3192
3242
|
"span",
|
|
3193
3243
|
{
|
|
3194
3244
|
style: {
|
|
3195
3245
|
textDecoration: "underline",
|
|
3196
3246
|
textDecorationStyle: "wavy",
|
|
3197
|
-
textDecorationColor: "
|
|
3247
|
+
textDecorationColor: "var(--alert)"
|
|
3198
3248
|
},
|
|
3199
3249
|
children
|
|
3200
3250
|
}
|
|
@@ -3442,7 +3492,8 @@ function VariablesProvider({
|
|
|
3442
3492
|
readOnly,
|
|
3443
3493
|
isLoading,
|
|
3444
3494
|
children,
|
|
3445
|
-
knownUndefinedValues = {}
|
|
3495
|
+
knownUndefinedValues = {},
|
|
3496
|
+
onChangeKnownUndefinedValue
|
|
3446
3497
|
}) {
|
|
3447
3498
|
const [editing, setEditing] = (0, import_react37.useState)();
|
|
3448
3499
|
const [editingContext, setEditingContext] = (0, import_react37.useState)();
|
|
@@ -3509,6 +3560,15 @@ function VariablesProvider({
|
|
|
3509
3560
|
isLoading: !!isLoading
|
|
3510
3561
|
};
|
|
3511
3562
|
}, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
|
|
3563
|
+
(0, import_react37.useEffect)(() => {
|
|
3564
|
+
if (editing === void 0) {
|
|
3565
|
+
return;
|
|
3566
|
+
}
|
|
3567
|
+
const activeElement = document.activeElement;
|
|
3568
|
+
if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") {
|
|
3569
|
+
activeElement.blur();
|
|
3570
|
+
}
|
|
3571
|
+
}, [editing]);
|
|
3512
3572
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
|
|
3513
3573
|
children,
|
|
3514
3574
|
typeof editing !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -3517,9 +3577,19 @@ function VariablesProvider({
|
|
|
3517
3577
|
context: editingContext,
|
|
3518
3578
|
onSubmit: (val, editorCompletedContext) => {
|
|
3519
3579
|
contextValue.dispatch({ type: "cancelEdit" });
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3580
|
+
if ("resultType" in val) {
|
|
3581
|
+
if (!onChangeKnownUndefinedValue) {
|
|
3582
|
+
throw new Error(
|
|
3583
|
+
"onChangeKnownUndefinedValue must be provided to handle known-undefined-value results"
|
|
3584
|
+
);
|
|
3585
|
+
}
|
|
3586
|
+
const { name, ...kuv } = val;
|
|
3587
|
+
onChangeKnownUndefinedValue(val.name, kuv);
|
|
3588
|
+
} else {
|
|
3589
|
+
const { name, ...varValue } = val;
|
|
3590
|
+
const latestValue = { ...value, [name]: varValue };
|
|
3591
|
+
onChange == null ? void 0 : onChange(latestValue);
|
|
3592
|
+
}
|
|
3523
3593
|
events.emit("editCompleted", {
|
|
3524
3594
|
canceled: false,
|
|
3525
3595
|
selectedVariable: val,
|
|
@@ -3934,21 +4004,21 @@ function VariablesPlugin({
|
|
|
3934
4004
|
]);
|
|
3935
4005
|
const updateExistingNodeIfChanged = (0, import_react39.useCallback)(
|
|
3936
4006
|
(variableNode) => {
|
|
3937
|
-
var _a, _b, _c;
|
|
4007
|
+
var _a, _b, _c, _d;
|
|
3938
4008
|
const targetVar = variablesRef.current.variables[variableNode.reference];
|
|
3939
4009
|
const targetUndefinedVar = variablesRef.current.knownUndefinedValues[variableNode.reference];
|
|
3940
4010
|
const isLoadingVariables = variablesRef.current.isLoading;
|
|
3941
4011
|
const currentState = variableNode.getState();
|
|
3942
|
-
if (currentState.isFresh && !targetVar) {
|
|
4012
|
+
if (currentState.isFresh && !targetVar && !targetUndefinedVar) {
|
|
3943
4013
|
return;
|
|
3944
4014
|
}
|
|
3945
|
-
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;
|
|
4015
|
+
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;
|
|
3946
4016
|
const newState = {
|
|
3947
4017
|
...currentState,
|
|
3948
4018
|
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
|
|
3949
4019
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
3950
4020
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
3951
|
-
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
4021
|
+
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),
|
|
3952
4022
|
tooltip,
|
|
3953
4023
|
isFresh: false
|
|
3954
4024
|
};
|
|
@@ -3964,7 +4034,7 @@ function VariablesPlugin({
|
|
|
3964
4034
|
updateExistingNodeIfChanged(variableNode);
|
|
3965
4035
|
});
|
|
3966
4036
|
});
|
|
3967
|
-
}, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
|
|
4037
|
+
}, [editor, variables, knownUndefinedValues, canEditVariable, updateExistingNodeIfChanged]);
|
|
3968
4038
|
(0, import_react39.useEffect)(() => {
|
|
3969
4039
|
return editor.registerNodeTransform(VariableNode, (variableNode) => {
|
|
3970
4040
|
updateExistingNodeIfChanged(variableNode);
|
|
@@ -4850,7 +4920,7 @@ var import_lexical9 = require("lexical");
|
|
|
4850
4920
|
var import_react50 = require("react");
|
|
4851
4921
|
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
4852
4922
|
function VariablesComposerInput({
|
|
4853
|
-
css:
|
|
4923
|
+
css: css39,
|
|
4854
4924
|
placeholder,
|
|
4855
4925
|
...contentEditableProps
|
|
4856
4926
|
}) {
|
|
@@ -4971,7 +5041,8 @@ function InputVariables(props) {
|
|
|
4971
5041
|
editorRef,
|
|
4972
5042
|
filterVariable,
|
|
4973
5043
|
styleVariant = "default",
|
|
4974
|
-
renderMenuInPortal
|
|
5044
|
+
renderMenuInPortal,
|
|
5045
|
+
disableDismissEditorOnChange
|
|
4975
5046
|
} = props;
|
|
4976
5047
|
const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
4977
5048
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -4981,7 +5052,7 @@ function InputVariables(props) {
|
|
|
4981
5052
|
"div",
|
|
4982
5053
|
{
|
|
4983
5054
|
onKeyDown: () => {
|
|
4984
|
-
if (isEditing && canDispatch) {
|
|
5055
|
+
if (!disableDismissEditorOnChange && isEditing && canDispatch) {
|
|
4985
5056
|
dispatch({ type: "cancelEdit" });
|
|
4986
5057
|
}
|
|
4987
5058
|
},
|
|
@@ -5313,19 +5384,17 @@ function ParameterVariables(props) {
|
|
|
5313
5384
|
children: [
|
|
5314
5385
|
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
5315
5386
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
|
|
5316
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
}
|
|
5326
|
-
|
|
5327
|
-
children: [
|
|
5328
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5387
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system24.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5388
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5389
|
+
"div",
|
|
5390
|
+
{
|
|
5391
|
+
css: { flex: 1 },
|
|
5392
|
+
onKeyDown: () => {
|
|
5393
|
+
if (isEditing && canDispatch) {
|
|
5394
|
+
dispatch({ type: "cancelEdit" });
|
|
5395
|
+
}
|
|
5396
|
+
},
|
|
5397
|
+
children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5329
5398
|
VariablesComposerInput,
|
|
5330
5399
|
{
|
|
5331
5400
|
"aria-label": ariaLabel,
|
|
@@ -5337,20 +5406,20 @@ function ParameterVariables(props) {
|
|
|
5337
5406
|
inputCss != null ? inputCss : import_react56.css``
|
|
5338
5407
|
]
|
|
5339
5408
|
}
|
|
5340
|
-
) }),
|
|
5341
|
-
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5342
|
-
VariablesComposerVariableMenu,
|
|
5343
|
-
{
|
|
5344
|
-
...sharedMenuProps,
|
|
5345
|
-
buttonCss: [variableBindButton],
|
|
5346
|
-
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5347
|
-
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5348
|
-
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5349
|
-
}
|
|
5350
5409
|
)
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5410
|
+
}
|
|
5411
|
+
),
|
|
5412
|
+
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5413
|
+
VariablesComposerVariableMenu,
|
|
5414
|
+
{
|
|
5415
|
+
...sharedMenuProps,
|
|
5416
|
+
buttonCss: [variableBindButton],
|
|
5417
|
+
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5418
|
+
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5419
|
+
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5420
|
+
}
|
|
5421
|
+
)
|
|
5422
|
+
] })
|
|
5354
5423
|
]
|
|
5355
5424
|
}
|
|
5356
5425
|
);
|
|
@@ -5358,7 +5427,7 @@ function ParameterVariables(props) {
|
|
|
5358
5427
|
|
|
5359
5428
|
// src/components/Variables/util/convertConnectedDataToVariable.ts
|
|
5360
5429
|
function convertConnectedDataToVariable(bindExpression, value) {
|
|
5361
|
-
const isValuePrimitive = typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
5430
|
+
const isValuePrimitive = typeof value === "string" && value.length > 0 || typeof value === "number" || typeof value === "boolean";
|
|
5362
5431
|
return {
|
|
5363
5432
|
ephemeral: true,
|
|
5364
5433
|
displayName: isValuePrimitive ? value.toString() : prettifyBindExpression(bindExpression),
|
|
@@ -7362,89 +7431,1631 @@ var JsonMeshVariableEditor = ({
|
|
|
7362
7431
|
return null;
|
|
7363
7432
|
};
|
|
7364
7433
|
|
|
7365
|
-
// src/components/SearchAndFilter/
|
|
7366
|
-
var
|
|
7434
|
+
// src/components/SearchAndFilter/constants.ts
|
|
7435
|
+
var NUMBER_OPERATORS = [
|
|
7436
|
+
{
|
|
7437
|
+
label: "equals...",
|
|
7438
|
+
symbol: "=",
|
|
7439
|
+
value: "eq",
|
|
7440
|
+
editorType: "number"
|
|
7441
|
+
},
|
|
7442
|
+
{
|
|
7443
|
+
label: "does not equal...",
|
|
7444
|
+
symbol: "\u2260",
|
|
7445
|
+
value: "neq",
|
|
7446
|
+
editorType: "number"
|
|
7447
|
+
},
|
|
7448
|
+
{
|
|
7449
|
+
label: "greater than...",
|
|
7450
|
+
symbol: ">",
|
|
7451
|
+
value: "gt",
|
|
7452
|
+
editorType: "number"
|
|
7453
|
+
},
|
|
7454
|
+
{
|
|
7455
|
+
label: "greater than or equal to...",
|
|
7456
|
+
symbol: "\u2265",
|
|
7457
|
+
value: "gte",
|
|
7458
|
+
editorType: "number"
|
|
7459
|
+
},
|
|
7460
|
+
{
|
|
7461
|
+
label: "less than...",
|
|
7462
|
+
symbol: "<",
|
|
7463
|
+
value: "lt",
|
|
7464
|
+
editorType: "number"
|
|
7465
|
+
},
|
|
7466
|
+
{
|
|
7467
|
+
label: "less than or equal to...",
|
|
7468
|
+
symbol: "\u2264",
|
|
7469
|
+
value: "lte",
|
|
7470
|
+
editorType: "number"
|
|
7471
|
+
},
|
|
7472
|
+
{
|
|
7473
|
+
label: "is empty",
|
|
7474
|
+
value: "ndef",
|
|
7475
|
+
editorType: "empty"
|
|
7476
|
+
},
|
|
7477
|
+
{
|
|
7478
|
+
label: "is between...",
|
|
7479
|
+
value: "between",
|
|
7480
|
+
editorType: "numberRange"
|
|
7481
|
+
},
|
|
7482
|
+
{
|
|
7483
|
+
label: "is not empty",
|
|
7484
|
+
value: "def",
|
|
7485
|
+
editorType: "empty"
|
|
7486
|
+
}
|
|
7487
|
+
];
|
|
7488
|
+
var DATE_OPERATORS = [
|
|
7489
|
+
{
|
|
7490
|
+
label: "is...",
|
|
7491
|
+
value: "eq",
|
|
7492
|
+
editorType: "date"
|
|
7493
|
+
},
|
|
7494
|
+
{
|
|
7495
|
+
label: "is between...",
|
|
7496
|
+
value: "between",
|
|
7497
|
+
editorType: "dateRange"
|
|
7498
|
+
},
|
|
7499
|
+
{
|
|
7500
|
+
label: "is before...",
|
|
7501
|
+
value: "lt",
|
|
7502
|
+
editorType: "date"
|
|
7503
|
+
},
|
|
7504
|
+
{
|
|
7505
|
+
label: "is after...",
|
|
7506
|
+
value: "gt",
|
|
7507
|
+
editorType: "date"
|
|
7508
|
+
},
|
|
7509
|
+
{
|
|
7510
|
+
label: "is on or before...",
|
|
7511
|
+
value: "lte",
|
|
7512
|
+
editorType: "date"
|
|
7513
|
+
},
|
|
7514
|
+
{
|
|
7515
|
+
label: "is on or after...",
|
|
7516
|
+
value: "gte",
|
|
7517
|
+
editorType: "date"
|
|
7518
|
+
},
|
|
7519
|
+
{
|
|
7520
|
+
label: "is empty",
|
|
7521
|
+
value: "ndef",
|
|
7522
|
+
editorType: "empty"
|
|
7523
|
+
},
|
|
7524
|
+
{
|
|
7525
|
+
label: "is not...",
|
|
7526
|
+
value: "neq",
|
|
7527
|
+
editorType: "date"
|
|
7528
|
+
},
|
|
7529
|
+
{
|
|
7530
|
+
label: "is not empty",
|
|
7531
|
+
value: "def",
|
|
7532
|
+
editorType: "empty"
|
|
7533
|
+
}
|
|
7534
|
+
];
|
|
7535
|
+
var TEXTBOX_OPERATORS = [
|
|
7536
|
+
{
|
|
7537
|
+
label: "is...",
|
|
7538
|
+
value: "eq",
|
|
7539
|
+
editorType: "text"
|
|
7540
|
+
},
|
|
7541
|
+
{
|
|
7542
|
+
label: "is empty",
|
|
7543
|
+
value: "ndef",
|
|
7544
|
+
editorType: "empty"
|
|
7545
|
+
},
|
|
7546
|
+
{
|
|
7547
|
+
label: "contains...",
|
|
7548
|
+
value: "match",
|
|
7549
|
+
editorType: "text"
|
|
7550
|
+
},
|
|
7551
|
+
{
|
|
7552
|
+
label: "starts with...",
|
|
7553
|
+
value: "starts",
|
|
7554
|
+
editorType: "text"
|
|
7555
|
+
},
|
|
7556
|
+
{
|
|
7557
|
+
label: "is not...",
|
|
7558
|
+
value: "neq",
|
|
7559
|
+
editorType: "text"
|
|
7560
|
+
},
|
|
7561
|
+
{
|
|
7562
|
+
label: "is not empty",
|
|
7563
|
+
value: "def",
|
|
7564
|
+
editorType: "empty"
|
|
7565
|
+
}
|
|
7566
|
+
];
|
|
7567
|
+
var USER_OPERATORS = [
|
|
7568
|
+
{
|
|
7569
|
+
label: "is...",
|
|
7570
|
+
value: "eq",
|
|
7571
|
+
editorType: "text"
|
|
7572
|
+
},
|
|
7573
|
+
{
|
|
7574
|
+
label: "contains...",
|
|
7575
|
+
value: "match",
|
|
7576
|
+
editorType: "text"
|
|
7577
|
+
},
|
|
7578
|
+
{
|
|
7579
|
+
label: "starts with...",
|
|
7580
|
+
value: "starts",
|
|
7581
|
+
editorType: "text"
|
|
7582
|
+
},
|
|
7583
|
+
{
|
|
7584
|
+
label: "is not...",
|
|
7585
|
+
value: "neq",
|
|
7586
|
+
editorType: "text"
|
|
7587
|
+
}
|
|
7588
|
+
];
|
|
7589
|
+
var SYSTEM_DATE_OPERATORS = [
|
|
7590
|
+
{
|
|
7591
|
+
label: "is...",
|
|
7592
|
+
value: "sys-date-eq",
|
|
7593
|
+
editorType: "date"
|
|
7594
|
+
},
|
|
7595
|
+
{
|
|
7596
|
+
label: "is between...",
|
|
7597
|
+
value: "sys-date-between",
|
|
7598
|
+
editorType: "dateRange"
|
|
7599
|
+
},
|
|
7600
|
+
{
|
|
7601
|
+
label: "is before...",
|
|
7602
|
+
value: "sys-date-lt",
|
|
7603
|
+
editorType: "date"
|
|
7604
|
+
},
|
|
7605
|
+
{
|
|
7606
|
+
label: "is after...",
|
|
7607
|
+
value: "sys-date-gt",
|
|
7608
|
+
editorType: "date"
|
|
7609
|
+
},
|
|
7610
|
+
{
|
|
7611
|
+
label: "is on or before...",
|
|
7612
|
+
value: "sys-date-lte",
|
|
7613
|
+
editorType: "date"
|
|
7614
|
+
},
|
|
7615
|
+
{
|
|
7616
|
+
label: "is on or after...",
|
|
7617
|
+
value: "sys-date-gte",
|
|
7618
|
+
editorType: "date"
|
|
7619
|
+
},
|
|
7620
|
+
{
|
|
7621
|
+
label: "is not...",
|
|
7622
|
+
value: "sys-date-neq",
|
|
7623
|
+
editorType: "date"
|
|
7624
|
+
}
|
|
7625
|
+
];
|
|
7626
|
+
var RICHTEXT_OPERATORS = [
|
|
7627
|
+
{
|
|
7628
|
+
label: "is empty",
|
|
7629
|
+
value: "ndef",
|
|
7630
|
+
editorType: "empty"
|
|
7631
|
+
},
|
|
7632
|
+
{
|
|
7633
|
+
label: "contains...",
|
|
7634
|
+
value: "match",
|
|
7635
|
+
editorType: "text"
|
|
7636
|
+
},
|
|
7637
|
+
{
|
|
7638
|
+
label: "starts with...",
|
|
7639
|
+
value: "starts",
|
|
7640
|
+
editorType: "text"
|
|
7641
|
+
},
|
|
7642
|
+
{
|
|
7643
|
+
label: "is not empty",
|
|
7644
|
+
value: "def",
|
|
7645
|
+
editorType: "empty"
|
|
7646
|
+
}
|
|
7647
|
+
];
|
|
7648
|
+
var CHECKBOX_OPERATORS = [
|
|
7649
|
+
{
|
|
7650
|
+
label: "is checked...",
|
|
7651
|
+
value: "def",
|
|
7652
|
+
editorType: "empty"
|
|
7653
|
+
},
|
|
7654
|
+
{
|
|
7655
|
+
label: "is not checked...",
|
|
7656
|
+
value: "ndef",
|
|
7657
|
+
editorType: "empty"
|
|
7658
|
+
}
|
|
7659
|
+
];
|
|
7660
|
+
var SYSTEM_FIELD_OPERATORS = [
|
|
7661
|
+
{
|
|
7662
|
+
label: "is...",
|
|
7663
|
+
value: "eq",
|
|
7664
|
+
editorType: "singleChoice"
|
|
7665
|
+
},
|
|
7666
|
+
{
|
|
7667
|
+
label: "is any of...",
|
|
7668
|
+
value: "in",
|
|
7669
|
+
editorType: "multiChoice"
|
|
7670
|
+
},
|
|
7671
|
+
{
|
|
7672
|
+
label: "is not...",
|
|
7673
|
+
value: "neq",
|
|
7674
|
+
editorType: "singleChoice"
|
|
7675
|
+
},
|
|
7676
|
+
{
|
|
7677
|
+
label: "is none of...",
|
|
7678
|
+
value: "nin",
|
|
7679
|
+
editorType: "multiChoice"
|
|
7680
|
+
}
|
|
7681
|
+
];
|
|
7682
|
+
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
7683
|
+
{
|
|
7684
|
+
label: "is...",
|
|
7685
|
+
value: "eq",
|
|
7686
|
+
editorType: "statusSingleChoice"
|
|
7687
|
+
},
|
|
7688
|
+
{
|
|
7689
|
+
label: "is any of...",
|
|
7690
|
+
value: "in",
|
|
7691
|
+
editorType: "statusMultiChoice"
|
|
7692
|
+
},
|
|
7693
|
+
{
|
|
7694
|
+
label: "is not...",
|
|
7695
|
+
value: "neq",
|
|
7696
|
+
editorType: "statusSingleChoice"
|
|
7697
|
+
},
|
|
7698
|
+
{
|
|
7699
|
+
label: "is none of...",
|
|
7700
|
+
value: "nin",
|
|
7701
|
+
editorType: "statusMultiChoice"
|
|
7702
|
+
}
|
|
7703
|
+
];
|
|
7704
|
+
|
|
7705
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7367
7706
|
var import_design_system42 = require("@uniformdev/design-system");
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7707
|
+
|
|
7708
|
+
// src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
|
|
7709
|
+
var import_react76 = require("@emotion/react");
|
|
7710
|
+
var import_design_system41 = require("@uniformdev/design-system");
|
|
7711
|
+
var SearchAndFilterControlsWrapper = (gridColumns) => import_react76.css`
|
|
7712
|
+
align-items: stretch;
|
|
7713
|
+
display: grid;
|
|
7714
|
+
grid-template-columns: ${gridColumns};
|
|
7715
|
+
gap: var(--spacing-sm);
|
|
7716
|
+
`;
|
|
7717
|
+
var SearchAndFilterOutterControlWrapper = (gridColumns) => import_react76.css`
|
|
7718
|
+
align-items: stretch;
|
|
7719
|
+
display: grid;
|
|
7720
|
+
grid-template-columns: ${gridColumns};
|
|
7721
|
+
gap: var(--spacing-sm);
|
|
7722
|
+
`;
|
|
7723
|
+
var ConditionalFilterRow = import_react76.css`
|
|
7724
|
+
display: grid;
|
|
7725
|
+
grid-template-columns: 35px 1fr;
|
|
7726
|
+
gap: var(--spacing-sm);
|
|
7727
|
+
margin-left: var(--spacing-base);
|
|
7728
|
+
|
|
7729
|
+
${(0, import_design_system41.cq)("380px")} {
|
|
7730
|
+
align-items: center;
|
|
7731
|
+
|
|
7732
|
+
&:after {
|
|
7733
|
+
content: '';
|
|
7734
|
+
display: block;
|
|
7735
|
+
height: 1px;
|
|
7736
|
+
background: var(--gray-300);
|
|
7737
|
+
width: calc(100% - var(--spacing-base));
|
|
7738
|
+
margin-left: var(--spacing-base);
|
|
7373
7739
|
}
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
{
|
|
7377
|
-
disableInlineMenu: true,
|
|
7378
|
-
showMenuPosition: "inline-right",
|
|
7379
|
-
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
7380
|
-
value: props.value,
|
|
7381
|
-
disabled: props.disabled,
|
|
7382
|
-
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(WrappedComponent, { ...props })
|
|
7383
|
-
}
|
|
7384
|
-
);
|
|
7385
|
-
};
|
|
7386
|
-
return WithInputVariables;
|
|
7387
|
-
}
|
|
7388
|
-
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
7389
|
-
const WithInputVariables = (props) => {
|
|
7390
|
-
var _a;
|
|
7391
|
-
if (!props.bindable || props.disabled || props.readOnly) {
|
|
7392
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(WrappedComponent, { ...props });
|
|
7740
|
+
&:last-of-type:after {
|
|
7741
|
+
display: none;
|
|
7393
7742
|
}
|
|
7394
|
-
|
|
7395
|
-
InputVariables,
|
|
7396
|
-
{
|
|
7397
|
-
disableInlineMenu: true,
|
|
7398
|
-
showMenuPosition: "inline-right",
|
|
7399
|
-
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
7400
|
-
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
7401
|
-
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(WrappedComponent, { ...props })
|
|
7402
|
-
}
|
|
7403
|
-
);
|
|
7404
|
-
};
|
|
7405
|
-
return WithInputVariables;
|
|
7406
|
-
}
|
|
7407
|
-
var bindableFiltersMapper = {
|
|
7408
|
-
...import_design_system41.filterMapper,
|
|
7409
|
-
multiChoice: withInputVariablesForMultiValue(import_design_system41.FilterMultiChoiceEditor),
|
|
7410
|
-
singleChoice: withInputVariables(import_design_system42.FilterSingleChoiceEditor),
|
|
7411
|
-
date: withInputVariables(import_design_system42.DateEditor),
|
|
7412
|
-
text: withInputVariables(import_design_system42.TextEditor),
|
|
7413
|
-
number: withInputVariables(import_design_system42.NumberEditor)
|
|
7414
|
-
};
|
|
7743
|
+
}
|
|
7415
7744
|
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
return { newValue, options: validate(newValue, options) };
|
|
7421
|
-
});
|
|
7422
|
-
}
|
|
7745
|
+
&:nth-of-type(2) {
|
|
7746
|
+
margin-left: 0;
|
|
7747
|
+
grid-template-columns: 50px 1fr;
|
|
7748
|
+
}
|
|
7423
7749
|
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
function useContentDataResourceLocaleInfo({
|
|
7428
|
-
locale,
|
|
7429
|
-
setLocale,
|
|
7430
|
-
dynamicInputs
|
|
7431
|
-
}) {
|
|
7432
|
-
var _a;
|
|
7433
|
-
const setLocaleRef = (0, import_react76.useRef)(setLocale);
|
|
7434
|
-
setLocaleRef.current = setLocale;
|
|
7435
|
-
const { flatVariables } = useVariables();
|
|
7436
|
-
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
7437
|
-
const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7438
|
-
(0, import_react76.useEffect)(() => {
|
|
7439
|
-
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7440
|
-
setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
|
|
7750
|
+
${(0, import_design_system41.cq)("580px")} {
|
|
7751
|
+
&:after {
|
|
7752
|
+
display: none;
|
|
7441
7753
|
}
|
|
7442
|
-
}
|
|
7443
|
-
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
7444
|
-
}
|
|
7754
|
+
}
|
|
7445
7755
|
|
|
7446
|
-
|
|
7447
|
-
|
|
7756
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
7757
|
+
animation: ${import_design_system41.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
7758
|
+
}
|
|
7759
|
+
`;
|
|
7760
|
+
var ConditionalInputRow = import_react76.css`
|
|
7761
|
+
display: flex;
|
|
7762
|
+
gap: var(--spacing-sm);
|
|
7763
|
+
flex-wrap: wrap;
|
|
7764
|
+
|
|
7765
|
+
${(0, import_design_system41.cq)("380px")} {
|
|
7766
|
+
& > div:nth-child(-n + 2) {
|
|
7767
|
+
width: calc(50% - var(--spacing-sm));
|
|
7768
|
+
}
|
|
7769
|
+
|
|
7770
|
+
& > div:nth-child(n + 3) {
|
|
7771
|
+
width: calc(100% - 48px);
|
|
7772
|
+
}
|
|
7773
|
+
}
|
|
7774
|
+
${(0, import_design_system41.cq)("764px")} {
|
|
7775
|
+
display: grid;
|
|
7776
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
7777
|
+
|
|
7778
|
+
& > div:nth-child(n) {
|
|
7779
|
+
width: auto;
|
|
7780
|
+
}
|
|
7781
|
+
}
|
|
7782
|
+
`;
|
|
7783
|
+
var SearchInput = import_react76.css`
|
|
7784
|
+
max-height: 40px;
|
|
7785
|
+
min-height: unset;
|
|
7786
|
+
`;
|
|
7787
|
+
var FilterButton = import_react76.css`
|
|
7788
|
+
align-items: center;
|
|
7789
|
+
background: var(--white);
|
|
7790
|
+
border: 1px solid var(--gray-300);
|
|
7791
|
+
border-radius: var(--rounded-full);
|
|
7792
|
+
color: var(--typography-base);
|
|
7793
|
+
display: flex;
|
|
7794
|
+
font-size: var(--fs-sm);
|
|
7795
|
+
gap: var(--spacing-sm);
|
|
7796
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
7797
|
+
max-height: 40px;
|
|
7798
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
7799
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
7800
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
7801
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
7802
|
+
|
|
7803
|
+
svg {
|
|
7804
|
+
color: var(--gray-300);
|
|
7805
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7806
|
+
}
|
|
7807
|
+
|
|
7808
|
+
&:hover,
|
|
7809
|
+
:where([aria-expanded='true']) {
|
|
7810
|
+
outline: none;
|
|
7811
|
+
background: var(--gray-200);
|
|
7812
|
+
border-color: var(--gray-300);
|
|
7813
|
+
|
|
7814
|
+
svg {
|
|
7815
|
+
color: var(--typography-base);
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7818
|
+
|
|
7819
|
+
&:disabled {
|
|
7820
|
+
opacity: var(--opacity-50);
|
|
7821
|
+
}
|
|
7822
|
+
`;
|
|
7823
|
+
var FilterButtonText = import_react76.css`
|
|
7824
|
+
overflow: hidden;
|
|
7825
|
+
text-overflow: ellipsis;
|
|
7826
|
+
white-space: nowrap;
|
|
7827
|
+
max-width: 14ch;
|
|
7828
|
+
`;
|
|
7829
|
+
var FilterButtonSelected = import_react76.css`
|
|
7830
|
+
background: var(--gray-100);
|
|
7831
|
+
border-color: var(--gray-300);
|
|
7832
|
+
|
|
7833
|
+
svg {
|
|
7834
|
+
color: var(--accent-dark);
|
|
7835
|
+
}
|
|
7836
|
+
`;
|
|
7837
|
+
var FilterButtonWithOptions = import_react76.css`
|
|
7838
|
+
:where([aria-expanded='true']) {
|
|
7839
|
+
background: var(--purple-rain-100);
|
|
7840
|
+
border-color: var(--accent-light);
|
|
7841
|
+
color: var(--typography-base);
|
|
7842
|
+
box-shadow: var(--elevation-100);
|
|
7843
|
+
|
|
7844
|
+
svg {
|
|
7845
|
+
color: var(--accent-dark);
|
|
7846
|
+
}
|
|
7847
|
+
}
|
|
7848
|
+
`;
|
|
7849
|
+
var SearchIcon = import_react76.css`
|
|
7850
|
+
color: var(--icon-color);
|
|
7851
|
+
position: absolute;
|
|
7852
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
7853
|
+
margin: auto;
|
|
7854
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7855
|
+
`;
|
|
7856
|
+
var AddConditionalBtn = import_react76.css`
|
|
7857
|
+
align-items: center;
|
|
7858
|
+
background: transparent;
|
|
7859
|
+
border: none;
|
|
7860
|
+
color: var(--primary-action-default);
|
|
7861
|
+
display: flex;
|
|
7862
|
+
gap: var(--spacing-sm);
|
|
7863
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7864
|
+
padding: 0;
|
|
7865
|
+
|
|
7866
|
+
&:hover,
|
|
7867
|
+
&:focus {
|
|
7868
|
+
color: var(--primary-action-hover);
|
|
7869
|
+
}
|
|
7870
|
+
|
|
7871
|
+
&:disabled {
|
|
7872
|
+
color: var(--gray-400);
|
|
7873
|
+
}
|
|
7874
|
+
`;
|
|
7875
|
+
var Title = import_react76.css`
|
|
7876
|
+
color: var(--typography-light);
|
|
7877
|
+
|
|
7878
|
+
&:focus {
|
|
7879
|
+
outline: none;
|
|
7880
|
+
}
|
|
7881
|
+
`;
|
|
7882
|
+
var ResetConditionsBtn = import_react76.css`
|
|
7883
|
+
background: transparent;
|
|
7884
|
+
border: none;
|
|
7885
|
+
color: var(--action-destructive-default);
|
|
7886
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7887
|
+
padding: 0;
|
|
7888
|
+
|
|
7889
|
+
&:hover,
|
|
7890
|
+
&:focus {
|
|
7891
|
+
color: var(--action-destructive-hover);
|
|
7892
|
+
}
|
|
7893
|
+
`;
|
|
7894
|
+
var IconBtn = import_react76.css`
|
|
7895
|
+
background: transparent;
|
|
7896
|
+
border: none;
|
|
7897
|
+
padding: var(--spacing-sm);
|
|
7898
|
+
`;
|
|
7899
|
+
var SearchAndFilterOptionsContainer = import_react76.css`
|
|
7900
|
+
background: var(--gray-50);
|
|
7901
|
+
border: 1px solid var(--gray-300);
|
|
7902
|
+
border-radius: var(--rounded-base);
|
|
7903
|
+
container-type: inline-size;
|
|
7904
|
+
display: flex;
|
|
7905
|
+
flex-direction: column;
|
|
7906
|
+
gap: var(--spacing-sm);
|
|
7907
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
7908
|
+
will-change: height;
|
|
7909
|
+
position: relative;
|
|
7910
|
+
z-index: 1;
|
|
7911
|
+
`;
|
|
7912
|
+
var SearchAndFilterOptionsInnerContainer = import_react76.css`
|
|
7913
|
+
display: flex;
|
|
7914
|
+
flex-direction: column;
|
|
7915
|
+
gap: var(--spacing-sm);
|
|
7916
|
+
padding-inline: var(--spacing-md);
|
|
7917
|
+
`;
|
|
7918
|
+
var SearchAndFilterButtonGroup = import_react76.css`
|
|
7919
|
+
margin-top: var(--spacing-xs);
|
|
7920
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
7921
|
+
`;
|
|
7922
|
+
|
|
7923
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7924
|
+
var import_jsx_runtime69 = require("@emotion/react/jsx-runtime");
|
|
7925
|
+
var FilterButton2 = ({
|
|
7926
|
+
text = "Filters",
|
|
7927
|
+
icon = "filter-add",
|
|
7928
|
+
filterCount,
|
|
7929
|
+
hasSelectedValue,
|
|
7930
|
+
dataTestId,
|
|
7931
|
+
...props
|
|
7932
|
+
}) => {
|
|
7933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
7934
|
+
"button",
|
|
7935
|
+
{
|
|
7936
|
+
type: "button",
|
|
7937
|
+
css: [
|
|
7938
|
+
FilterButton,
|
|
7939
|
+
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
7940
|
+
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
7941
|
+
],
|
|
7942
|
+
...props,
|
|
7943
|
+
"data-testid": dataTestId,
|
|
7944
|
+
children: [
|
|
7945
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_design_system42.Icon, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
7946
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { css: FilterButtonText, children: text }),
|
|
7947
|
+
filterCount ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_design_system42.Counter, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
7948
|
+
]
|
|
7949
|
+
}
|
|
7950
|
+
);
|
|
7951
|
+
};
|
|
7952
|
+
|
|
7953
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
7954
|
+
var import_design_system45 = require("@uniformdev/design-system");
|
|
7955
|
+
var import_react79 = require("react");
|
|
7956
|
+
var import_react_use6 = require("react-use");
|
|
7957
|
+
|
|
7958
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
7959
|
+
var import_design_system44 = require("@uniformdev/design-system");
|
|
7960
|
+
var import_react78 = require("react");
|
|
7961
|
+
|
|
7962
|
+
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
7963
|
+
var import_design_system43 = require("@uniformdev/design-system");
|
|
7964
|
+
var import_react77 = require("react");
|
|
7965
|
+
var import_react_use5 = require("react-use");
|
|
7966
|
+
var import_jsx_runtime70 = require("@emotion/react/jsx-runtime");
|
|
7967
|
+
var readOnlyAttributes = {
|
|
7968
|
+
isSearchable: false,
|
|
7969
|
+
menuIsOpen: false,
|
|
7970
|
+
isClearable: false
|
|
7971
|
+
};
|
|
7972
|
+
var FilterMultiChoiceEditor = ({
|
|
7973
|
+
value,
|
|
7974
|
+
options,
|
|
7975
|
+
disabled,
|
|
7976
|
+
readOnly,
|
|
7977
|
+
valueTestId,
|
|
7978
|
+
...props
|
|
7979
|
+
}) => {
|
|
7980
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
7981
|
+
const isClearable = !readOnly || !disabled;
|
|
7982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7983
|
+
import_design_system43.InputComboBox,
|
|
7984
|
+
{
|
|
7985
|
+
...props,
|
|
7986
|
+
placeholder: "Type to search...",
|
|
7987
|
+
options,
|
|
7988
|
+
isMulti: true,
|
|
7989
|
+
isClearable,
|
|
7990
|
+
isDisabled: disabled,
|
|
7991
|
+
onChange: (e) => {
|
|
7992
|
+
var _a;
|
|
7993
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
7994
|
+
},
|
|
7995
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
7996
|
+
"aria-readonly": readOnly,
|
|
7997
|
+
styles: {
|
|
7998
|
+
menu(base) {
|
|
7999
|
+
return {
|
|
8000
|
+
...base,
|
|
8001
|
+
minWidth: "max-content"
|
|
8002
|
+
};
|
|
8003
|
+
}
|
|
8004
|
+
},
|
|
8005
|
+
...readOnlyProps
|
|
8006
|
+
}
|
|
8007
|
+
) });
|
|
8008
|
+
};
|
|
8009
|
+
var FilterSingleChoiceEditor = ({
|
|
8010
|
+
options,
|
|
8011
|
+
value,
|
|
8012
|
+
disabled,
|
|
8013
|
+
readOnly,
|
|
8014
|
+
onChange,
|
|
8015
|
+
valueTestId
|
|
8016
|
+
}) => {
|
|
8017
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8019
|
+
import_design_system43.InputComboBox,
|
|
8020
|
+
{
|
|
8021
|
+
placeholder: "Type to search...",
|
|
8022
|
+
options,
|
|
8023
|
+
isClearable: true,
|
|
8024
|
+
onChange: (e) => {
|
|
8025
|
+
var _a;
|
|
8026
|
+
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
8027
|
+
},
|
|
8028
|
+
isDisabled: disabled,
|
|
8029
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
8030
|
+
"aria-readonly": readOnly,
|
|
8031
|
+
styles: {
|
|
8032
|
+
menu(base) {
|
|
8033
|
+
return {
|
|
8034
|
+
...base,
|
|
8035
|
+
minWidth: "max-content"
|
|
8036
|
+
};
|
|
8037
|
+
}
|
|
8038
|
+
},
|
|
8039
|
+
...readOnlyProps
|
|
8040
|
+
}
|
|
8041
|
+
) });
|
|
8042
|
+
};
|
|
8043
|
+
var CustomOptions = ({ label, value }) => {
|
|
8044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_design_system43.StatusBullet, { status: label, message: value });
|
|
8045
|
+
};
|
|
8046
|
+
var StatusMultiEditor = ({
|
|
8047
|
+
options,
|
|
8048
|
+
value,
|
|
8049
|
+
disabled,
|
|
8050
|
+
readOnly,
|
|
8051
|
+
onChange,
|
|
8052
|
+
valueTestId
|
|
8053
|
+
}) => {
|
|
8054
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8056
|
+
import_design_system43.InputComboBox,
|
|
8057
|
+
{
|
|
8058
|
+
options,
|
|
8059
|
+
isMulti: true,
|
|
8060
|
+
onChange: (e) => {
|
|
8061
|
+
var _a;
|
|
8062
|
+
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
8063
|
+
},
|
|
8064
|
+
formatOptionLabel: CustomOptions,
|
|
8065
|
+
"aria-readonly": readOnly,
|
|
8066
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
8067
|
+
isDisabled: disabled,
|
|
8068
|
+
styles: {
|
|
8069
|
+
menu(base) {
|
|
8070
|
+
return {
|
|
8071
|
+
...base,
|
|
8072
|
+
minWidth: "max-content"
|
|
8073
|
+
};
|
|
8074
|
+
}
|
|
8075
|
+
},
|
|
8076
|
+
...readOnlyProps
|
|
8077
|
+
}
|
|
8078
|
+
) });
|
|
8079
|
+
};
|
|
8080
|
+
var StatusSingleEditor = ({
|
|
8081
|
+
options,
|
|
8082
|
+
value,
|
|
8083
|
+
disabled,
|
|
8084
|
+
readOnly,
|
|
8085
|
+
onChange,
|
|
8086
|
+
valueTestId
|
|
8087
|
+
}) => {
|
|
8088
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8090
|
+
import_design_system43.InputComboBox,
|
|
8091
|
+
{
|
|
8092
|
+
options,
|
|
8093
|
+
onChange: (e) => {
|
|
8094
|
+
var _a;
|
|
8095
|
+
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
8096
|
+
},
|
|
8097
|
+
formatOptionLabel: CustomOptions,
|
|
8098
|
+
"aria-readonly": readOnly,
|
|
8099
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
8100
|
+
isDisabled: disabled,
|
|
8101
|
+
styles: {
|
|
8102
|
+
menu(base) {
|
|
8103
|
+
return {
|
|
8104
|
+
...base,
|
|
8105
|
+
minWidth: "max-content"
|
|
8106
|
+
};
|
|
8107
|
+
}
|
|
8108
|
+
},
|
|
8109
|
+
...readOnlyProps
|
|
8110
|
+
}
|
|
8111
|
+
) });
|
|
8112
|
+
};
|
|
8113
|
+
var TextEditor = ({
|
|
8114
|
+
onChange,
|
|
8115
|
+
ariaLabel,
|
|
8116
|
+
value,
|
|
8117
|
+
readOnly,
|
|
8118
|
+
valueTestId
|
|
8119
|
+
}) => {
|
|
8120
|
+
const [innerValue, setInnerValue] = (0, import_react77.useState)(value != null ? value : "");
|
|
8121
|
+
(0, import_react_use5.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8123
|
+
import_design_system43.Input,
|
|
8124
|
+
{
|
|
8125
|
+
showLabel: false,
|
|
8126
|
+
label: ariaLabel,
|
|
8127
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8128
|
+
placeholder: "Enter phrase to search\u2026",
|
|
8129
|
+
value: innerValue,
|
|
8130
|
+
readOnly,
|
|
8131
|
+
"data-testid": valueTestId
|
|
8132
|
+
}
|
|
8133
|
+
);
|
|
8134
|
+
};
|
|
8135
|
+
var NumberRangeEditor = ({
|
|
8136
|
+
onChange,
|
|
8137
|
+
disabled,
|
|
8138
|
+
ariaLabel,
|
|
8139
|
+
value,
|
|
8140
|
+
readOnly,
|
|
8141
|
+
valueTestId
|
|
8142
|
+
}) => {
|
|
8143
|
+
const [minValue, setMinValue] = (0, import_react77.useState)("");
|
|
8144
|
+
const [maxValue, setMaxValue] = (0, import_react77.useState)("");
|
|
8145
|
+
const [error, setError] = (0, import_react77.useState)("");
|
|
8146
|
+
(0, import_react_use5.useDebounce)(
|
|
8147
|
+
() => {
|
|
8148
|
+
if (minValue && maxValue && !error) {
|
|
8149
|
+
onChange([minValue, maxValue]);
|
|
8150
|
+
} else {
|
|
8151
|
+
onChange([]);
|
|
8152
|
+
}
|
|
8153
|
+
},
|
|
8154
|
+
500,
|
|
8155
|
+
[minValue, maxValue]
|
|
8156
|
+
);
|
|
8157
|
+
(0, import_react77.useEffect)(() => {
|
|
8158
|
+
if (!maxValue && !minValue) {
|
|
8159
|
+
return;
|
|
8160
|
+
}
|
|
8161
|
+
const max = Number(maxValue);
|
|
8162
|
+
const min = Number(minValue);
|
|
8163
|
+
if (max < min || min > max) {
|
|
8164
|
+
setError("Please enter a valid numeric range");
|
|
8165
|
+
return;
|
|
8166
|
+
}
|
|
8167
|
+
if (maxValue && !minValue || minValue && !maxValue) {
|
|
8168
|
+
setError("Please enter both a low and high number");
|
|
8169
|
+
return;
|
|
8170
|
+
}
|
|
8171
|
+
if (error) {
|
|
8172
|
+
setError("");
|
|
8173
|
+
}
|
|
8174
|
+
if (min && max) {
|
|
8175
|
+
setMinValue(minValue);
|
|
8176
|
+
setMaxValue(maxValue);
|
|
8177
|
+
}
|
|
8178
|
+
}, [maxValue, minValue, setError]);
|
|
8179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
8180
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8181
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8182
|
+
import_design_system43.Input,
|
|
8183
|
+
{
|
|
8184
|
+
label: `${ariaLabel}-min`,
|
|
8185
|
+
type: "number",
|
|
8186
|
+
showLabel: false,
|
|
8187
|
+
min: 0,
|
|
8188
|
+
placeholder: "Low",
|
|
8189
|
+
onChange: (e) => setMinValue(e.currentTarget.value),
|
|
8190
|
+
"aria-invalid": !error ? false : true,
|
|
8191
|
+
disabled,
|
|
8192
|
+
value: value ? value[0] : "",
|
|
8193
|
+
readOnly,
|
|
8194
|
+
"data-testid": "value-low"
|
|
8195
|
+
}
|
|
8196
|
+
),
|
|
8197
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8198
|
+
import_design_system43.Input,
|
|
8199
|
+
{
|
|
8200
|
+
type: "number",
|
|
8201
|
+
label: `${ariaLabel}-max`,
|
|
8202
|
+
showLabel: false,
|
|
8203
|
+
min: 0,
|
|
8204
|
+
placeholder: "High",
|
|
8205
|
+
onChange: (e) => setMaxValue(e.currentTarget.value),
|
|
8206
|
+
"aria-invalid": !error ? false : true,
|
|
8207
|
+
disabled,
|
|
8208
|
+
value: value ? value[1] : "",
|
|
8209
|
+
readOnly,
|
|
8210
|
+
"data-testid": "value-high"
|
|
8211
|
+
}
|
|
8212
|
+
)
|
|
8213
|
+
] }),
|
|
8214
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorContainer, { errorMessage: error })
|
|
8215
|
+
] });
|
|
8216
|
+
};
|
|
8217
|
+
var NumberEditor = ({
|
|
8218
|
+
ariaLabel,
|
|
8219
|
+
onChange,
|
|
8220
|
+
disabled,
|
|
8221
|
+
value,
|
|
8222
|
+
readOnly,
|
|
8223
|
+
valueTestId
|
|
8224
|
+
}) => {
|
|
8225
|
+
const [innerValue, setInnerValue] = (0, import_react77.useState)(value != null ? value : "");
|
|
8226
|
+
(0, import_react_use5.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8228
|
+
import_design_system43.Input,
|
|
8229
|
+
{
|
|
8230
|
+
label: ariaLabel,
|
|
8231
|
+
type: "number",
|
|
8232
|
+
showLabel: false,
|
|
8233
|
+
min: 0,
|
|
8234
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8235
|
+
disabled,
|
|
8236
|
+
value: innerValue,
|
|
8237
|
+
readOnly,
|
|
8238
|
+
"data-testid": valueTestId
|
|
8239
|
+
}
|
|
8240
|
+
);
|
|
8241
|
+
};
|
|
8242
|
+
var DateEditor = ({
|
|
8243
|
+
onChange,
|
|
8244
|
+
ariaLabel,
|
|
8245
|
+
disabled,
|
|
8246
|
+
value,
|
|
8247
|
+
readOnly,
|
|
8248
|
+
valueTestId
|
|
8249
|
+
}) => {
|
|
8250
|
+
const [innerValue, setInnerValue] = (0, import_react77.useState)(value != null ? value : "");
|
|
8251
|
+
(0, import_react_use5.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8253
|
+
import_design_system43.Input,
|
|
8254
|
+
{
|
|
8255
|
+
type: "date",
|
|
8256
|
+
label: ariaLabel,
|
|
8257
|
+
showLabel: false,
|
|
8258
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8259
|
+
disabled,
|
|
8260
|
+
value: innerValue,
|
|
8261
|
+
readOnly,
|
|
8262
|
+
"data-testid": valueTestId
|
|
8263
|
+
}
|
|
8264
|
+
);
|
|
8265
|
+
};
|
|
8266
|
+
var DateRangeEditor = ({
|
|
8267
|
+
ariaLabel,
|
|
8268
|
+
onChange,
|
|
8269
|
+
disabled,
|
|
8270
|
+
value,
|
|
8271
|
+
readOnly,
|
|
8272
|
+
valueTestId
|
|
8273
|
+
}) => {
|
|
8274
|
+
const [minDateValue, setMinDateValue] = (0, import_react77.useState)(value ? value[0] : "");
|
|
8275
|
+
const [maxDateValue, setMaxDateValue] = (0, import_react77.useState)(value ? value[1] : "");
|
|
8276
|
+
const [error, setError] = (0, import_react77.useState)("");
|
|
8277
|
+
(0, import_react_use5.useDebounce)(
|
|
8278
|
+
() => {
|
|
8279
|
+
if (minDateValue && maxDateValue && !error) {
|
|
8280
|
+
onChange([minDateValue, maxDateValue]);
|
|
8281
|
+
} else {
|
|
8282
|
+
onChange([]);
|
|
8283
|
+
}
|
|
8284
|
+
},
|
|
8285
|
+
500,
|
|
8286
|
+
[minDateValue, maxDateValue]
|
|
8287
|
+
);
|
|
8288
|
+
(0, import_react77.useEffect)(() => {
|
|
8289
|
+
if (!minDateValue || !maxDateValue) {
|
|
8290
|
+
return;
|
|
8291
|
+
}
|
|
8292
|
+
const minDate = new Date(minDateValue);
|
|
8293
|
+
const maxDate = new Date(maxDateValue);
|
|
8294
|
+
if (maxDate < minDate) {
|
|
8295
|
+
setError("The max date cannot be lower than the min date");
|
|
8296
|
+
return;
|
|
8297
|
+
}
|
|
8298
|
+
if (maxDate && !minDate) {
|
|
8299
|
+
setError("Please enter both a low and high date");
|
|
8300
|
+
return;
|
|
8301
|
+
}
|
|
8302
|
+
const minDateString = minDate.toDateString();
|
|
8303
|
+
const maxDateString = maxDate.toDateString();
|
|
8304
|
+
if (minDateString === maxDateString || maxDateString === minDateString) {
|
|
8305
|
+
setError("The min and max date cannot be the same");
|
|
8306
|
+
return;
|
|
8307
|
+
}
|
|
8308
|
+
if (minDate > maxDate) {
|
|
8309
|
+
setError("The min date cannot be higher than the max date");
|
|
8310
|
+
return;
|
|
8311
|
+
}
|
|
8312
|
+
if (error) {
|
|
8313
|
+
setError("");
|
|
8314
|
+
}
|
|
8315
|
+
if (minDate && maxDate) {
|
|
8316
|
+
setMinDateValue(minDateValue);
|
|
8317
|
+
setMaxDateValue(maxDateValue);
|
|
8318
|
+
} else {
|
|
8319
|
+
setMinDateValue("");
|
|
8320
|
+
setMaxDateValue("");
|
|
8321
|
+
}
|
|
8322
|
+
}, [minDateValue, maxDateValue, setError]);
|
|
8323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
8324
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8325
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8326
|
+
import_design_system43.Input,
|
|
8327
|
+
{
|
|
8328
|
+
label: `${ariaLabel}-min-date`,
|
|
8329
|
+
type: "date",
|
|
8330
|
+
showLabel: false,
|
|
8331
|
+
value: minDateValue,
|
|
8332
|
+
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
8333
|
+
"aria-invalid": !error ? false : true,
|
|
8334
|
+
disabled,
|
|
8335
|
+
readOnly
|
|
8336
|
+
}
|
|
8337
|
+
),
|
|
8338
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8339
|
+
import_design_system43.Input,
|
|
8340
|
+
{
|
|
8341
|
+
label: `${ariaLabel}-max-date`,
|
|
8342
|
+
type: "date",
|
|
8343
|
+
showLabel: false,
|
|
8344
|
+
value: maxDateValue,
|
|
8345
|
+
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
8346
|
+
"aria-invalid": !error ? false : true,
|
|
8347
|
+
disabled,
|
|
8348
|
+
readOnly
|
|
8349
|
+
}
|
|
8350
|
+
)
|
|
8351
|
+
] }),
|
|
8352
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorContainer, { errorMessage: error })
|
|
8353
|
+
] });
|
|
8354
|
+
};
|
|
8355
|
+
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
8356
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
8357
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
8358
|
+
if (!Editor) {
|
|
8359
|
+
return null;
|
|
8360
|
+
}
|
|
8361
|
+
if (editorType === "empty") {
|
|
8362
|
+
return null;
|
|
8363
|
+
}
|
|
8364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Editor, { ...props });
|
|
8365
|
+
};
|
|
8366
|
+
var filterMapper = {
|
|
8367
|
+
multiChoice: FilterMultiChoiceEditor,
|
|
8368
|
+
singleChoice: FilterSingleChoiceEditor,
|
|
8369
|
+
date: DateEditor,
|
|
8370
|
+
dateRange: DateRangeEditor,
|
|
8371
|
+
text: TextEditor,
|
|
8372
|
+
numberRange: NumberRangeEditor,
|
|
8373
|
+
number: NumberEditor,
|
|
8374
|
+
statusMultiChoice: StatusMultiEditor,
|
|
8375
|
+
statusSingleChoice: StatusSingleEditor,
|
|
8376
|
+
empty: null
|
|
8377
|
+
};
|
|
8378
|
+
var ErrorContainer = ({ errorMessage }) => {
|
|
8379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
8380
|
+
"div",
|
|
8381
|
+
{
|
|
8382
|
+
css: {
|
|
8383
|
+
gridColumn: "span 6",
|
|
8384
|
+
order: 6
|
|
8385
|
+
},
|
|
8386
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_design_system43.FieldMessage, { errorMessage })
|
|
8387
|
+
}
|
|
8388
|
+
);
|
|
8389
|
+
};
|
|
8390
|
+
var twoColumnGrid = {
|
|
8391
|
+
display: "grid",
|
|
8392
|
+
gridTemplateColumns: "1fr 1fr",
|
|
8393
|
+
gap: "var(--spacing-sm);"
|
|
8394
|
+
};
|
|
8395
|
+
|
|
8396
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8397
|
+
var import_jsx_runtime71 = require("@emotion/react/jsx-runtime");
|
|
8398
|
+
var SearchAndFilterContext = (0, import_react78.createContext)({
|
|
8399
|
+
searchTerm: "",
|
|
8400
|
+
setSearchTerm: () => {
|
|
8401
|
+
},
|
|
8402
|
+
filterVisibility: void 0,
|
|
8403
|
+
setFilterVisibility: () => {
|
|
8404
|
+
},
|
|
8405
|
+
filters: [],
|
|
8406
|
+
setFilters: () => {
|
|
8407
|
+
},
|
|
8408
|
+
handleAddFilter: () => {
|
|
8409
|
+
},
|
|
8410
|
+
handleResetFilters: () => {
|
|
8411
|
+
},
|
|
8412
|
+
handleDeleteFilter: () => {
|
|
8413
|
+
},
|
|
8414
|
+
filterOptions: [],
|
|
8415
|
+
validFilterQuery: [],
|
|
8416
|
+
filterMapper: {},
|
|
8417
|
+
totalResults: 0
|
|
8418
|
+
});
|
|
8419
|
+
var SearchAndFilterProvider = ({
|
|
8420
|
+
filters,
|
|
8421
|
+
filterOptions,
|
|
8422
|
+
filterVisible = false,
|
|
8423
|
+
defaultSearchTerm = "",
|
|
8424
|
+
onSearchChange,
|
|
8425
|
+
onChange,
|
|
8426
|
+
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
8427
|
+
totalResults,
|
|
8428
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
8429
|
+
children
|
|
8430
|
+
}) => {
|
|
8431
|
+
const [searchTerm, setSearchTerm] = (0, import_react78.useState)(defaultSearchTerm);
|
|
8432
|
+
const deferredSearchTerm = (0, import_react78.useDeferredValue)(searchTerm);
|
|
8433
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react78.useState)(filterVisible);
|
|
8434
|
+
const handleSearchTerm = (0, import_react78.useCallback)(
|
|
8435
|
+
(term) => {
|
|
8436
|
+
setSearchTerm(term);
|
|
8437
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
8438
|
+
},
|
|
8439
|
+
[setSearchTerm, onSearchChange]
|
|
8440
|
+
);
|
|
8441
|
+
const handleToggleFilterVisibility = (0, import_react78.useCallback)(
|
|
8442
|
+
(visible) => setFilterVisibility(visible),
|
|
8443
|
+
[setFilterVisibility]
|
|
8444
|
+
);
|
|
8445
|
+
const handleAddFilter = (0, import_react78.useCallback)(() => {
|
|
8446
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
8447
|
+
}, [filters, onChange]);
|
|
8448
|
+
const handleResetFilters = (0, import_react78.useCallback)(() => {
|
|
8449
|
+
onChange(resetFilterValues);
|
|
8450
|
+
}, [onChange, resetFilterValues]);
|
|
8451
|
+
const handleDeleteFilter = (0, import_react78.useCallback)(
|
|
8452
|
+
(index) => {
|
|
8453
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
8454
|
+
onChange(remainingFilters);
|
|
8455
|
+
},
|
|
8456
|
+
[filters, onChange]
|
|
8457
|
+
);
|
|
8458
|
+
const validFilterQuery = (0, import_react78.useMemo)(() => {
|
|
8459
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
8460
|
+
if (hasValidFilters) {
|
|
8461
|
+
return filters;
|
|
8462
|
+
}
|
|
8463
|
+
}, [filters]);
|
|
8464
|
+
(0, import_react78.useEffect)(() => {
|
|
8465
|
+
if (filterVisibility) {
|
|
8466
|
+
const handleEscKeyFilterClose = (e) => {
|
|
8467
|
+
if (e.key === "Escape") {
|
|
8468
|
+
setFilterVisibility(false);
|
|
8469
|
+
}
|
|
8470
|
+
};
|
|
8471
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8472
|
+
return () => {
|
|
8473
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8474
|
+
};
|
|
8475
|
+
}
|
|
8476
|
+
}, [filterVisibility]);
|
|
8477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
8478
|
+
SearchAndFilterContext.Provider,
|
|
8479
|
+
{
|
|
8480
|
+
value: {
|
|
8481
|
+
searchTerm: deferredSearchTerm,
|
|
8482
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
8483
|
+
filterVisibility,
|
|
8484
|
+
setFilterVisibility: (e) => handleToggleFilterVisibility(e),
|
|
8485
|
+
filters,
|
|
8486
|
+
setFilters: (e) => onChange(e),
|
|
8487
|
+
handleAddFilter,
|
|
8488
|
+
handleResetFilters,
|
|
8489
|
+
handleDeleteFilter,
|
|
8490
|
+
filterOptions,
|
|
8491
|
+
validFilterQuery,
|
|
8492
|
+
totalResults,
|
|
8493
|
+
filterMapper: filterMapper2
|
|
8494
|
+
},
|
|
8495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system44.VerticalRhythm, { children })
|
|
8496
|
+
}
|
|
8497
|
+
);
|
|
8498
|
+
};
|
|
8499
|
+
var useSearchAndFilter = () => {
|
|
8500
|
+
const value = (0, import_react78.useContext)(SearchAndFilterContext);
|
|
8501
|
+
return { ...value };
|
|
8502
|
+
};
|
|
8503
|
+
|
|
8504
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8505
|
+
var import_jsx_runtime72 = require("@emotion/react/jsx-runtime");
|
|
8506
|
+
var FilterControls = ({
|
|
8507
|
+
children,
|
|
8508
|
+
hideSearchInput
|
|
8509
|
+
}) => {
|
|
8510
|
+
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
8511
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react79.useState)("");
|
|
8512
|
+
(0, import_react_use6.useDebounce)(
|
|
8513
|
+
() => {
|
|
8514
|
+
setSearchTerm(localeSearchTerm);
|
|
8515
|
+
},
|
|
8516
|
+
300,
|
|
8517
|
+
[localeSearchTerm, searchTerm]
|
|
8518
|
+
);
|
|
8519
|
+
(0, import_react79.useEffect)(() => {
|
|
8520
|
+
if (searchTerm === "") {
|
|
8521
|
+
setLocaleSearchTerm("");
|
|
8522
|
+
}
|
|
8523
|
+
}, [searchTerm]);
|
|
8524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
8525
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8526
|
+
FilterButton2,
|
|
8527
|
+
{
|
|
8528
|
+
"aria-controls": "search-and-filter-options",
|
|
8529
|
+
"aria-label": "filter options",
|
|
8530
|
+
"aria-haspopup": "true",
|
|
8531
|
+
text: "Filter/Sort",
|
|
8532
|
+
"aria-expanded": filterVisibility === true,
|
|
8533
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
8534
|
+
onClick: () => setFilterVisibility(!filterVisibility),
|
|
8535
|
+
dataTestId: "filters-button"
|
|
8536
|
+
}
|
|
8537
|
+
),
|
|
8538
|
+
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8539
|
+
import_design_system45.InputKeywordSearch,
|
|
8540
|
+
{
|
|
8541
|
+
placeholder: "Search...",
|
|
8542
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
8543
|
+
value: localeSearchTerm,
|
|
8544
|
+
compact: true,
|
|
8545
|
+
rounded: true,
|
|
8546
|
+
css: SearchInput
|
|
8547
|
+
}
|
|
8548
|
+
),
|
|
8549
|
+
children
|
|
8550
|
+
] });
|
|
8551
|
+
};
|
|
8552
|
+
|
|
8553
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8554
|
+
var import_design_system47 = require("@uniformdev/design-system");
|
|
8555
|
+
var import_react81 = require("react");
|
|
8556
|
+
|
|
8557
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8558
|
+
var import_design_system46 = require("@uniformdev/design-system");
|
|
8559
|
+
var import_react80 = __toESM(require("react"));
|
|
8560
|
+
var import_jsx_runtime73 = require("@emotion/react/jsx-runtime");
|
|
8561
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
8562
|
+
buttonRow,
|
|
8563
|
+
additionalFiltersContainer,
|
|
8564
|
+
children
|
|
8565
|
+
}) => {
|
|
8566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8567
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8568
|
+
buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
8569
|
+
import_design_system46.HorizontalRhythm,
|
|
8570
|
+
{
|
|
8571
|
+
css: SearchAndFilterButtonGroup,
|
|
8572
|
+
gap: "sm",
|
|
8573
|
+
align: "center",
|
|
8574
|
+
justify: "space-between",
|
|
8575
|
+
children: buttonRow
|
|
8576
|
+
}
|
|
8577
|
+
) : null,
|
|
8578
|
+
additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { children: additionalFiltersContainer }) : null
|
|
8579
|
+
] });
|
|
8580
|
+
};
|
|
8581
|
+
var FilterMenu = ({
|
|
8582
|
+
id,
|
|
8583
|
+
filterTitle = "Show results",
|
|
8584
|
+
menuControls,
|
|
8585
|
+
additionalFiltersContainer,
|
|
8586
|
+
children,
|
|
8587
|
+
dataTestId,
|
|
8588
|
+
resetButtonText = "reset"
|
|
8589
|
+
}) => {
|
|
8590
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8591
|
+
const innerMenuRef = import_react80.default.useRef(null);
|
|
8592
|
+
(0, import_react80.useEffect)(() => {
|
|
8593
|
+
var _a;
|
|
8594
|
+
if (filterVisibility) {
|
|
8595
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
8596
|
+
}
|
|
8597
|
+
}, [filterVisibility]);
|
|
8598
|
+
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)(
|
|
8599
|
+
SearchAndFilterOptionsContainer2,
|
|
8600
|
+
{
|
|
8601
|
+
buttonRow: menuControls,
|
|
8602
|
+
additionalFiltersContainer,
|
|
8603
|
+
children: [
|
|
8604
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_design_system46.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
8605
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
8606
|
+
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
8607
|
+
"button",
|
|
8608
|
+
{
|
|
8609
|
+
type: "button",
|
|
8610
|
+
css: ResetConditionsBtn,
|
|
8611
|
+
onClick: () => {
|
|
8612
|
+
handleResetFilters();
|
|
8613
|
+
setFilterVisibility(false);
|
|
8614
|
+
},
|
|
8615
|
+
"data-testid": "reset-filters",
|
|
8616
|
+
children: resetButtonText
|
|
8617
|
+
}
|
|
8618
|
+
) : null
|
|
8619
|
+
] }),
|
|
8620
|
+
children
|
|
8621
|
+
]
|
|
8622
|
+
}
|
|
8623
|
+
) : null });
|
|
8624
|
+
};
|
|
8625
|
+
|
|
8626
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8627
|
+
var import_jsx_runtime74 = require("@emotion/react/jsx-runtime");
|
|
8628
|
+
var FilterItem = ({
|
|
8629
|
+
index,
|
|
8630
|
+
paramOptions,
|
|
8631
|
+
operatorOptions,
|
|
8632
|
+
valueOptions,
|
|
8633
|
+
onParamChange,
|
|
8634
|
+
onOperatorChange,
|
|
8635
|
+
onValueChange
|
|
8636
|
+
}) => {
|
|
8637
|
+
var _a, _b;
|
|
8638
|
+
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
8639
|
+
const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
|
|
8640
|
+
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
8641
|
+
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
8642
|
+
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
8643
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react81.useMemo)(() => {
|
|
8644
|
+
var _a2;
|
|
8645
|
+
const currentSelectedFilter = filterOptions.find((item) => {
|
|
8646
|
+
var _a3;
|
|
8647
|
+
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
8648
|
+
});
|
|
8649
|
+
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
8650
|
+
return filters[index].field === item.value;
|
|
8651
|
+
});
|
|
8652
|
+
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
8653
|
+
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
8654
|
+
return filters[index].operator === item.value;
|
|
8655
|
+
});
|
|
8656
|
+
return {
|
|
8657
|
+
selectedFieldValue: selectedFieldValue2,
|
|
8658
|
+
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
8659
|
+
selectedMetaValue: filters[index].value,
|
|
8660
|
+
readOnly: isCurrentFieldReadOnly,
|
|
8661
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
8662
|
+
};
|
|
8663
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
8664
|
+
const readOnlyProps = readOnly ? {
|
|
8665
|
+
"aria-readonly": true,
|
|
8666
|
+
isSearchable: false,
|
|
8667
|
+
menuIsOpen: false,
|
|
8668
|
+
isClearable: false
|
|
8669
|
+
} : {};
|
|
8670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
8671
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: index === 0 ? "Where" : "and" }),
|
|
8672
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { css: ConditionalInputRow, children: [
|
|
8673
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8674
|
+
import_design_system47.InputComboBox,
|
|
8675
|
+
{
|
|
8676
|
+
"aria-label": label,
|
|
8677
|
+
options: paramOptions,
|
|
8678
|
+
onChange: (e) => {
|
|
8679
|
+
var _a2;
|
|
8680
|
+
onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8681
|
+
},
|
|
8682
|
+
isOptionDisabled: (option) => {
|
|
8683
|
+
var _a2;
|
|
8684
|
+
return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
|
|
8685
|
+
},
|
|
8686
|
+
styles: {
|
|
8687
|
+
menu(base) {
|
|
8688
|
+
return {
|
|
8689
|
+
...base,
|
|
8690
|
+
minWidth: "max-content"
|
|
8691
|
+
};
|
|
8692
|
+
}
|
|
8693
|
+
},
|
|
8694
|
+
value: selectedFieldValue,
|
|
8695
|
+
...readOnlyProps,
|
|
8696
|
+
id: "filter-field",
|
|
8697
|
+
name: `filter-field-${index}`
|
|
8698
|
+
}
|
|
8699
|
+
),
|
|
8700
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8701
|
+
import_design_system47.InputComboBox,
|
|
8702
|
+
{
|
|
8703
|
+
"aria-label": operatorLabel,
|
|
8704
|
+
options: operatorOptions,
|
|
8705
|
+
onChange: (e) => {
|
|
8706
|
+
var _a2;
|
|
8707
|
+
return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8708
|
+
},
|
|
8709
|
+
isDisabled: !filters[index].field,
|
|
8710
|
+
value: selectedOperatorValue,
|
|
8711
|
+
styles: {
|
|
8712
|
+
menu(base) {
|
|
8713
|
+
return {
|
|
8714
|
+
...base,
|
|
8715
|
+
minWidth: "max-content"
|
|
8716
|
+
};
|
|
8717
|
+
}
|
|
8718
|
+
},
|
|
8719
|
+
...readOnlyProps,
|
|
8720
|
+
id: "filter-operator",
|
|
8721
|
+
name: `filter-operator-${index}`
|
|
8722
|
+
}
|
|
8723
|
+
),
|
|
8724
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8725
|
+
FilterEditorRenderer,
|
|
8726
|
+
{
|
|
8727
|
+
"aria-label": metaDataLabel,
|
|
8728
|
+
editorType: metaDataPossibleOptions,
|
|
8729
|
+
options: valueOptions,
|
|
8730
|
+
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
8731
|
+
readOnly,
|
|
8732
|
+
bindable,
|
|
8733
|
+
disabled: !filters[index].operator,
|
|
8734
|
+
value: selectedMetaValue,
|
|
8735
|
+
valueTestId: "filter-value"
|
|
8736
|
+
}
|
|
8737
|
+
),
|
|
8738
|
+
readOnly || index === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8739
|
+
"button",
|
|
8740
|
+
{
|
|
8741
|
+
type: "button",
|
|
8742
|
+
onClick: () => handleDeleteFilter(index),
|
|
8743
|
+
"aria-label": "delete filter",
|
|
8744
|
+
css: IconBtn,
|
|
8745
|
+
"data-testid": "delete-filter",
|
|
8746
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_design_system47.Icon, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
8747
|
+
}
|
|
8748
|
+
)
|
|
8749
|
+
] })
|
|
8750
|
+
] });
|
|
8751
|
+
};
|
|
8752
|
+
var FilterItems = ({
|
|
8753
|
+
addButtonText = "add condition",
|
|
8754
|
+
additionalFiltersContainer
|
|
8755
|
+
}) => {
|
|
8756
|
+
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
8757
|
+
const handleUpdateFilter = (index, prop, value) => {
|
|
8758
|
+
var _a, _b, _c, _d, _e;
|
|
8759
|
+
const next = [...filters];
|
|
8760
|
+
next[index] = { ...next[index], [prop]: value };
|
|
8761
|
+
if (prop === "operator") {
|
|
8762
|
+
if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
|
|
8763
|
+
next[index].value = next[index].value[0];
|
|
8764
|
+
}
|
|
8765
|
+
if (filters[index].operator === "ndef" || filters[index].operator === "def") {
|
|
8766
|
+
next[index].value = "";
|
|
8767
|
+
}
|
|
8768
|
+
if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
8769
|
+
next[index].value = [next[index].value, ""];
|
|
8770
|
+
}
|
|
8771
|
+
if (value === "def" || value === "true") {
|
|
8772
|
+
next[index].value = "true";
|
|
8773
|
+
}
|
|
8774
|
+
if (value === "ndef" || value === "false") {
|
|
8775
|
+
next[index].value = "false";
|
|
8776
|
+
}
|
|
8777
|
+
}
|
|
8778
|
+
if (prop === "field") {
|
|
8779
|
+
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
8780
|
+
var _a2;
|
|
8781
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
|
|
8782
|
+
})) == 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";
|
|
8783
|
+
next[index].operator = firstOperatorInAvailableOperators;
|
|
8784
|
+
next[index].value = "";
|
|
8785
|
+
}
|
|
8786
|
+
setFilters(next);
|
|
8787
|
+
};
|
|
8788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8789
|
+
FilterMenu,
|
|
8790
|
+
{
|
|
8791
|
+
id: "search-and-filter-options",
|
|
8792
|
+
dataTestId: "search-and-filter-options",
|
|
8793
|
+
menuControls: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
8794
|
+
"button",
|
|
8795
|
+
{
|
|
8796
|
+
type: "button",
|
|
8797
|
+
css: AddConditionalBtn,
|
|
8798
|
+
onClick: handleAddFilter,
|
|
8799
|
+
"data-testid": "add-filter",
|
|
8800
|
+
children: [
|
|
8801
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_design_system47.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
8802
|
+
addButtonText
|
|
8803
|
+
]
|
|
8804
|
+
}
|
|
8805
|
+
),
|
|
8806
|
+
additionalFiltersContainer,
|
|
8807
|
+
children: filters.map((item, i) => {
|
|
8808
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8809
|
+
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
8810
|
+
var _a2;
|
|
8811
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
|
|
8812
|
+
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
8813
|
+
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
8814
|
+
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
8815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8816
|
+
FilterItem,
|
|
8817
|
+
{
|
|
8818
|
+
index: i,
|
|
8819
|
+
paramOptions: filterOptions,
|
|
8820
|
+
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
8821
|
+
operatorOptions: possibleOperators,
|
|
8822
|
+
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
8823
|
+
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
8824
|
+
valueOptions: possibleValueOptions
|
|
8825
|
+
},
|
|
8826
|
+
i
|
|
8827
|
+
);
|
|
8828
|
+
})
|
|
8829
|
+
}
|
|
8830
|
+
);
|
|
8831
|
+
};
|
|
8832
|
+
|
|
8833
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
8834
|
+
var import_design_system49 = require("@uniformdev/design-system");
|
|
8835
|
+
|
|
8836
|
+
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
8837
|
+
var import_design_system48 = require("@uniformdev/design-system");
|
|
8838
|
+
var import_jsx_runtime75 = require("@emotion/react/jsx-runtime");
|
|
8839
|
+
var SearchAndFilterResultContainer = ({
|
|
8840
|
+
buttonText,
|
|
8841
|
+
clearButtonLabel = "clear",
|
|
8842
|
+
calloutTitle,
|
|
8843
|
+
calloutText,
|
|
8844
|
+
onHandleClear,
|
|
8845
|
+
hideClearButton
|
|
8846
|
+
}) => {
|
|
8847
|
+
const { searchTerm, setSearchTerm, totalResults, setFilters, filters } = useSearchAndFilter();
|
|
8848
|
+
const automateCalloutTitle = () => {
|
|
8849
|
+
if (searchTerm && !filters.length) {
|
|
8850
|
+
return "No search results found";
|
|
8851
|
+
}
|
|
8852
|
+
if (filters.length && !searchTerm) {
|
|
8853
|
+
return "No results match the selected filters";
|
|
8854
|
+
}
|
|
8855
|
+
return "No matching results found";
|
|
8856
|
+
};
|
|
8857
|
+
const handleResetFilters = () => {
|
|
8858
|
+
if (searchTerm && !filters.length) {
|
|
8859
|
+
setSearchTerm("");
|
|
8860
|
+
return;
|
|
8861
|
+
} else if (!searchTerm && filters.length) {
|
|
8862
|
+
setFilters([{ field: "", operator: "", value: "" }]);
|
|
8863
|
+
return;
|
|
8864
|
+
} else {
|
|
8865
|
+
setSearchTerm("");
|
|
8866
|
+
setFilters([{ field: "", operator: "", value: "" }]);
|
|
8867
|
+
return;
|
|
8868
|
+
}
|
|
8869
|
+
};
|
|
8870
|
+
if (totalResults && totalResults > 0) {
|
|
8871
|
+
return null;
|
|
8872
|
+
}
|
|
8873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
8874
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_design_system48.HorizontalRhythm, { children: [
|
|
8875
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("span", { children: [
|
|
8876
|
+
totalResults,
|
|
8877
|
+
" results ",
|
|
8878
|
+
searchTerm ? `for "${searchTerm}"` : null
|
|
8879
|
+
] }),
|
|
8880
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_design_system48.Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
|
|
8881
|
+
] }),
|
|
8882
|
+
totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_design_system48.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
8883
|
+
calloutText ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_design_system48.Paragraph, { children: calloutText }) : null,
|
|
8884
|
+
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" })
|
|
8885
|
+
] }) : null
|
|
8886
|
+
] });
|
|
8887
|
+
};
|
|
8888
|
+
|
|
8889
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
8890
|
+
var import_jsx_runtime76 = require("@emotion/react/jsx-runtime");
|
|
8891
|
+
var SearchAndFilter = ({
|
|
8892
|
+
filters,
|
|
8893
|
+
filterOptions,
|
|
8894
|
+
filterVisible,
|
|
8895
|
+
filterControls,
|
|
8896
|
+
viewSwitchControls,
|
|
8897
|
+
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SearchAndFilterResultContainer, {}),
|
|
8898
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
8899
|
+
additionalFiltersContainer,
|
|
8900
|
+
onChange,
|
|
8901
|
+
defaultSearchTerm,
|
|
8902
|
+
onSearchChange,
|
|
8903
|
+
totalResults,
|
|
8904
|
+
resetFilterValues = []
|
|
8905
|
+
}) => {
|
|
8906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
8907
|
+
SearchAndFilterProvider,
|
|
8908
|
+
{
|
|
8909
|
+
filters,
|
|
8910
|
+
filterOptions,
|
|
8911
|
+
filterVisible,
|
|
8912
|
+
onChange,
|
|
8913
|
+
defaultSearchTerm,
|
|
8914
|
+
onSearchChange,
|
|
8915
|
+
totalResults,
|
|
8916
|
+
resetFilterValues,
|
|
8917
|
+
filterMapper: filterMapper2,
|
|
8918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_design_system49.VerticalRhythm, { "data-testid": "search-and-filter", children: [
|
|
8919
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
8920
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
8921
|
+
"div",
|
|
8922
|
+
{
|
|
8923
|
+
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
8924
|
+
children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
8925
|
+
}
|
|
8926
|
+
),
|
|
8927
|
+
viewSwitchControls
|
|
8928
|
+
] }),
|
|
8929
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FilterItems, { additionalFiltersContainer }),
|
|
8930
|
+
resultsContainerView
|
|
8931
|
+
] })
|
|
8932
|
+
}
|
|
8933
|
+
);
|
|
8934
|
+
};
|
|
8935
|
+
|
|
8936
|
+
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
8937
|
+
var import_design_system50 = require("@uniformdev/design-system");
|
|
8938
|
+
var import_react82 = require("react");
|
|
8939
|
+
var import_react_use7 = require("react-use");
|
|
8940
|
+
var import_jsx_runtime77 = require("@emotion/react/jsx-runtime");
|
|
8941
|
+
var SearchOnlyContext = (0, import_react82.createContext)({
|
|
8942
|
+
searchTerm: "",
|
|
8943
|
+
setSearchTerm: () => {
|
|
8944
|
+
}
|
|
8945
|
+
});
|
|
8946
|
+
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
8947
|
+
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
8948
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react82.useState)("");
|
|
8949
|
+
(0, import_react_use7.useDebounce)(
|
|
8950
|
+
() => {
|
|
8951
|
+
setSearchTerm(localeSearchTerm);
|
|
8952
|
+
onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
|
|
8953
|
+
},
|
|
8954
|
+
300,
|
|
8955
|
+
[localeSearchTerm]
|
|
8956
|
+
);
|
|
8957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
8958
|
+
SearchOnlyContext.Provider,
|
|
8959
|
+
{
|
|
8960
|
+
value: {
|
|
8961
|
+
searchTerm,
|
|
8962
|
+
setSearchTerm: setLocaleSearchTerm
|
|
8963
|
+
},
|
|
8964
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
8965
|
+
import_design_system50.InputKeywordSearch,
|
|
8966
|
+
{
|
|
8967
|
+
placeholder: "Search...",
|
|
8968
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
8969
|
+
value: localeSearchTerm,
|
|
8970
|
+
compact: true,
|
|
8971
|
+
rounded: true
|
|
8972
|
+
}
|
|
8973
|
+
) })
|
|
8974
|
+
}
|
|
8975
|
+
);
|
|
8976
|
+
};
|
|
8977
|
+
|
|
8978
|
+
// src/components/SearchAndFilter2/filtersMapper.tsx
|
|
8979
|
+
var import_jsx_runtime78 = require("@emotion/react/jsx-runtime");
|
|
8980
|
+
function withInputVariables(WrappedComponent) {
|
|
8981
|
+
const WithInputVariables = (props) => {
|
|
8982
|
+
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(WrappedComponent, { ...props });
|
|
8984
|
+
}
|
|
8985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
8986
|
+
InputVariables,
|
|
8987
|
+
{
|
|
8988
|
+
disableInlineMenu: true,
|
|
8989
|
+
showMenuPosition: "inline-right",
|
|
8990
|
+
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8991
|
+
value: props.value,
|
|
8992
|
+
disabled: props.disabled,
|
|
8993
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(WrappedComponent, { ...props })
|
|
8994
|
+
}
|
|
8995
|
+
);
|
|
8996
|
+
};
|
|
8997
|
+
return WithInputVariables;
|
|
8998
|
+
}
|
|
8999
|
+
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
9000
|
+
const WithInputVariables = (props) => {
|
|
9001
|
+
var _a;
|
|
9002
|
+
if (!props.bindable || props.disabled || props.readOnly) {
|
|
9003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(WrappedComponent, { ...props });
|
|
9004
|
+
}
|
|
9005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9006
|
+
InputVariables,
|
|
9007
|
+
{
|
|
9008
|
+
disableInlineMenu: true,
|
|
9009
|
+
showMenuPosition: "inline-right",
|
|
9010
|
+
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
9011
|
+
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
9012
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(WrappedComponent, { ...props })
|
|
9013
|
+
}
|
|
9014
|
+
);
|
|
9015
|
+
};
|
|
9016
|
+
return WithInputVariables;
|
|
9017
|
+
}
|
|
9018
|
+
var bindableFiltersMapper = {
|
|
9019
|
+
...filterMapper,
|
|
9020
|
+
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
9021
|
+
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
9022
|
+
date: withInputVariables(DateEditor),
|
|
9023
|
+
text: withInputVariables(TextEditor),
|
|
9024
|
+
number: withInputVariables(NumberEditor)
|
|
9025
|
+
};
|
|
9026
|
+
|
|
9027
|
+
// src/utils/createLocationValidator.ts
|
|
9028
|
+
function createLocationValidator(setValue, validate) {
|
|
9029
|
+
return (dispatch) => setValue((previous) => {
|
|
9030
|
+
const { newValue, options } = dispatch(previous);
|
|
9031
|
+
return { newValue, options: validate(newValue, options) };
|
|
9032
|
+
});
|
|
9033
|
+
}
|
|
9034
|
+
|
|
9035
|
+
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
9036
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
9037
|
+
var import_react83 = require("react");
|
|
9038
|
+
function useContentDataResourceLocaleInfo({
|
|
9039
|
+
locale,
|
|
9040
|
+
setLocale,
|
|
9041
|
+
dynamicInputs
|
|
9042
|
+
}) {
|
|
9043
|
+
var _a;
|
|
9044
|
+
const setLocaleRef = (0, import_react83.useRef)(setLocale);
|
|
9045
|
+
setLocaleRef.current = setLocale;
|
|
9046
|
+
const { flatVariables } = useVariables();
|
|
9047
|
+
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
9048
|
+
const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
9049
|
+
(0, import_react83.useEffect)(() => {
|
|
9050
|
+
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
9051
|
+
setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
|
|
9052
|
+
}
|
|
9053
|
+
}, [locale, effectiveLocale]);
|
|
9054
|
+
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
9055
|
+
}
|
|
9056
|
+
|
|
9057
|
+
// src/index.ts
|
|
9058
|
+
var import_design_system51 = require("@uniformdev/design-system");
|
|
7448
9059
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
7449
9060
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7450
9061
|
0 && (module.exports = {
|
|
@@ -7452,8 +9063,10 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7452
9063
|
$isVariableNode,
|
|
7453
9064
|
AddListButton,
|
|
7454
9065
|
Button,
|
|
9066
|
+
CHECKBOX_OPERATORS,
|
|
7455
9067
|
Callout,
|
|
7456
9068
|
ControlledValuePlugin,
|
|
9069
|
+
DATE_OPERATORS,
|
|
7457
9070
|
DISCONNECT_VARIABLE_COMMAND,
|
|
7458
9071
|
DamSelectedItem,
|
|
7459
9072
|
DataRefreshButton,
|
|
@@ -7462,11 +9075,21 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7462
9075
|
DataResourceVariablesListExplicit,
|
|
7463
9076
|
DataSourceEditor,
|
|
7464
9077
|
DataTypeEditor,
|
|
9078
|
+
DateEditor,
|
|
9079
|
+
DateRangeEditor,
|
|
7465
9080
|
DefaultSearchRow,
|
|
7466
9081
|
DefaultSelectedItem,
|
|
7467
9082
|
DrawerContent,
|
|
7468
9083
|
EDIT_VARIABLE_COMMAND,
|
|
7469
9084
|
EntrySearch,
|
|
9085
|
+
FilterButton,
|
|
9086
|
+
FilterControls,
|
|
9087
|
+
FilterEditorRenderer,
|
|
9088
|
+
FilterItem,
|
|
9089
|
+
FilterItems,
|
|
9090
|
+
FilterMenu,
|
|
9091
|
+
FilterMultiChoiceEditor,
|
|
9092
|
+
FilterSingleChoiceEditor,
|
|
7470
9093
|
Heading,
|
|
7471
9094
|
INSERT_VARIABLE_COMMAND,
|
|
7472
9095
|
Icons,
|
|
@@ -7483,6 +9106,9 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7483
9106
|
Menu,
|
|
7484
9107
|
MenuItem,
|
|
7485
9108
|
MeshApp,
|
|
9109
|
+
NUMBER_OPERATORS,
|
|
9110
|
+
NumberEditor,
|
|
9111
|
+
NumberRangeEditor,
|
|
7486
9112
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
7487
9113
|
ObjectSearchContainer,
|
|
7488
9114
|
ObjectSearchFilter,
|
|
@@ -7493,6 +9119,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7493
9119
|
ObjectSearchResultItem,
|
|
7494
9120
|
ObjectSearchResultItemButton,
|
|
7495
9121
|
ObjectSearchResultList,
|
|
9122
|
+
PUBLISH_STATUS_FIELD_OPERATORS,
|
|
7496
9123
|
ParamTypeDynamicDataProvider,
|
|
7497
9124
|
ParameterConnectionIndicator,
|
|
7498
9125
|
ParameterGroup,
|
|
@@ -7520,6 +9147,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7520
9147
|
ProductSearchRow,
|
|
7521
9148
|
ProductSelectedItem,
|
|
7522
9149
|
QueryFilter,
|
|
9150
|
+
RICHTEXT_OPERATORS,
|
|
7523
9151
|
RequestBody,
|
|
7524
9152
|
RequestHeaders,
|
|
7525
9153
|
RequestMethodSelect,
|
|
@@ -7529,13 +9157,27 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7529
9157
|
RequestUrl,
|
|
7530
9158
|
RequestUrlInput,
|
|
7531
9159
|
ResolvableLoadingValue,
|
|
9160
|
+
SYSTEM_DATE_OPERATORS,
|
|
9161
|
+
SYSTEM_FIELD_OPERATORS,
|
|
7532
9162
|
ScrollableList,
|
|
7533
9163
|
ScrollableListItem,
|
|
9164
|
+
SearchAndFilter,
|
|
9165
|
+
SearchAndFilterContext,
|
|
9166
|
+
SearchAndFilterOptionsContainer,
|
|
9167
|
+
SearchAndFilterProvider,
|
|
9168
|
+
SearchAndFilterResultContainer,
|
|
9169
|
+
SearchOnlyContext,
|
|
9170
|
+
SearchOnlyFilter,
|
|
7534
9171
|
SelectionField,
|
|
9172
|
+
StatusMultiEditor,
|
|
9173
|
+
StatusSingleEditor,
|
|
7535
9174
|
Switch,
|
|
9175
|
+
TEXTBOX_OPERATORS,
|
|
9176
|
+
TextEditor,
|
|
7536
9177
|
TextVariableRenderer,
|
|
7537
9178
|
Textarea,
|
|
7538
9179
|
Theme,
|
|
9180
|
+
USER_OPERATORS,
|
|
7539
9181
|
VariableEditor,
|
|
7540
9182
|
VariableNode,
|
|
7541
9183
|
VariablesList,
|
|
@@ -7573,6 +9215,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7573
9215
|
entrySearchSelectInput,
|
|
7574
9216
|
entrySearchSelectOption,
|
|
7575
9217
|
entrySearchWrapper,
|
|
9218
|
+
filterMapper,
|
|
7576
9219
|
hasReferencedVariables,
|
|
7577
9220
|
prettifyBindExpression,
|
|
7578
9221
|
productSearchRowActiveIcon,
|
|
@@ -7623,6 +9266,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7623
9266
|
useRequest,
|
|
7624
9267
|
useRequestHeader,
|
|
7625
9268
|
useRequestParameter,
|
|
9269
|
+
useSearchAndFilter,
|
|
7626
9270
|
useUniformMeshSdk,
|
|
7627
9271
|
useVariableEditor,
|
|
7628
9272
|
useVariables,
|