@hitachivantara/uikit-react-core 5.74.0 → 5.76.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/cjs/Badge/Badge.cjs +18 -13
- package/dist/cjs/Badge/Badge.styles.cjs +25 -14
- package/dist/cjs/Dropdown/Dropdown.cjs +271 -276
- package/dist/cjs/InlineEditor/InlineEditor.cjs +4 -2
- package/dist/cjs/QueryBuilder/Rule/Attribute/Attribute.cjs +1 -1
- package/dist/cjs/QueryBuilder/Rule/Operator/Operator.cjs +1 -1
- package/dist/cjs/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.cjs +1 -1
- package/dist/cjs/Table/renderers/DropdownColumnCell/DropdownColumnCell.cjs +3 -17
- package/dist/cjs/Table/renderers/renderers.cjs +2 -5
- package/dist/esm/Badge/Badge.js +18 -13
- package/dist/esm/Badge/Badge.js.map +1 -1
- package/dist/esm/Badge/Badge.styles.js +25 -14
- package/dist/esm/Badge/Badge.styles.js.map +1 -1
- package/dist/esm/Dropdown/Dropdown.js +272 -277
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +4 -2
- package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Attribute/Attribute.js +1 -1
- package/dist/esm/QueryBuilder/Rule/Attribute/Attribute.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Operator/Operator.js +1 -1
- package/dist/esm/QueryBuilder/Rule/Operator/Operator.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.js +1 -1
- package/dist/esm/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.js.map +1 -1
- package/dist/esm/Table/renderers/DropdownColumnCell/DropdownColumnCell.js +3 -17
- package/dist/esm/Table/renderers/DropdownColumnCell/DropdownColumnCell.js.map +1 -1
- package/dist/esm/Table/renderers/renderers.js +2 -5
- package/dist/esm/Table/renderers/renderers.js.map +1 -1
- package/dist/types/index.d.ts +27 -28
- package/package.json +6 -6
|
@@ -7,6 +7,7 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
7
7
|
const useControlled = require("../hooks/useControlled.cjs");
|
|
8
8
|
const useLabels = require("../hooks/useLabels.cjs");
|
|
9
9
|
const useUniqueId = require("../hooks/useUniqueId.cjs");
|
|
10
|
+
const generic = require("../types/generic.cjs");
|
|
10
11
|
const setId = require("../utils/setId.cjs");
|
|
11
12
|
const Dropdown_styles = require("./Dropdown.styles.cjs");
|
|
12
13
|
const utils = require("./utils.cjs");
|
|
@@ -32,297 +33,291 @@ const DEFAULT_LABELS = {
|
|
|
32
33
|
/** The label used in search. */
|
|
33
34
|
multiSelectionConjunction: "/"
|
|
34
35
|
};
|
|
35
|
-
const HvDropdown =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
36
|
+
const HvDropdown = generic.fixedForwardRef(function HvDropdown2(props, ref) {
|
|
37
|
+
const {
|
|
38
|
+
classes: classesProp,
|
|
39
|
+
className,
|
|
40
|
+
id,
|
|
41
|
+
name,
|
|
42
|
+
required = false,
|
|
43
|
+
disabled = false,
|
|
44
|
+
readOnly = false,
|
|
45
|
+
label,
|
|
46
|
+
"aria-label": ariaLabel,
|
|
47
|
+
"aria-labelledby": ariaLabelledBy,
|
|
48
|
+
description,
|
|
49
|
+
"aria-describedby": ariaDescribedBy,
|
|
50
|
+
placeholder = "Select...",
|
|
51
|
+
onChange,
|
|
52
|
+
status,
|
|
53
|
+
statusMessage,
|
|
54
|
+
"aria-errormessage": ariaErrorMessage,
|
|
55
|
+
onCancel,
|
|
56
|
+
onToggle,
|
|
57
|
+
onClickOutside,
|
|
58
|
+
onFocus,
|
|
59
|
+
onBlur,
|
|
60
|
+
values,
|
|
61
|
+
multiSelect = false,
|
|
62
|
+
showSearch,
|
|
63
|
+
expanded,
|
|
64
|
+
defaultExpanded,
|
|
65
|
+
notifyChangesOnFirstRender,
|
|
66
|
+
labels: labelsProp,
|
|
67
|
+
hasTooltips,
|
|
68
|
+
disablePortal,
|
|
69
|
+
singleSelectionToggle = true,
|
|
70
|
+
placement,
|
|
71
|
+
variableWidth,
|
|
72
|
+
popperProps = {},
|
|
73
|
+
height,
|
|
74
|
+
maxHeight,
|
|
75
|
+
virtualized,
|
|
76
|
+
baseDropdownProps = {},
|
|
77
|
+
listProps = {},
|
|
78
|
+
...others
|
|
79
|
+
} = uikitReactUtils.useDefaultProps("HvDropdown", props);
|
|
80
|
+
const { classes, cx } = Dropdown_styles.useClasses(classesProp);
|
|
81
|
+
const labels = useLabels.useLabels(DEFAULT_LABELS, labelsProp);
|
|
82
|
+
const elementId = useUniqueId.useUniqueId(id);
|
|
83
|
+
const [validationState, setValidationState] = useControlled.useControlled(
|
|
84
|
+
status,
|
|
85
|
+
"standBy"
|
|
86
|
+
);
|
|
87
|
+
const [validationMessage] = useControlled.useControlled(statusMessage, "Required");
|
|
88
|
+
const [isOpen, setIsOpen] = useControlled.useControlled(expanded, Boolean(defaultExpanded));
|
|
89
|
+
const [selectionLabel, setSelectionLabel] = React.useState(
|
|
90
|
+
utils.getSelectionLabel(labels, placeholder, multiSelect, values)
|
|
91
|
+
);
|
|
92
|
+
const [internalValues, setInternalValues] = React.useState(values);
|
|
93
|
+
const internalValuesRef = React.useRef(values);
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
setInternalValues(values);
|
|
96
|
+
internalValuesRef.current = values;
|
|
97
|
+
}, [values]);
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
setSelectionLabel(
|
|
93
100
|
utils.getSelectionLabel(labels, placeholder, multiSelect, values)
|
|
94
101
|
);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const headerForkedRef = utils$1.useForkRef(
|
|
113
|
-
dropdownHeaderRefProp,
|
|
114
|
-
dropdownHeaderRef
|
|
115
|
-
);
|
|
116
|
-
const dropdownForkedRef = utils$1.useForkRef(ref, refProp);
|
|
117
|
-
const handleToggle = (event, open) => {
|
|
118
|
-
onToggle?.(event, open);
|
|
119
|
-
setIsOpen(open);
|
|
120
|
-
if (!open) {
|
|
121
|
-
setValidationState(() => {
|
|
122
|
-
if (required) {
|
|
123
|
-
const hasSelection = utils.getSelected(internalValuesRef.current).length > 0;
|
|
124
|
-
if (!hasSelection) {
|
|
125
|
-
return "invalid";
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return "valid";
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const handleSelection = (listValues, commitChanges, toggle, notifyChanges = true) => {
|
|
133
|
-
const selected = utils.getSelected(listValues);
|
|
134
|
-
if (commitChanges) {
|
|
135
|
-
setInternalValues(listValues);
|
|
136
|
-
internalValuesRef.current = listValues;
|
|
137
|
-
setSelectionLabel(
|
|
138
|
-
utils.getSelectionLabel(labels, placeholder, multiSelect, listValues)
|
|
139
|
-
);
|
|
140
|
-
setValidationState(() => {
|
|
141
|
-
if (required && selected.length === 0) {
|
|
102
|
+
}, [labels, multiSelect, placeholder, values]);
|
|
103
|
+
const dropdownHeaderRef = React.useRef();
|
|
104
|
+
const {
|
|
105
|
+
ref: refProp,
|
|
106
|
+
dropdownHeaderRef: dropdownHeaderRefProp,
|
|
107
|
+
...otherBaseDropdownProps
|
|
108
|
+
} = baseDropdownProps;
|
|
109
|
+
const headerForkedRef = utils$1.useForkRef(dropdownHeaderRefProp, dropdownHeaderRef);
|
|
110
|
+
const dropdownForkedRef = utils$1.useForkRef(ref, refProp);
|
|
111
|
+
const handleToggle = (event, open) => {
|
|
112
|
+
onToggle?.(event, open);
|
|
113
|
+
setIsOpen(open);
|
|
114
|
+
if (!open) {
|
|
115
|
+
setValidationState(() => {
|
|
116
|
+
if (required) {
|
|
117
|
+
const hasSelection = utils.getSelected(internalValuesRef.current).length > 0;
|
|
118
|
+
if (!hasSelection) {
|
|
142
119
|
return "invalid";
|
|
143
120
|
}
|
|
144
|
-
return "valid";
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
if (notifyChanges) onChange?.(multiSelect ? selected : selected[0]);
|
|
148
|
-
if (toggle) {
|
|
149
|
-
handleToggle(void 0, false);
|
|
150
|
-
dropdownHeaderRef.current?.focus({ preventScroll: true });
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
const handleCancel = (evt) => {
|
|
154
|
-
onCancel?.(evt);
|
|
155
|
-
handleToggle(evt, false);
|
|
156
|
-
dropdownHeaderRef.current?.focus({ preventScroll: true });
|
|
157
|
-
};
|
|
158
|
-
const handleClickOutside = (evt) => {
|
|
159
|
-
onClickOutside?.(evt);
|
|
160
|
-
onCancel?.(evt);
|
|
161
|
-
};
|
|
162
|
-
const setFocusToContent = (containerRef) => {
|
|
163
|
-
const inputs = containerRef?.getElementsByTagName("input");
|
|
164
|
-
if (inputs && inputs.length > 0) {
|
|
165
|
-
inputs[0].focus();
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const listItems = containerRef != null ? [...containerRef.getElementsByTagName("li")] : [];
|
|
169
|
-
listItems.every((listItem) => {
|
|
170
|
-
if (listItem.tabIndex >= 0) {
|
|
171
|
-
listItem.focus();
|
|
172
|
-
return false;
|
|
173
121
|
}
|
|
174
|
-
return
|
|
122
|
+
return "valid";
|
|
175
123
|
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
[classes.selectionDisabled]: disabled,
|
|
186
|
-
[classes.placeholderClosed]: !(isOpen || hasSelection)
|
|
187
|
-
}),
|
|
188
|
-
children: selectionLabel.selected
|
|
189
|
-
}
|
|
190
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
191
|
-
Typography.HvTypography,
|
|
192
|
-
{
|
|
193
|
-
component: "div",
|
|
194
|
-
className: cx(classes.placeholder, {
|
|
195
|
-
[classes.selectionDisabled]: disabled
|
|
196
|
-
}),
|
|
197
|
-
variant: "body",
|
|
198
|
-
children: [
|
|
199
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { children: selectionLabel.selected }),
|
|
200
|
-
` ${labels?.multiSelectionConjunction} ${selectionLabel.total}`
|
|
201
|
-
]
|
|
202
|
-
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const handleSelection = (listValues, commitChanges, toggle, notifyChanges = true) => {
|
|
127
|
+
const selected = utils.getSelected(listValues);
|
|
128
|
+
if (commitChanges) {
|
|
129
|
+
setInternalValues(listValues);
|
|
130
|
+
internalValuesRef.current = listValues;
|
|
131
|
+
setSelectionLabel(
|
|
132
|
+
utils.getSelectionLabel(labels, placeholder, multiSelect, listValues)
|
|
203
133
|
);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
134
|
+
setValidationState(() => {
|
|
135
|
+
if (required && selected.length === 0) {
|
|
136
|
+
return "invalid";
|
|
137
|
+
}
|
|
138
|
+
return "valid";
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (notifyChanges) {
|
|
142
|
+
onChange?.(multiSelect ? selected : selected[0]);
|
|
143
|
+
}
|
|
144
|
+
if (toggle) {
|
|
145
|
+
handleToggle(void 0, false);
|
|
146
|
+
dropdownHeaderRef.current?.focus({ preventScroll: true });
|
|
212
147
|
}
|
|
213
|
-
|
|
214
|
-
|
|
148
|
+
};
|
|
149
|
+
const handleCancel = (evt) => {
|
|
150
|
+
onCancel?.(evt);
|
|
151
|
+
handleToggle(evt, false);
|
|
152
|
+
dropdownHeaderRef.current?.focus({ preventScroll: true });
|
|
153
|
+
};
|
|
154
|
+
const handleClickOutside = (evt) => {
|
|
155
|
+
onClickOutside?.(evt);
|
|
156
|
+
onCancel?.(evt);
|
|
157
|
+
};
|
|
158
|
+
const setFocusToContent = (containerRef) => {
|
|
159
|
+
const inputs = containerRef?.getElementsByTagName("input");
|
|
160
|
+
if (inputs && inputs.length > 0) {
|
|
161
|
+
inputs[0].focus();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const listItems = containerRef != null ? [...containerRef.getElementsByTagName("li")] : [];
|
|
165
|
+
listItems.every((listItem) => {
|
|
166
|
+
if (listItem.tabIndex >= 0) {
|
|
167
|
+
listItem.focus();
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const buildHeaderLabel = () => {
|
|
174
|
+
const hasSelection = utils.getSelected(internalValues).length > 0;
|
|
175
|
+
return labels?.select || !multiSelect ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
Typography.HvTypography,
|
|
215
177
|
{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
178
|
+
component: "div",
|
|
179
|
+
variant: "body",
|
|
180
|
+
className: cx(classes.placeholder, {
|
|
181
|
+
[classes.selectionDisabled]: disabled,
|
|
182
|
+
[classes.placeholderClosed]: !(isOpen || hasSelection)
|
|
183
|
+
}),
|
|
184
|
+
children: selectionLabel.selected
|
|
185
|
+
}
|
|
186
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
187
|
+
Typography.HvTypography,
|
|
188
|
+
{
|
|
189
|
+
component: "div",
|
|
190
|
+
className: cx(classes.placeholder, {
|
|
191
|
+
[classes.selectionDisabled]: disabled
|
|
192
|
+
}),
|
|
193
|
+
variant: "body",
|
|
230
194
|
children: [
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
195
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { children: selectionLabel.selected }),
|
|
196
|
+
` ${labels?.multiSelectionConjunction} ${selectionLabel.total}`
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
const hasLabel = label != null;
|
|
202
|
+
const hasDescription = description != null;
|
|
203
|
+
const canShowError = ariaErrorMessage == null && (status !== void 0 && statusMessage !== void 0 || status === void 0 && required);
|
|
204
|
+
const isStateInvalid = validationStates.isInvalid(validationState);
|
|
205
|
+
let errorMessageId;
|
|
206
|
+
if (isStateInvalid) {
|
|
207
|
+
errorMessageId = canShowError ? setId.setId(elementId, "error") : ariaErrorMessage;
|
|
208
|
+
}
|
|
209
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
210
|
+
FormElement.HvFormElement,
|
|
211
|
+
{
|
|
212
|
+
id,
|
|
213
|
+
name,
|
|
214
|
+
status: validationState,
|
|
215
|
+
disabled,
|
|
216
|
+
readOnly,
|
|
217
|
+
required,
|
|
218
|
+
className: cx(
|
|
219
|
+
classes.root,
|
|
220
|
+
{
|
|
221
|
+
[classes.disabled]: disabled
|
|
222
|
+
},
|
|
223
|
+
className
|
|
224
|
+
),
|
|
225
|
+
...others,
|
|
226
|
+
children: [
|
|
227
|
+
(hasLabel || hasDescription) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.labelContainer, children: [
|
|
228
|
+
hasLabel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
229
|
+
Label.HvLabel,
|
|
251
230
|
{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
root: cx(classes.dropdown, {
|
|
256
|
-
[classes.readOnly]: readOnly
|
|
257
|
-
}),
|
|
258
|
-
arrow: classes.arrow,
|
|
259
|
-
header: cx(classes.dropdownHeader, {
|
|
260
|
-
[classes.dropdownHeaderInvalid]: isStateInvalid
|
|
261
|
-
}),
|
|
262
|
-
headerOpen: classes.dropdownHeaderOpen
|
|
263
|
-
},
|
|
264
|
-
expanded: isOpen,
|
|
265
|
-
disabled,
|
|
266
|
-
readOnly,
|
|
267
|
-
required,
|
|
268
|
-
disablePortal,
|
|
269
|
-
placement,
|
|
270
|
-
popperProps,
|
|
271
|
-
placeholder: buildHeaderLabel(),
|
|
272
|
-
onToggle: handleToggle,
|
|
273
|
-
onClickOutside: handleClickOutside,
|
|
274
|
-
onContainerCreation: setFocusToContent,
|
|
275
|
-
role: "combobox",
|
|
276
|
-
variableWidth,
|
|
277
|
-
"aria-label": ariaLabel,
|
|
278
|
-
"aria-labelledby": [label && setId.setId(elementId, "label"), ariaLabelledBy].join(" ").trim() || void 0,
|
|
279
|
-
"aria-invalid": isStateInvalid ? true : void 0,
|
|
280
|
-
"aria-errormessage": errorMessageId,
|
|
281
|
-
"aria-describedby": [description && setId.setId(elementId, "description"), ariaDescribedBy].join(" ").trim() || void 0,
|
|
282
|
-
onFocus,
|
|
283
|
-
onBlur,
|
|
284
|
-
dropdownHeaderRef: headerForkedRef,
|
|
285
|
-
...otherBaseDropdownProps,
|
|
286
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
-
List.HvDropdownList,
|
|
288
|
-
{
|
|
289
|
-
id: setId.setId(elementId, "values"),
|
|
290
|
-
classes: {
|
|
291
|
-
rootList: classes.rootList,
|
|
292
|
-
dropdownListContainer: classes.dropdownListContainer
|
|
293
|
-
},
|
|
294
|
-
values: internalValues,
|
|
295
|
-
multiSelect,
|
|
296
|
-
showSearch,
|
|
297
|
-
onChange: handleSelection,
|
|
298
|
-
onCancel: handleCancel,
|
|
299
|
-
labels,
|
|
300
|
-
notifyChangesOnFirstRender,
|
|
301
|
-
hasTooltips,
|
|
302
|
-
singleSelectionToggle,
|
|
303
|
-
"aria-label": ariaLabel,
|
|
304
|
-
"aria-labelledby": hasLabel ? setId.setId(elementId, "label") : void 0,
|
|
305
|
-
height,
|
|
306
|
-
maxHeight,
|
|
307
|
-
virtualized,
|
|
308
|
-
...listProps
|
|
309
|
-
}
|
|
310
|
-
)
|
|
231
|
+
id: setId.setId(elementId, "label"),
|
|
232
|
+
label,
|
|
233
|
+
className: classes.label
|
|
311
234
|
}
|
|
312
235
|
),
|
|
313
|
-
|
|
314
|
-
|
|
236
|
+
hasDescription && /* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
+
InfoMessage.HvInfoMessage,
|
|
315
238
|
{
|
|
316
|
-
id: setId.setId(elementId, "
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
children: validationMessage
|
|
239
|
+
id: setId.setId(elementId, "description"),
|
|
240
|
+
className: classes.description,
|
|
241
|
+
children: description
|
|
320
242
|
}
|
|
321
243
|
)
|
|
322
|
-
]
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
244
|
+
] }),
|
|
245
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
246
|
+
BaseDropdown.HvBaseDropdown,
|
|
247
|
+
{
|
|
248
|
+
ref: dropdownForkedRef,
|
|
249
|
+
id: setId.setId(id, "dropdown"),
|
|
250
|
+
classes: {
|
|
251
|
+
root: cx(classes.dropdown, {
|
|
252
|
+
[classes.readOnly]: readOnly
|
|
253
|
+
}),
|
|
254
|
+
arrow: classes.arrow,
|
|
255
|
+
header: cx(classes.dropdownHeader, {
|
|
256
|
+
[classes.dropdownHeaderInvalid]: isStateInvalid
|
|
257
|
+
}),
|
|
258
|
+
headerOpen: classes.dropdownHeaderOpen
|
|
259
|
+
},
|
|
260
|
+
expanded: isOpen,
|
|
261
|
+
disabled,
|
|
262
|
+
readOnly,
|
|
263
|
+
required,
|
|
264
|
+
disablePortal,
|
|
265
|
+
placement,
|
|
266
|
+
popperProps,
|
|
267
|
+
placeholder: buildHeaderLabel(),
|
|
268
|
+
onToggle: handleToggle,
|
|
269
|
+
onClickOutside: handleClickOutside,
|
|
270
|
+
onContainerCreation: setFocusToContent,
|
|
271
|
+
role: "combobox",
|
|
272
|
+
variableWidth,
|
|
273
|
+
"aria-label": ariaLabel,
|
|
274
|
+
"aria-labelledby": [label && setId.setId(elementId, "label"), ariaLabelledBy].join(" ").trim() || void 0,
|
|
275
|
+
"aria-invalid": isStateInvalid ? true : void 0,
|
|
276
|
+
"aria-errormessage": errorMessageId,
|
|
277
|
+
"aria-describedby": [description && setId.setId(elementId, "description"), ariaDescribedBy].join(" ").trim() || void 0,
|
|
278
|
+
onFocus,
|
|
279
|
+
onBlur,
|
|
280
|
+
dropdownHeaderRef: headerForkedRef,
|
|
281
|
+
...otherBaseDropdownProps,
|
|
282
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
283
|
+
List.HvDropdownList,
|
|
284
|
+
{
|
|
285
|
+
id: setId.setId(elementId, "values"),
|
|
286
|
+
classes: {
|
|
287
|
+
rootList: classes.rootList,
|
|
288
|
+
dropdownListContainer: classes.dropdownListContainer
|
|
289
|
+
},
|
|
290
|
+
values: internalValues,
|
|
291
|
+
multiSelect,
|
|
292
|
+
showSearch,
|
|
293
|
+
onChange: handleSelection,
|
|
294
|
+
onCancel: handleCancel,
|
|
295
|
+
labels,
|
|
296
|
+
notifyChangesOnFirstRender,
|
|
297
|
+
hasTooltips,
|
|
298
|
+
singleSelectionToggle,
|
|
299
|
+
"aria-label": ariaLabel,
|
|
300
|
+
"aria-labelledby": hasLabel ? setId.setId(elementId, "label") : void 0,
|
|
301
|
+
height,
|
|
302
|
+
maxHeight,
|
|
303
|
+
virtualized,
|
|
304
|
+
...listProps
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
canShowError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
+
WarningText.HvWarningText,
|
|
311
|
+
{
|
|
312
|
+
id: setId.setId(elementId, "error"),
|
|
313
|
+
disableBorder: true,
|
|
314
|
+
className: classes.error,
|
|
315
|
+
children: validationMessage
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
});
|
|
327
322
|
exports.dropdownClasses = Dropdown_styles.staticClasses;
|
|
328
323
|
exports.HvDropdown = HvDropdown;
|
|
@@ -56,11 +56,13 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
56
56
|
onBlur?.(event, newValue);
|
|
57
57
|
};
|
|
58
58
|
const handleKeyDown = (event) => {
|
|
59
|
+
let newValue = value;
|
|
59
60
|
if (keyboardUtils.isKey(event, "Esc")) {
|
|
61
|
+
newValue = cachedValue;
|
|
60
62
|
setEditMode(false);
|
|
61
|
-
setValue(
|
|
63
|
+
setValue(newValue);
|
|
62
64
|
}
|
|
63
|
-
onKeyDown?.(event);
|
|
65
|
+
onKeyDown?.(event, newValue);
|
|
64
66
|
};
|
|
65
67
|
const handleChange = (event, val) => {
|
|
66
68
|
setValue(val);
|
|
@@ -33,7 +33,7 @@ const Attribute = ({
|
|
|
33
33
|
status: isInvalid ? "invalid" : "valid",
|
|
34
34
|
statusMessage: labels.rule.attribute.exists,
|
|
35
35
|
onChange: (selected) => {
|
|
36
|
-
if (selected
|
|
36
|
+
if (selected) {
|
|
37
37
|
const attributeId = selected.id;
|
|
38
38
|
const type = attributes && attributeId && attributes[attributeId]?.type;
|
|
39
39
|
const typeOperators = type ? operators[type] : void 0;
|
|
@@ -3,23 +3,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const Dropdown = require("../../../Dropdown/Dropdown.cjs");
|
|
5
5
|
const HvDropdownColumnCell = ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
onChange,
|
|
9
|
-
placeholder,
|
|
10
|
-
dropdownProps
|
|
6
|
+
dropdownProps,
|
|
7
|
+
...others
|
|
11
8
|
}) => {
|
|
12
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
|
-
Dropdown.HvDropdown,
|
|
14
|
-
{
|
|
15
|
-
onChange: (item) => {
|
|
16
|
-
onChange?.(item);
|
|
17
|
-
},
|
|
18
|
-
placeholder,
|
|
19
|
-
disabled,
|
|
20
|
-
values,
|
|
21
|
-
...dropdownProps
|
|
22
|
-
}
|
|
23
|
-
);
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Dropdown.HvDropdown, { ...dropdownProps, ...others });
|
|
24
10
|
};
|
|
25
11
|
exports.HvDropdownColumnCell = HvDropdownColumnCell;
|
|
@@ -143,11 +143,8 @@ function hvDropdownColumn(col, id, placeholder, disabledPlaceholder, onChange, d
|
|
|
143
143
|
placeholder: disabled ? disabledPlaceholder : placeholder,
|
|
144
144
|
onChange: (val) => onChange?.(row.id, val),
|
|
145
145
|
disabled,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
// TODO - to be reviewed because it doesn't make much sense
|
|
149
|
-
...dropdownProps
|
|
150
|
-
}
|
|
146
|
+
"aria-labelledby": setId.setId(id, column.id) || column.id || id,
|
|
147
|
+
...dropdownProps
|
|
151
148
|
}
|
|
152
149
|
);
|
|
153
150
|
},
|