@uipath/apollo-wind 2.93.0 → 2.94.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/components/forms/field-renderer.cjs +1 -1
- package/dist/components/forms/field-renderer.js +1 -1
- package/dist/components/forms/field-rules-strings.cjs +40 -0
- package/dist/components/forms/field-rules-strings.d.ts +17 -0
- package/dist/components/forms/field-rules-strings.js +6 -0
- package/dist/components/forms/field-rules.cjs +526 -0
- package/dist/components/forms/field-rules.d.ts +97 -0
- package/dist/components/forms/field-rules.js +468 -0
- package/dist/components/forms/form-designer.cjs +208 -592
- package/dist/components/forms/form-designer.js +210 -594
- package/dist/components/forms/form-schema.d.ts +5 -0
- package/dist/components/forms/index.cjs +43 -3
- package/dist/components/forms/index.d.ts +4 -0
- package/dist/components/forms/index.js +5 -1
- package/dist/components/forms/metadata-form.cjs +1 -1
- package/dist/components/forms/metadata-form.js +1 -1
- package/dist/components/forms/rules-engine-dialect.cjs +644 -0
- package/dist/components/forms/rules-engine-dialect.d.ts +90 -0
- package/dist/components/forms/rules-engine-dialect.js +537 -0
- package/dist/components/forms/rules-engine.cjs +99 -10
- package/dist/components/forms/rules-engine.d.ts +5 -0
- package/dist/components/forms/rules-engine.js +99 -10
- package/dist/components/forms/use-field-rules.cjs +122 -0
- package/dist/components/forms/use-field-rules.d.ts +31 -0
- package/dist/components/forms/use-field-rules.js +88 -0
- package/dist/components/ui/conditions-editor/condition-row.cjs +458 -0
- package/dist/components/ui/conditions-editor/condition-row.d.ts +23 -0
- package/dist/components/ui/conditions-editor/condition-row.js +421 -0
- package/dist/components/ui/conditions-editor/conditions-editor.cjs +363 -0
- package/dist/components/ui/conditions-editor/conditions-editor.d.ts +67 -0
- package/dist/components/ui/conditions-editor/conditions-editor.js +329 -0
- package/dist/components/ui/conditions-editor/context.cjs +45 -0
- package/dist/components/ui/conditions-editor/context.d.ts +54 -0
- package/dist/components/ui/conditions-editor/context.js +8 -0
- package/dist/components/ui/conditions-editor/index.cjs +55 -0
- package/dist/components/ui/conditions-editor/index.d.ts +6 -0
- package/dist/components/ui/conditions-editor/index.js +6 -0
- package/dist/components/ui/conditions-editor/model.cjs +126 -0
- package/dist/components/ui/conditions-editor/model.d.ts +39 -0
- package/dist/components/ui/conditions-editor/model.js +71 -0
- package/dist/components/ui/conditions-editor/status.cjs +198 -0
- package/dist/components/ui/conditions-editor/status.d.ts +44 -0
- package/dist/components/ui/conditions-editor/status.js +131 -0
- package/dist/components/ui/conditions-editor/strings.cjs +86 -0
- package/dist/components/ui/conditions-editor/strings.d.ts +62 -0
- package/dist/components/ui/conditions-editor/strings.js +52 -0
- package/dist/components/ui/conditions-editor/vocabulary.cjs +163 -0
- package/dist/components/ui/conditions-editor/vocabulary.d.ts +51 -0
- package/dist/components/ui/conditions-editor/vocabulary.js +129 -0
- package/dist/components/ui/field-actions/index.cjs +9 -2
- package/dist/components/ui/field-actions/index.d.ts +1 -0
- package/dist/components/ui/field-actions/index.js +2 -1
- package/dist/components/ui/field-actions/insert-variable-action.cjs +3 -1
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
- package/dist/components/ui/field-actions/insert-variable-action.js +3 -1
- package/dist/components/ui/field-actions/rules-action.cjs +244 -0
- package/dist/components/ui/field-actions/rules-action.d.ts +42 -0
- package/dist/components/ui/field-actions/rules-action.js +207 -0
- package/dist/components/ui/index.cjs +273 -234
- package/dist/components/ui/index.d.ts +3 -0
- package/dist/components/ui/index.js +3 -0
- package/dist/components/ui/quick-form-field/components/field-header.cjs +137 -167
- package/dist/components/ui/quick-form-field/components/field-header.d.ts +1 -1
- package/dist/components/ui/quick-form-field/components/field-header.js +138 -168
- package/dist/components/ui/quick-form-field/components/header-actions.cjs +187 -0
- package/dist/components/ui/quick-form-field/components/header-actions.d.ts +59 -0
- package/dist/components/ui/quick-form-field/components/header-actions.js +138 -0
- package/dist/components/ui/quick-form-field/components/header-context.cjs +59 -0
- package/dist/components/ui/quick-form-field/components/header-context.d.ts +33 -0
- package/dist/components/ui/quick-form-field/components/header-context.js +16 -0
- package/dist/components/ui/quick-form-field/index.cjs +18 -4
- package/dist/components/ui/quick-form-field/index.d.ts +2 -0
- package/dist/components/ui/quick-form-field/index.js +3 -1
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +1 -1
- package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -6
- package/dist/components/ui/quick-form-field/quick-form-field.js +1 -1
- package/dist/components/ui/quick-form-field/types.d.ts +42 -11
- package/dist/components/ui/row-groups/add-row-button.cjs +54 -0
- package/dist/components/ui/row-groups/add-row-button.d.ts +10 -0
- package/dist/components/ui/row-groups/add-row-button.js +20 -0
- package/dist/components/ui/row-groups/after-press.cjs +73 -0
- package/dist/components/ui/row-groups/after-press.d.ts +7 -0
- package/dist/components/ui/row-groups/after-press.js +36 -0
- package/dist/components/ui/row-groups/collapsible-row-group.cjs +83 -0
- package/dist/components/ui/row-groups/collapsible-row-group.d.ts +13 -0
- package/dist/components/ui/row-groups/collapsible-row-group.js +49 -0
- package/dist/components/ui/row-groups/empty-rows.cjs +42 -0
- package/dist/components/ui/row-groups/empty-rows.d.ts +7 -0
- package/dist/components/ui/row-groups/empty-rows.js +8 -0
- package/dist/components/ui/row-groups/group-mode-toggle.cjs +80 -0
- package/dist/components/ui/row-groups/group-mode-toggle.d.ts +26 -0
- package/dist/components/ui/row-groups/group-mode-toggle.js +40 -0
- package/dist/components/ui/row-groups/index.cjs +62 -0
- package/dist/components/ui/row-groups/index.d.ts +6 -0
- package/dist/components/ui/row-groups/index.js +7 -0
- package/dist/components/ui/row-groups/row-delete-button.cjs +54 -0
- package/dist/components/ui/row-groups/row-delete-button.d.ts +18 -0
- package/dist/components/ui/row-groups/row-delete-button.js +20 -0
- package/dist/components/ui/row-groups/use-row-focus.cjs +82 -0
- package/dist/components/ui/row-groups/use-row-focus.d.ts +17 -0
- package/dist/components/ui/row-groups/use-row-focus.js +48 -0
- package/dist/components/ui/rules-editor/context.cjs +45 -0
- package/dist/components/ui/rules-editor/context.d.ts +52 -0
- package/dist/components/ui/rules-editor/context.js +8 -0
- package/dist/components/ui/rules-editor/index.cjs +56 -0
- package/dist/components/ui/rules-editor/index.d.ts +4 -0
- package/dist/components/ui/rules-editor/index.js +4 -0
- package/dist/components/ui/rules-editor/model.cjs +205 -0
- package/dist/components/ui/rules-editor/model.d.ts +128 -0
- package/dist/components/ui/rules-editor/model.js +144 -0
- package/dist/components/ui/rules-editor/rule-card.cjs +470 -0
- package/dist/components/ui/rules-editor/rule-card.d.ts +14 -0
- package/dist/components/ui/rules-editor/rule-card.js +436 -0
- package/dist/components/ui/rules-editor/rules-editor.cjs +160 -0
- package/dist/components/ui/rules-editor/rules-editor.d.ts +66 -0
- package/dist/components/ui/rules-editor/rules-editor.js +126 -0
- package/dist/components/ui/rules-editor/strings.cjs +68 -0
- package/dist/components/ui/rules-editor/strings.d.ts +56 -0
- package/dist/components/ui/rules-editor/strings.js +34 -0
- package/dist/index.cjs +129 -8
- package/dist/index.d.ts +17 -4
- package/dist/index.js +10 -3
- package/dist/styles.css +97 -24
- package/package.json +2 -2
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useId } from "react";
|
|
3
|
+
import { DatePicker } from "../date-picker.js";
|
|
4
|
+
import { FieldMenu, ValueModeIndicator, builtInValueModes } from "../field-addons/index.js";
|
|
5
|
+
import { FormField, FormFieldDescription, FormFieldError, FormFieldLabel } from "../form-field.js";
|
|
6
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "../input-group.js";
|
|
7
|
+
import { MultiSelect } from "../multi-select.js";
|
|
8
|
+
import { RowDeleteButton } from "../row-groups/index.js";
|
|
9
|
+
import { afterPress } from "../row-groups/after-press.js";
|
|
10
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select.js";
|
|
11
|
+
import { VariableValueControl } from "../variable-value-control.js";
|
|
12
|
+
import { cn } from "../../../lib/index.js";
|
|
13
|
+
import { useConditionsEditor } from "./context.js";
|
|
14
|
+
import { allowedModes, conditionError, formatDateValue, isComplete, isValueInvalid, operatorsFor, parseDateValue, resolveCondition } from "./status.js";
|
|
15
|
+
const ROW_GRID = 'grid min-w-0 flex-1 grid-cols-1 items-start gap-2 @xs:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] @lg:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)_minmax(0,1.2fr)]';
|
|
16
|
+
const LABEL_CLASS = '@lg:in-[[data-condition-row]~[data-condition-row]]:sr-only';
|
|
17
|
+
const LABEL_SPACER_CLASS = 'h-4 @lg:in-[[data-condition-row]~[data-condition-row]]:hidden';
|
|
18
|
+
const POPUPS = '[data-radix-popper-content-wrapper], [role="dialog"]';
|
|
19
|
+
function leftRow(event) {
|
|
20
|
+
const next = event.relatedTarget;
|
|
21
|
+
if (next && event.currentTarget.contains(next)) return false;
|
|
22
|
+
const popup = next?.closest(POPUPS);
|
|
23
|
+
if (popup && !popup.contains(event.currentTarget)) return false;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
function keptValues(c, field, mode) {
|
|
27
|
+
if (field?.type !== 'enum' || 'literal' !== mode) return {};
|
|
28
|
+
const known = (value)=>field.options?.some((option)=>option.value === value);
|
|
29
|
+
return {
|
|
30
|
+
value: c.value && known(c.value) ? c.value : '',
|
|
31
|
+
values: (c.values ?? []).filter(known)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function ConditionValue({ condition: c, resolved, name, labelledBy, invalid, errorId, describedBy, onChange }) {
|
|
35
|
+
const editor = useConditionsEditor();
|
|
36
|
+
const { strings, disabled } = editor;
|
|
37
|
+
const controlId = useId();
|
|
38
|
+
const { field, operator, mode } = resolved;
|
|
39
|
+
const aria = {
|
|
40
|
+
'aria-invalid': invalid || void 0,
|
|
41
|
+
'aria-describedby': describedBy,
|
|
42
|
+
'aria-errormessage': invalid ? errorId : void 0
|
|
43
|
+
};
|
|
44
|
+
const builtIns = builtInValueModes(editor.valueModeStrings, {
|
|
45
|
+
expectedType: field?.type === 'number' ? 'number' : void 0
|
|
46
|
+
});
|
|
47
|
+
const modes = editor.valueModes.map((id)=>resolved.allowedModes.includes(id) ? {
|
|
48
|
+
...builtIns[id],
|
|
49
|
+
id
|
|
50
|
+
} : {
|
|
51
|
+
...builtIns[id],
|
|
52
|
+
id,
|
|
53
|
+
disabled: true,
|
|
54
|
+
description: strings.valueModeUnavailable(operator?.label ?? '')
|
|
55
|
+
});
|
|
56
|
+
const builtInControl = ()=>{
|
|
57
|
+
if ('variable' === mode) return /*#__PURE__*/ jsx(VariableValueControl, {
|
|
58
|
+
"aria-labelledby": labelledBy,
|
|
59
|
+
"aria-describedby": describedBy,
|
|
60
|
+
value: c.value,
|
|
61
|
+
variables: editor.variables ?? [],
|
|
62
|
+
disabled: disabled,
|
|
63
|
+
strings: editor.valueModeStrings,
|
|
64
|
+
onChange: (reference)=>onChange({
|
|
65
|
+
value: reference
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
if ('literal' === mode && field?.type === 'date') return /*#__PURE__*/ jsx(DatePicker, {
|
|
69
|
+
"aria-labelledby": labelledBy,
|
|
70
|
+
...aria,
|
|
71
|
+
placeholder: strings.datePlaceholder,
|
|
72
|
+
value: parseDateValue(c.value),
|
|
73
|
+
disabled: disabled,
|
|
74
|
+
onValueChange: (date)=>onChange({
|
|
75
|
+
value: date ? formatDateValue(date) : ''
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
if ('literal' === mode && field?.type === 'enum' && operator?.multiple) return /*#__PURE__*/ jsxs(Fragment, {
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ jsx("label", {
|
|
81
|
+
htmlFor: controlId,
|
|
82
|
+
className: "sr-only",
|
|
83
|
+
children: name
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ jsx(MultiSelect, {
|
|
86
|
+
id: controlId,
|
|
87
|
+
...aria,
|
|
88
|
+
options: [
|
|
89
|
+
...field.options ?? []
|
|
90
|
+
],
|
|
91
|
+
selected: c.values ?? [],
|
|
92
|
+
overflow: "collapse",
|
|
93
|
+
placeholder: strings.optionsPlaceholder,
|
|
94
|
+
disabled: disabled,
|
|
95
|
+
strings: editor.multiSelectStrings,
|
|
96
|
+
onChange: (values)=>onChange({
|
|
97
|
+
values
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
if ('literal' === mode && field?.type === 'enum') return /*#__PURE__*/ jsxs(Select, {
|
|
103
|
+
value: c.value,
|
|
104
|
+
onValueChange: (value)=>onChange({
|
|
105
|
+
value
|
|
106
|
+
}),
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
110
|
+
"aria-labelledby": labelledBy,
|
|
111
|
+
...aria,
|
|
112
|
+
children: /*#__PURE__*/ jsx(SelectValue, {
|
|
113
|
+
placeholder: strings.optionPlaceholder
|
|
114
|
+
})
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ jsx(SelectContent, {
|
|
117
|
+
children: field.options?.map((option)=>/*#__PURE__*/ jsx(SelectItem, {
|
|
118
|
+
value: option.value,
|
|
119
|
+
children: option.label
|
|
120
|
+
}, option.value))
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
return /*#__PURE__*/ jsx(InputGroupInput, {
|
|
125
|
+
"aria-labelledby": labelledBy,
|
|
126
|
+
...aria,
|
|
127
|
+
className: cn('expression' === mode && 'font-mono'),
|
|
128
|
+
placeholder: 'expression' === mode ? strings.expressionPlaceholder || void 0 : strings.valuePlaceholder,
|
|
129
|
+
value: c.value ?? '',
|
|
130
|
+
disabled: disabled,
|
|
131
|
+
onChange: (event)=>onChange({
|
|
132
|
+
value: event.target.value
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
const hostControl = editor.renderValue?.({
|
|
137
|
+
condition: c,
|
|
138
|
+
field,
|
|
139
|
+
operator,
|
|
140
|
+
mode,
|
|
141
|
+
labelledBy,
|
|
142
|
+
invalid,
|
|
143
|
+
errorId,
|
|
144
|
+
describedBy,
|
|
145
|
+
disabled,
|
|
146
|
+
onChange
|
|
147
|
+
});
|
|
148
|
+
return /*#__PURE__*/ jsxs(InputGroup, {
|
|
149
|
+
invalid: invalid,
|
|
150
|
+
children: [
|
|
151
|
+
'expression' === mode && /*#__PURE__*/ jsx(InputGroupAddon, {
|
|
152
|
+
align: "inline-start",
|
|
153
|
+
children: /*#__PURE__*/ jsx(ValueModeIndicator, {
|
|
154
|
+
mode: "expression",
|
|
155
|
+
className: "px-0",
|
|
156
|
+
strings: editor.valueModeStrings
|
|
157
|
+
})
|
|
158
|
+
}),
|
|
159
|
+
void 0 === hostControl ? builtInControl() : hostControl,
|
|
160
|
+
modes.length > 1 && /*#__PURE__*/ jsx(InputGroupAddon, {
|
|
161
|
+
align: "inline-end",
|
|
162
|
+
children: /*#__PURE__*/ jsx(FieldMenu, {
|
|
163
|
+
mode: mode,
|
|
164
|
+
modes: modes,
|
|
165
|
+
disabled: disabled,
|
|
166
|
+
strings: editor.valueModeStrings,
|
|
167
|
+
triggerLabel: strings.valueModeMenu(name, builtIns[mode].title),
|
|
168
|
+
onSelect: (next)=>{
|
|
169
|
+
if (next !== mode) onChange({
|
|
170
|
+
valueMode: next,
|
|
171
|
+
value: '',
|
|
172
|
+
values: []
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function ConditionSeparator() {
|
|
181
|
+
return /*#__PURE__*/ jsx("div", {
|
|
182
|
+
"aria-hidden": "true",
|
|
183
|
+
"data-condition-separator": "",
|
|
184
|
+
className: "@lg:hidden",
|
|
185
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
186
|
+
className: "h-px bg-border"
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const condition_row_ConditionRow = /*#__PURE__*/ memo(function({ index, position, condition: c, onDelete }) {
|
|
191
|
+
const editor = useConditionsEditor();
|
|
192
|
+
const { strings, disabled } = editor;
|
|
193
|
+
const baseId = useId();
|
|
194
|
+
const errorId = `${baseId}-error`;
|
|
195
|
+
const rowNameId = `${baseId}-name`;
|
|
196
|
+
const labelIds = {
|
|
197
|
+
field: `${baseId}-field`,
|
|
198
|
+
operator: `${baseId}-operator`,
|
|
199
|
+
value: `${baseId}-value`
|
|
200
|
+
};
|
|
201
|
+
const labelledBy = (part)=>`${rowNameId} ${labelIds[part]}`;
|
|
202
|
+
const resolved = resolveCondition(c, editor);
|
|
203
|
+
const showError = editor.forceErrors || editor.touched.has(c.id);
|
|
204
|
+
const error = showError ? conditionError(c, editor, strings) : void 0;
|
|
205
|
+
const invalid = Boolean(error);
|
|
206
|
+
const warningId = `${baseId}-warning`;
|
|
207
|
+
const hintId = `${baseId}-hint`;
|
|
208
|
+
const warning = showError && !error && resolved.hasValue && isComplete(c, editor) ? editor.valueWarning?.(c) : void 0;
|
|
209
|
+
const hint = resolved.hasValue ? resolved.operator?.valueHint : void 0;
|
|
210
|
+
const rowName = strings.conditionName(index);
|
|
211
|
+
const onChange = (patch)=>{
|
|
212
|
+
const shown = {};
|
|
213
|
+
if (void 0 === c.operator && resolved.operator) shown.operator = resolved.operator.value;
|
|
214
|
+
if (void 0 !== c.valueMode && c.valueMode !== resolved.mode) shown.valueMode = resolved.mode;
|
|
215
|
+
editor.updateCondition(c.id, {
|
|
216
|
+
...shown,
|
|
217
|
+
...patch
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
const withOperator = (patch, field, operatorValue)=>{
|
|
221
|
+
const operators = operatorsFor(field, editor.operators);
|
|
222
|
+
const next = operators.find((option)=>option.value === operatorValue) ?? operators[0];
|
|
223
|
+
const modes = allowedModes(next, editor.valueModes);
|
|
224
|
+
const base = {
|
|
225
|
+
...patch,
|
|
226
|
+
operator: next?.value
|
|
227
|
+
};
|
|
228
|
+
if (!modes.includes(resolved.mode)) return {
|
|
229
|
+
...base,
|
|
230
|
+
valueMode: modes[0] ?? 'literal',
|
|
231
|
+
value: '',
|
|
232
|
+
values: []
|
|
233
|
+
};
|
|
234
|
+
if (Boolean(next?.multiple) !== Boolean(resolved.operator?.multiple)) return {
|
|
235
|
+
...base,
|
|
236
|
+
value: '',
|
|
237
|
+
values: []
|
|
238
|
+
};
|
|
239
|
+
return base;
|
|
240
|
+
};
|
|
241
|
+
const fieldControl = /*#__PURE__*/ jsxs(Select, {
|
|
242
|
+
value: c.field,
|
|
243
|
+
disabled: disabled,
|
|
244
|
+
onValueChange: (value)=>{
|
|
245
|
+
const field = editor.fields.find((option)=>option.value === value);
|
|
246
|
+
const sameType = (field?.type ?? 'string') === (resolved.field?.type ?? 'string');
|
|
247
|
+
if (sameType) return void onChange({
|
|
248
|
+
...withOperator({
|
|
249
|
+
field: value
|
|
250
|
+
}, field, resolved.operator?.value),
|
|
251
|
+
...keptValues(c, field, resolved.mode)
|
|
252
|
+
});
|
|
253
|
+
onChange({
|
|
254
|
+
...withOperator({
|
|
255
|
+
field: value
|
|
256
|
+
}, field, void 0),
|
|
257
|
+
value: '',
|
|
258
|
+
values: []
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
children: [
|
|
262
|
+
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
263
|
+
"data-row-first": "",
|
|
264
|
+
"aria-labelledby": labelledBy('field'),
|
|
265
|
+
"aria-invalid": invalid && !resolved.field || void 0,
|
|
266
|
+
"aria-describedby": invalid ? errorId : void 0,
|
|
267
|
+
"aria-errormessage": invalid && !resolved.field ? errorId : void 0,
|
|
268
|
+
children: /*#__PURE__*/ jsx(SelectValue, {
|
|
269
|
+
placeholder: strings.fieldPlaceholder
|
|
270
|
+
})
|
|
271
|
+
}),
|
|
272
|
+
/*#__PURE__*/ jsxs(SelectContent, {
|
|
273
|
+
children: [
|
|
274
|
+
c.field && !resolved.field && /*#__PURE__*/ jsx(SelectItem, {
|
|
275
|
+
value: c.field,
|
|
276
|
+
disabled: true,
|
|
277
|
+
children: strings.unknownField(c.field)
|
|
278
|
+
}),
|
|
279
|
+
editor.fields.map((option)=>/*#__PURE__*/ jsx(SelectItem, {
|
|
280
|
+
value: option.value,
|
|
281
|
+
children: option.label
|
|
282
|
+
}, option.value))
|
|
283
|
+
]
|
|
284
|
+
})
|
|
285
|
+
]
|
|
286
|
+
});
|
|
287
|
+
const operatorInvalid = invalid && Boolean(resolved.field) && !resolved.operator;
|
|
288
|
+
const operatorControl = /*#__PURE__*/ jsxs(Select, {
|
|
289
|
+
value: resolved.operator?.value ?? '',
|
|
290
|
+
disabled: disabled,
|
|
291
|
+
onValueChange: (operator)=>onChange(withOperator({}, resolved.field, operator)),
|
|
292
|
+
children: [
|
|
293
|
+
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
294
|
+
"aria-labelledby": labelledBy('operator'),
|
|
295
|
+
"aria-invalid": operatorInvalid || void 0,
|
|
296
|
+
"aria-describedby": invalid ? errorId : void 0,
|
|
297
|
+
"aria-errormessage": operatorInvalid ? errorId : void 0,
|
|
298
|
+
children: /*#__PURE__*/ jsx(SelectValue, {
|
|
299
|
+
placeholder: strings.operatorPlaceholder
|
|
300
|
+
})
|
|
301
|
+
}),
|
|
302
|
+
/*#__PURE__*/ jsx(SelectContent, {
|
|
303
|
+
children: resolved.operators.map((option)=>/*#__PURE__*/ jsx(SelectItem, {
|
|
304
|
+
value: option.value,
|
|
305
|
+
children: option.label
|
|
306
|
+
}, option.value))
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
});
|
|
310
|
+
const valueControl = resolved.hasValue ? /*#__PURE__*/ jsx(ConditionValue, {
|
|
311
|
+
condition: c,
|
|
312
|
+
resolved: resolved,
|
|
313
|
+
name: `${rowName} ${strings.valueLabel}`,
|
|
314
|
+
labelledBy: labelledBy('value'),
|
|
315
|
+
invalid: invalid && isValueInvalid(c, resolved),
|
|
316
|
+
errorId: invalid ? errorId : warning ? warningId : void 0,
|
|
317
|
+
describedBy: [
|
|
318
|
+
hint && hintId,
|
|
319
|
+
invalid ? errorId : warning && warningId
|
|
320
|
+
].filter(Boolean).join(' ') || void 0,
|
|
321
|
+
onChange: onChange
|
|
322
|
+
}) : null;
|
|
323
|
+
const deleteControl = /*#__PURE__*/ jsx(RowDeleteButton, {
|
|
324
|
+
label: strings.removeCondition(index),
|
|
325
|
+
onClick: ()=>onDelete(c.id, position),
|
|
326
|
+
disabled: disabled
|
|
327
|
+
});
|
|
328
|
+
const valueMessage = Boolean(valueControl && resolved.field && resolved.operator);
|
|
329
|
+
const errorMessage = error && /*#__PURE__*/ jsx(FormFieldError, {
|
|
330
|
+
id: errorId,
|
|
331
|
+
children: error
|
|
332
|
+
});
|
|
333
|
+
return /*#__PURE__*/ jsxs("fieldset", {
|
|
334
|
+
"data-row": "",
|
|
335
|
+
"data-condition-row": "",
|
|
336
|
+
"aria-label": rowName,
|
|
337
|
+
className: "m-0 flex min-w-0 flex-col border-0 p-0",
|
|
338
|
+
onBlur: (event)=>{
|
|
339
|
+
if (!editor.touched.has(c.id) && leftRow(event)) afterPress(()=>editor.markTouched(c.id));
|
|
340
|
+
},
|
|
341
|
+
children: [
|
|
342
|
+
/*#__PURE__*/ jsx("span", {
|
|
343
|
+
id: rowNameId,
|
|
344
|
+
className: "sr-only",
|
|
345
|
+
children: rowName
|
|
346
|
+
}),
|
|
347
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
348
|
+
children: [
|
|
349
|
+
/*#__PURE__*/ jsx("div", {
|
|
350
|
+
className: "@container",
|
|
351
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
352
|
+
className: "flex items-start gap-2",
|
|
353
|
+
children: [
|
|
354
|
+
/*#__PURE__*/ jsxs("div", {
|
|
355
|
+
className: ROW_GRID,
|
|
356
|
+
children: [
|
|
357
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
358
|
+
children: [
|
|
359
|
+
/*#__PURE__*/ jsx(FormFieldLabel, {
|
|
360
|
+
id: labelIds.field,
|
|
361
|
+
className: LABEL_CLASS,
|
|
362
|
+
children: strings.fieldLabel
|
|
363
|
+
}),
|
|
364
|
+
fieldControl
|
|
365
|
+
]
|
|
366
|
+
}),
|
|
367
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
368
|
+
children: [
|
|
369
|
+
/*#__PURE__*/ jsx(FormFieldLabel, {
|
|
370
|
+
id: labelIds.operator,
|
|
371
|
+
className: LABEL_CLASS,
|
|
372
|
+
children: strings.operatorLabel
|
|
373
|
+
}),
|
|
374
|
+
operatorControl
|
|
375
|
+
]
|
|
376
|
+
}),
|
|
377
|
+
valueControl && /*#__PURE__*/ jsxs(FormField, {
|
|
378
|
+
className: "@xs:col-span-2 @lg:col-span-1",
|
|
379
|
+
children: [
|
|
380
|
+
/*#__PURE__*/ jsx(FormFieldLabel, {
|
|
381
|
+
id: labelIds.value,
|
|
382
|
+
className: LABEL_CLASS,
|
|
383
|
+
children: strings.valueLabel
|
|
384
|
+
}),
|
|
385
|
+
valueControl,
|
|
386
|
+
hint && /*#__PURE__*/ jsx(FormFieldDescription, {
|
|
387
|
+
id: hintId,
|
|
388
|
+
children: hint
|
|
389
|
+
}),
|
|
390
|
+
valueMessage && errorMessage,
|
|
391
|
+
warning && /*#__PURE__*/ jsx(FormFieldError, {
|
|
392
|
+
id: warningId,
|
|
393
|
+
severity: "warning",
|
|
394
|
+
children: warning
|
|
395
|
+
})
|
|
396
|
+
]
|
|
397
|
+
})
|
|
398
|
+
]
|
|
399
|
+
}),
|
|
400
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
401
|
+
children: [
|
|
402
|
+
/*#__PURE__*/ jsx("span", {
|
|
403
|
+
"aria-hidden": "true",
|
|
404
|
+
className: LABEL_SPACER_CLASS
|
|
405
|
+
}),
|
|
406
|
+
/*#__PURE__*/ jsx("div", {
|
|
407
|
+
className: "flex h-9 items-center future:h-10",
|
|
408
|
+
children: deleteControl
|
|
409
|
+
})
|
|
410
|
+
]
|
|
411
|
+
})
|
|
412
|
+
]
|
|
413
|
+
})
|
|
414
|
+
}),
|
|
415
|
+
!valueMessage && errorMessage
|
|
416
|
+
]
|
|
417
|
+
})
|
|
418
|
+
]
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
export { condition_row_ConditionRow as ConditionRow, ConditionSeparator };
|