UNPKG

gepic

Version:

基于vue3的设计器,可视化开发页面表单

146 lines (145 loc) 3.37 kB
const n = { component: async () => (await import("element-plus")).ElSwitch, groupName: "表单", icon: "icon--epic--toggle-off-outline", sort: 930, defaultSchema: { label: "开关", type: "switch", field: "switch", input: !0, componentProps: { defaultValue: !1 } }, config: { attribute: [ { label: "字段名", type: "input", field: "field" }, { label: "标题", type: "input", field: "label" }, { label: "默认值", type: "switch", field: "componentProps.defaultValue" }, { label: "ON状态值", type: "input", field: "componentProps.activeValue", componentProps: { placeholder: "请输入" }, onChange(e) { setTimeout(() => t(e)); } }, { label: "OFF状态值", type: "input", field: "componentProps.inactiveValue", componentProps: { placeholder: "请输入" }, onChange(e) { setTimeout(() => t(e)); } }, { label: "ON状态描述", type: "input", field: "componentProps.activeText", componentProps: { placeholder: "请输入" } }, { label: "OFF状态描述", type: "input", field: "componentProps.inactiveText", componentProps: { placeholder: "请输入" } }, { label: "尺寸", type: "select", componentProps: { placeholder: "请选择", clearable: !0, options: [ { label: "大号", value: "large" }, { label: "中等", value: "default" }, { label: "小型", value: "small" } ] }, field: "componentProps.size" }, { label: "宽度", type: "number", field: "componentProps.width", componentProps: { min: 50, placeholder: "请输入" } }, { label: "文本点内显示", type: "switch", field: "componentProps.inlinePrompt" }, { label: "禁用", type: "switch", field: "componentProps.disabled" }, { label: "隐藏", type: "switch", field: "componentProps.hidden" }, { label: "表单校验", type: "ERuleEditor", layout: "vertical", field: "rules", describe: "校验规则需要配合表单使用", componentProps: { ruleType: "boolean" } } ], event: [ { type: "change", describe: "状态发生变化时" } ] } }; function t(e) { var o; const l = ((o = e.values.componentProps) == null ? void 0 : o.inactiveValue) || !1; e.values.componentProps.unCheckedValue === "" && delete e.values.componentProps.unCheckedValue, e.values.componentProps.activeValue === "" && delete e.values.componentProps.activeValue, e.values.componentProps ? e.values.componentProps.defaultValue = l : e.values.componentProps = { defaultValue: l }; } export { n as default };