@nolwenture/formik-jsonschema-form 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -106,7 +106,7 @@ export const ArrayField = (props) => {
|
|
|
106
106
|
onClick: () => setValue(moveInArray(value, index + items.length, -1)),
|
|
107
107
|
uiSchema,
|
|
108
108
|
}), value.length > 1 &&
|
|
109
|
-
index < value.length - 1 &&
|
|
109
|
+
index < (value === null || value === void 0 ? void 0 : value.slice(items.length).length) - 1 &&
|
|
110
110
|
GetArrayFieldButton({
|
|
111
111
|
purpose: ArrayFieldButtonPurpose.MOVE_DOWN,
|
|
112
112
|
onClick: () => setValue(moveInArray(value, index + items.length, 1)),
|
package/dist/styledComponents.js
CHANGED
|
@@ -352,22 +352,18 @@ export const SearchableMultiTagSelectField = ({ name, placeholder, enums, emptyS
|
|
|
352
352
|
const hasValue = enums === null || enums === void 0 ? void 0 : enums.values.map((value) => value.title.toLowerCase().includes(search.toLowerCase()));
|
|
353
353
|
return hasValue === null || hasValue === void 0 ? void 0 : hasValue.includes(true);
|
|
354
354
|
};
|
|
355
|
-
return (_jsx(formik.Field, { className: className, name: name, multiple: true, children: ({ field, form: {
|
|
355
|
+
return (_jsx(formik.Field, { className: className, name: name, multiple: true, children: ({ field, form: { setFieldValue }, meta, }) => {
|
|
356
356
|
var _a;
|
|
357
357
|
return (_jsxs(MultiSelectContainer, { className: className, children: [_jsx(FieldInput, Object.assign({ type: "hidden" }, field)), _jsx(MultiSelectInput, { className: className, type: "text", onChange: (e) => {
|
|
358
358
|
setSearch(e.currentTarget.value);
|
|
359
359
|
}, placeholder: placeholder, value: search }), _jsx(MultiSelectBadgeContainer, { children: ((_a = field.value) !== null && _a !== void 0 ? _a : []).map((value) => {
|
|
360
360
|
var _a;
|
|
361
|
-
return (_jsxs(MultiSelectBadge, { children: [(_a = enums === null || enums === void 0 ? void 0 : enums.values.find((option) => option.const === value)) === null || _a === void 0 ? void 0 : _a.title, _jsx(MultiSelectBadgeCloseElement, { onClick: () =>
|
|
362
|
-
[name]: field.value.filter((v) => v !== value),
|
|
363
|
-
}), children: closeElement !== null && closeElement !== void 0 ? closeElement : "x" })] }, value));
|
|
361
|
+
return (_jsxs(MultiSelectBadge, { children: [(_a = enums === null || enums === void 0 ? void 0 : enums.values.find((option) => option.const === value)) === null || _a === void 0 ? void 0 : _a.title, _jsx(MultiSelectBadgeCloseElement, { onClick: () => setFieldValue(name, field.value.filter((v) => v !== value)), children: closeElement !== null && closeElement !== void 0 ? closeElement : "x" })] }, value));
|
|
364
362
|
}) }), search.length > 0 && (_jsx(MultiSelectOptionList, { children: searchIncludedInEnum() ? (enums === null || enums === void 0 ? void 0 : enums.values.filter((item) => { var _a; return !((_a = field.value) !== null && _a !== void 0 ? _a : []).includes(item.const); }).filter((value) => value.title.toLowerCase().includes(search.toLowerCase())).map((option, index) => (_jsx(MultiSelectOptionListItem, { value: option.const, onClick: () => {
|
|
365
363
|
var _a;
|
|
366
|
-
|
|
367
|
-
[
|
|
368
|
-
|
|
369
|
-
],
|
|
370
|
-
});
|
|
364
|
+
setFieldValue(name, [
|
|
365
|
+
...new Set([...((_a = field.value) !== null && _a !== void 0 ? _a : []), option.const]),
|
|
366
|
+
]);
|
|
371
367
|
setSearch("");
|
|
372
368
|
}, children: option.title }, index)))) : (_jsx(MultiSelectOptionListWithoutItem, { children: emptySearchMessage !== null && emptySearchMessage !== void 0 ? emptySearchMessage : "No match found" })) })), meta.touched && meta.error && (_jsx("div", { className: "error", children: meta.error }))] }));
|
|
373
369
|
} }));
|