UNPKG

vxe-design

Version:

A PC-based visual designer based on Vxe UI, used for building zero-code and low-code platforms

73 lines (72 loc) 2.86 kB
import { h, inject } from 'vue'; import { defineVxeComponent } from '../../ui/src/comp'; import { VxeUI, getI18n } from '@vxe-ui/core'; import { useWidgetName } from '../../form-design/src/use'; export const WidgetSubtableFormComponent = defineVxeComponent({ props: { renderOpts: { type: Object, default: () => ({}) }, renderParams: { type: Object, default: () => ({}) } }, emits: [], setup(props) { const VxeUIFormComponent = VxeUI.getComponent('vxe-form'); const VxeUIFormItemComponent = VxeUI.getComponent('vxe-form-item'); const VxeUIInputComponent = VxeUI.getComponent('vxe-input'); const VxeUISwitchComponent = VxeUI.getComponent('vxe-switch'); const $xeFormDesign = inject('$xeFormDesign', null); if (!$xeFormDesign) { return () => []; } const { computeKebabCaseName } = useWidgetName(props); return () => { const { renderParams } = props; const { widget } = renderParams; const { options } = widget; const kebabCaseName = computeKebabCaseName.value; return h(VxeUIFormComponent, { class: `vxe-form-design--widget-${kebabCaseName}-form`, vertical: true, span: 24, titleBold: true, titleOverflow: true, data: options }, { default() { return [ h(VxeUIFormItemComponent, { title: getI18n('vxe.formDesign.widgetProp.name') }, { default() { return h(VxeUIInputComponent, { modelValue: widget.title, 'onUpdate:modelValue'(val) { widget.title = val; } }); } }), h(VxeUIFormItemComponent, { title: getI18n('vxe.formDesign.widgetProp.subtableProp.showCheckbox'), field: 'showCheckbox' }, { default() { return h(VxeUISwitchComponent, { modelValue: options.showCheckbox, 'onUpdate:modelValue'(val) { options.showCheckbox = val; } }); } }) ]; } }); }; } });