@schema-render/form-render-react
Version:
Out-of-the-box form rendering library based on Core and Antd.
19 lines (18 loc) • 650 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Checkbox } from "antd";
import React from "react";
/**
* 编辑、禁用与只读态组件
*/ const SwitchBox = ({ schema, disabled, readonly, value, onChange })=>{
var _schema_renderOptions;
return /*#__PURE__*/ _jsx(Checkbox, {
...schema.renderOptions,
checked: value,
onChange: (e)=>onChange(e.target.checked),
disabled: disabled || readonly,
children: (_schema_renderOptions = schema.renderOptions) === null || _schema_renderOptions === void 0 ? void 0 : _schema_renderOptions.text
});
};
export default {
component: SwitchBox
};