UNPKG

@premieroctet/next-admin

Version:

Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje

41 lines (40 loc) 1.63 kB
import { jsx } from "react/jsx-runtime"; import MultiSelectWidget_mjs_default from "./MultiSelect/MultiSelectWidget.mjs"; import ScalarArrayField_mjs_default from "./ScalarArray/ScalarArrayField.mjs"; import FileWidget_mjs_default from "./FileWidget/FileWidget.mjs"; const ArrayField = (props)=>{ const { formData, onChange, name, disabled, schema, required, formContext, customInput } = props; const resourceDefinition = formContext.schema; const field = resourceDefinition.properties[name]; if (field?.__nextadmin?.kind === "scalar" && field?.__nextadmin?.isList) { if ("data-url" === schema.format) return /*#__PURE__*/ jsx(FileWidget_mjs_default, { id: props.name, name: props.name, value: props.formData, disabled: props.disabled, rawErrors: props.rawErrors, required: props.required, schema: props.schema }); return /*#__PURE__*/ jsx(ScalarArrayField_mjs_default, { name: name, formData: formData, onChange: onChange, disabled: disabled ?? false, schema: schema, customInput: customInput }); } const options = field?.__nextadmin?.kind === "enum" ? schema.enum : void 0; return /*#__PURE__*/ jsx(MultiSelectWidget_mjs_default, { onChange: onChange, formData: formData, name: name, disabled: disabled ?? false, required: required, schema: schema, options: options }); }; const inputs_ArrayField = ArrayField; export { inputs_ArrayField as default };