@vxe-ui/plugin-render-element 4.3.1 → 4.4.0
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.
- package/LICENSE +20 -20
- package/README.md +176 -176
- package/dist/index.umd.js +48 -16
- package/dist/index.umd.min.js +1 -1
- package/es/index.esm.js +3 -3
- package/es/index.js +3 -3
- package/es/table/index.js +29 -5
- package/lib/index.common.js +3 -3
- package/lib/index.js +3 -3
- package/lib/index.umd.js +48 -16
- package/lib/index.umd.min.js +1 -1
- package/lib/table/index.js +40 -8
- package/package.json +78 -78
- package/src/form/index.ts +326 -326
- package/src/form-design/checkbox-widget.ts +167 -167
- package/src/form-design/date-picker-widget.ts +144 -144
- package/src/form-design/index.ts +101 -101
- package/src/form-design/input-widget.ts +145 -145
- package/src/form-design/number-input-widget.ts +144 -144
- package/src/form-design/radio-widget.ts +167 -167
- package/src/form-design/select-widget.ts +166 -166
- package/src/form-design/switch-widget.ts +140 -140
- package/src/form-design/textarea-widget.ts +149 -149
- package/src/form-design/use.ts +255 -255
- package/src/index.ts +124 -124
- package/src/store/index.ts +5 -5
- package/src/table/index.ts +754 -729
- package/src/util/comp.ts +21 -21
- package/types/index.d.ts +19 -19
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
import { defineComponent, h, PropType, ComponentOptions } from 'vue'
|
|
2
|
-
import { getCurrComponent } from '../util/comp'
|
|
3
|
-
|
|
4
|
-
import type { VxeUIExport, VxeGlobalRendererHandles } from 'vxe-pc-ui'
|
|
5
|
-
|
|
6
|
-
interface WidgetElTextareaFormObjVO {
|
|
7
|
-
placeholder: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function createWidgetElTextarea (VxeUI: VxeUIExport) {
|
|
11
|
-
const getWidgetElTextareaConfig = (params: VxeGlobalRendererHandles.CreateFormDesignWidgetConfigParams): VxeGlobalRendererHandles.CreateFormDesignWidgetConfigObj<WidgetElTextareaFormObjVO> => {
|
|
12
|
-
return {
|
|
13
|
-
title: '文本域',
|
|
14
|
-
icon: 'vxe-icon-textarea',
|
|
15
|
-
options: {
|
|
16
|
-
placeholder: '请输入'
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const WidgetElTextareaFormComponent = defineComponent({
|
|
22
|
-
props: {
|
|
23
|
-
renderOpts: {
|
|
24
|
-
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewOptions>,
|
|
25
|
-
default: () => ({})
|
|
26
|
-
},
|
|
27
|
-
renderParams: {
|
|
28
|
-
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewParams<WidgetElTextareaFormObjVO>>,
|
|
29
|
-
default: () => ({})
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
emits: [],
|
|
33
|
-
setup (props) {
|
|
34
|
-
const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
|
|
35
|
-
const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
|
|
36
|
-
const VxeUISwitchComponent = VxeUI.getComponent('VxeSwitch')
|
|
37
|
-
|
|
38
|
-
return () => {
|
|
39
|
-
const { renderParams } = props
|
|
40
|
-
const { widget } = renderParams
|
|
41
|
-
|
|
42
|
-
return h(VxeUIFormComponent, {
|
|
43
|
-
class: 'vxe-form-design--widget-render-form-wrapper',
|
|
44
|
-
vertical: true,
|
|
45
|
-
span: 24,
|
|
46
|
-
titleBold: true,
|
|
47
|
-
titleOverflow: true,
|
|
48
|
-
data: widget.options
|
|
49
|
-
}, {
|
|
50
|
-
default () {
|
|
51
|
-
return [
|
|
52
|
-
h(VxeUIFormItemComponent, {
|
|
53
|
-
title: VxeUI.getI18n('vxe.formDesign.widgetProp.name')
|
|
54
|
-
}, {
|
|
55
|
-
default () {
|
|
56
|
-
return h(getCurrComponent('el-input') as ComponentOptions, {
|
|
57
|
-
modelValue: widget.title,
|
|
58
|
-
'onUpdate:modelValue' (val: any) {
|
|
59
|
-
widget.title = val
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
h(VxeUIFormItemComponent, {
|
|
65
|
-
title: VxeUI.getI18n('vxe.formDesign.widgetProp.placeholder'),
|
|
66
|
-
field: 'placeholder',
|
|
67
|
-
itemRender: { name: 'ElInput' }
|
|
68
|
-
}),
|
|
69
|
-
h(VxeUIFormItemComponent, {
|
|
70
|
-
title: VxeUI.getI18n('vxe.formDesign.widgetProp.required')
|
|
71
|
-
}, {
|
|
72
|
-
default () {
|
|
73
|
-
return h(VxeUISwitchComponent, {
|
|
74
|
-
modelValue: widget.required,
|
|
75
|
-
'onUpdate:modelValue' (val: any) {
|
|
76
|
-
widget.required = val
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
const WidgetElTextareaViewComponent = defineComponent({
|
|
89
|
-
props: {
|
|
90
|
-
renderOpts: {
|
|
91
|
-
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewOptions>,
|
|
92
|
-
default: () => ({})
|
|
93
|
-
},
|
|
94
|
-
renderParams: {
|
|
95
|
-
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewParams<WidgetElTextareaFormObjVO>>,
|
|
96
|
-
default: () => ({})
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
emits: [],
|
|
100
|
-
setup (props) {
|
|
101
|
-
const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
|
|
102
|
-
|
|
103
|
-
const changeEvent = () => {
|
|
104
|
-
const { renderParams } = props
|
|
105
|
-
const { widget, $formView } = renderParams
|
|
106
|
-
if ($formView) {
|
|
107
|
-
const itemValue = $formView ? $formView.getItemValue(widget) : null
|
|
108
|
-
$formView.updateWidgetStatus(widget, itemValue)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return () => {
|
|
113
|
-
const { renderParams } = props
|
|
114
|
-
const { widget, $formView } = renderParams
|
|
115
|
-
const { options } = widget
|
|
116
|
-
|
|
117
|
-
return h(VxeUIFormItemComponent, {
|
|
118
|
-
class: ['vxe-form-design--widget-render-form-item'],
|
|
119
|
-
field: widget.field,
|
|
120
|
-
title: widget.title
|
|
121
|
-
}, {
|
|
122
|
-
default () {
|
|
123
|
-
return h(getCurrComponent('el-input') as ComponentOptions, {
|
|
124
|
-
modelValue: $formView ? $formView.getItemValue(widget) : null,
|
|
125
|
-
placeholder: options.placeholder,
|
|
126
|
-
type: 'textarea',
|
|
127
|
-
autosize: {
|
|
128
|
-
minRows: 2,
|
|
129
|
-
maxRows: 4
|
|
130
|
-
},
|
|
131
|
-
onChange: changeEvent,
|
|
132
|
-
'onUpdate:modelValue' (val: any) {
|
|
133
|
-
if ($formView) {
|
|
134
|
-
$formView.setItemValue(widget, val)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
})
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
getWidgetElTextareaConfig,
|
|
146
|
-
WidgetElTextareaFormComponent,
|
|
147
|
-
WidgetElTextareaViewComponent
|
|
148
|
-
}
|
|
149
|
-
}
|
|
1
|
+
import { defineComponent, h, PropType, ComponentOptions } from 'vue'
|
|
2
|
+
import { getCurrComponent } from '../util/comp'
|
|
3
|
+
|
|
4
|
+
import type { VxeUIExport, VxeGlobalRendererHandles } from 'vxe-pc-ui'
|
|
5
|
+
|
|
6
|
+
interface WidgetElTextareaFormObjVO {
|
|
7
|
+
placeholder: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createWidgetElTextarea (VxeUI: VxeUIExport) {
|
|
11
|
+
const getWidgetElTextareaConfig = (params: VxeGlobalRendererHandles.CreateFormDesignWidgetConfigParams): VxeGlobalRendererHandles.CreateFormDesignWidgetConfigObj<WidgetElTextareaFormObjVO> => {
|
|
12
|
+
return {
|
|
13
|
+
title: '文本域',
|
|
14
|
+
icon: 'vxe-icon-textarea',
|
|
15
|
+
options: {
|
|
16
|
+
placeholder: '请输入'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const WidgetElTextareaFormComponent = defineComponent({
|
|
22
|
+
props: {
|
|
23
|
+
renderOpts: {
|
|
24
|
+
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewOptions>,
|
|
25
|
+
default: () => ({})
|
|
26
|
+
},
|
|
27
|
+
renderParams: {
|
|
28
|
+
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewParams<WidgetElTextareaFormObjVO>>,
|
|
29
|
+
default: () => ({})
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
emits: [],
|
|
33
|
+
setup (props) {
|
|
34
|
+
const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
|
|
35
|
+
const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
|
|
36
|
+
const VxeUISwitchComponent = VxeUI.getComponent('VxeSwitch')
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
const { renderParams } = props
|
|
40
|
+
const { widget } = renderParams
|
|
41
|
+
|
|
42
|
+
return h(VxeUIFormComponent, {
|
|
43
|
+
class: 'vxe-form-design--widget-render-form-wrapper',
|
|
44
|
+
vertical: true,
|
|
45
|
+
span: 24,
|
|
46
|
+
titleBold: true,
|
|
47
|
+
titleOverflow: true,
|
|
48
|
+
data: widget.options
|
|
49
|
+
}, {
|
|
50
|
+
default () {
|
|
51
|
+
return [
|
|
52
|
+
h(VxeUIFormItemComponent, {
|
|
53
|
+
title: VxeUI.getI18n('vxe.formDesign.widgetProp.name')
|
|
54
|
+
}, {
|
|
55
|
+
default () {
|
|
56
|
+
return h(getCurrComponent('el-input') as ComponentOptions, {
|
|
57
|
+
modelValue: widget.title,
|
|
58
|
+
'onUpdate:modelValue' (val: any) {
|
|
59
|
+
widget.title = val
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
h(VxeUIFormItemComponent, {
|
|
65
|
+
title: VxeUI.getI18n('vxe.formDesign.widgetProp.placeholder'),
|
|
66
|
+
field: 'placeholder',
|
|
67
|
+
itemRender: { name: 'ElInput' }
|
|
68
|
+
}),
|
|
69
|
+
h(VxeUIFormItemComponent, {
|
|
70
|
+
title: VxeUI.getI18n('vxe.formDesign.widgetProp.required')
|
|
71
|
+
}, {
|
|
72
|
+
default () {
|
|
73
|
+
return h(VxeUISwitchComponent, {
|
|
74
|
+
modelValue: widget.required,
|
|
75
|
+
'onUpdate:modelValue' (val: any) {
|
|
76
|
+
widget.required = val
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const WidgetElTextareaViewComponent = defineComponent({
|
|
89
|
+
props: {
|
|
90
|
+
renderOpts: {
|
|
91
|
+
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewOptions>,
|
|
92
|
+
default: () => ({})
|
|
93
|
+
},
|
|
94
|
+
renderParams: {
|
|
95
|
+
type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewParams<WidgetElTextareaFormObjVO>>,
|
|
96
|
+
default: () => ({})
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
emits: [],
|
|
100
|
+
setup (props) {
|
|
101
|
+
const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
|
|
102
|
+
|
|
103
|
+
const changeEvent = () => {
|
|
104
|
+
const { renderParams } = props
|
|
105
|
+
const { widget, $formView } = renderParams
|
|
106
|
+
if ($formView) {
|
|
107
|
+
const itemValue = $formView ? $formView.getItemValue(widget) : null
|
|
108
|
+
$formView.updateWidgetStatus(widget, itemValue)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return () => {
|
|
113
|
+
const { renderParams } = props
|
|
114
|
+
const { widget, $formView } = renderParams
|
|
115
|
+
const { options } = widget
|
|
116
|
+
|
|
117
|
+
return h(VxeUIFormItemComponent, {
|
|
118
|
+
class: ['vxe-form-design--widget-render-form-item'],
|
|
119
|
+
field: widget.field,
|
|
120
|
+
title: widget.title
|
|
121
|
+
}, {
|
|
122
|
+
default () {
|
|
123
|
+
return h(getCurrComponent('el-input') as ComponentOptions, {
|
|
124
|
+
modelValue: $formView ? $formView.getItemValue(widget) : null,
|
|
125
|
+
placeholder: options.placeholder,
|
|
126
|
+
type: 'textarea',
|
|
127
|
+
autosize: {
|
|
128
|
+
minRows: 2,
|
|
129
|
+
maxRows: 4
|
|
130
|
+
},
|
|
131
|
+
onChange: changeEvent,
|
|
132
|
+
'onUpdate:modelValue' (val: any) {
|
|
133
|
+
if ($formView) {
|
|
134
|
+
$formView.setItemValue(widget, val)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
getWidgetElTextareaConfig,
|
|
146
|
+
WidgetElTextareaFormComponent,
|
|
147
|
+
WidgetElTextareaViewComponent
|
|
148
|
+
}
|
|
149
|
+
}
|