@rhc-shared-components/form-multi-select-component 0.2.1 → 0.2.2
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.js +9 -1
- package/dist/index.modern.js +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -126,6 +126,8 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
126
126
|
var _useField = formik.useField(rest),
|
|
127
127
|
meta = _useField[1];
|
|
128
128
|
|
|
129
|
+
var value = meta.value;
|
|
130
|
+
|
|
129
131
|
var _useFormikContext = formik.useFormikContext(),
|
|
130
132
|
isSubmitting = _useFormikContext.isSubmitting,
|
|
131
133
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -182,6 +184,12 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
182
184
|
setFocusedItemIndex(null);
|
|
183
185
|
setActiveItem(null);
|
|
184
186
|
}, [inputValue]);
|
|
187
|
+
React__default["default"].useEffect(function () {
|
|
188
|
+
if ((value == null ? void 0 : value.length) > 0) {
|
|
189
|
+
setFieldValue(rest.name, value, true);
|
|
190
|
+
setSelected(value);
|
|
191
|
+
}
|
|
192
|
+
}, []);
|
|
185
193
|
|
|
186
194
|
var handleMenuArrowKeys = function handleMenuArrowKeys(key) {
|
|
187
195
|
var indexToFocus = 0;
|
|
@@ -355,7 +363,7 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
355
363
|
isFocused: focusedItemIndex === index,
|
|
356
364
|
className: option.className,
|
|
357
365
|
id: "select-multi-typeahead-" + option.value.replace(' ', '-'),
|
|
358
|
-
isDisabled: option.isDisabled
|
|
366
|
+
isDisabled: option.isDisabled || isSubmitting
|
|
359
367
|
}, option, {
|
|
360
368
|
ref: null
|
|
361
369
|
}));
|
package/dist/index.modern.js
CHANGED
|
@@ -105,6 +105,9 @@ const FormMultiSelectInput = _ref => {
|
|
|
105
105
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
106
106
|
|
|
107
107
|
const [, meta] = useField(rest);
|
|
108
|
+
const {
|
|
109
|
+
value
|
|
110
|
+
} = meta;
|
|
108
111
|
const {
|
|
109
112
|
isSubmitting,
|
|
110
113
|
setFieldValue,
|
|
@@ -141,6 +144,12 @@ const FormMultiSelectInput = _ref => {
|
|
|
141
144
|
setFocusedItemIndex(null);
|
|
142
145
|
setActiveItem(null);
|
|
143
146
|
}, [inputValue]);
|
|
147
|
+
React__default.useEffect(() => {
|
|
148
|
+
if ((value == null ? void 0 : value.length) > 0) {
|
|
149
|
+
setFieldValue(rest.name, value, true);
|
|
150
|
+
setSelected(value);
|
|
151
|
+
}
|
|
152
|
+
}, []);
|
|
144
153
|
|
|
145
154
|
const handleMenuArrowKeys = key => {
|
|
146
155
|
let indexToFocus = 0;
|
|
@@ -296,7 +305,7 @@ const FormMultiSelectInput = _ref => {
|
|
|
296
305
|
isFocused: focusedItemIndex === index,
|
|
297
306
|
className: option.className,
|
|
298
307
|
id: `select-multi-typeahead-${option.value.replace(' ', '-')}`,
|
|
299
|
-
isDisabled: option.isDisabled
|
|
308
|
+
isDisabled: option.isDisabled || isSubmitting
|
|
300
309
|
}, option, {
|
|
301
310
|
ref: null
|
|
302
311
|
})))))));
|