@vxe-ui/plugin-render-antd 4.3.1 → 4.4.1

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.
@@ -1,165 +1,165 @@
1
- import { defineComponent, h, PropType, ComponentOptions, computed } from 'vue'
2
- import { useWidgetPropDataSource, WidgetDataSourceOptionObjVO } from './use'
3
- import { getCurrComponent } from '../util/comp'
4
- import XEUtils from 'xe-utils'
5
-
6
- import type { VxeUIExport, VxeGlobalRendererHandles } from 'vxe-pc-ui'
7
-
8
- interface WidgetACheckboxFormObjVO {
9
- options: WidgetDataSourceOptionObjVO[]
10
- }
11
-
12
- export function createWidgetACheckbox (VxeUI: VxeUIExport) {
13
- const getWidgetACheckboxConfig = (params: VxeGlobalRendererHandles.CreateFormDesignWidgetConfigParams): VxeGlobalRendererHandles.CreateFormDesignWidgetConfigObj<WidgetACheckboxFormObjVO> => {
14
- return {
15
- title: '复选框',
16
- icon: 'vxe-icon-checkbox-checked',
17
- options: {
18
- options: XEUtils.range(0, 3).map((v, i) => {
19
- return {
20
- value: VxeUI.getI18n('vxe.formDesign.widgetProp.dataSource.defValue', [i + 1])
21
- }
22
- })
23
- }
24
- }
25
- }
26
-
27
- const WidgetACheckboxFormComponent = defineComponent({
28
- props: {
29
- renderOpts: {
30
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewOptions>,
31
- default: () => ({})
32
- },
33
- renderParams: {
34
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewParams<WidgetACheckboxFormObjVO>>,
35
- default: () => ({})
36
- }
37
- },
38
- emits: [],
39
- setup (props) {
40
- const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
41
- const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
42
- const VxeUISwitchComponent = VxeUI.getComponent('VxeSwitch')
43
- const VxeUIInputComponent = VxeUI.getComponent('VxeInput')
44
-
45
- const { renderDataSourceFormItem } = useWidgetPropDataSource(VxeUI, props, false)
46
-
47
- return () => {
48
- const { renderParams } = props
49
- const { widget } = renderParams
50
-
51
- return h(VxeUIFormComponent, {
52
- class: 'vxe-form-design--widget-render-form-wrapper',
53
- vertical: true,
54
- span: 24,
55
- titleBold: true,
56
- titleOverflow: true,
57
- data: widget.options
58
- }, {
59
- default () {
60
- return [
61
- h(VxeUIFormItemComponent, {
62
- title: VxeUI.getI18n('vxe.formDesign.widgetProp.name')
63
- }, {
64
- default () {
65
- return h(VxeUIInputComponent, {
66
- modelValue: widget.title,
67
- 'onUpdate:modelValue' (val: any) {
68
- widget.title = val
69
- }
70
- })
71
- }
72
- }),
73
- h(VxeUIFormItemComponent, {
74
- title: VxeUI.getI18n('vxe.formDesign.widgetProp.placeholder'),
75
- field: 'placeholder',
76
- itemRender: { name: 'ElInput' }
77
- }),
78
- h(VxeUIFormItemComponent, {
79
- title: VxeUI.getI18n('vxe.formDesign.widgetProp.required')
80
- }, {
81
- default () {
82
- return h(VxeUISwitchComponent, {
83
- modelValue: widget.required,
84
- 'onUpdate:modelValue' (val: any) {
85
- widget.required = val
86
- }
87
- })
88
- }
89
- }),
90
- renderDataSourceFormItem()
91
- ]
92
- }
93
- })
94
- }
95
- }
96
- })
97
-
98
- const WidgetACheckboxViewComponent = defineComponent({
99
- props: {
100
- renderOpts: {
101
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewOptions>,
102
- default: () => ({})
103
- },
104
- renderParams: {
105
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewParams<WidgetACheckboxFormObjVO>>,
106
- default: () => ({})
107
- }
108
- },
109
- emits: [],
110
- setup (props) {
111
- const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
112
-
113
- const checkboxOptions = computed(() => {
114
- const { renderParams } = props
115
- const { widget } = renderParams
116
- const { options } = widget
117
- return options.options.map(item => {
118
- return {
119
- label: item.value,
120
- value: item.value
121
- }
122
- })
123
- })
124
-
125
- const changeEvent = () => {
126
- const { renderParams } = props
127
- const { widget, $formView } = renderParams
128
- if ($formView) {
129
- const itemValue = $formView ? $formView.getItemValue(widget) : null
130
- $formView.updateWidgetStatus(widget, itemValue)
131
- }
132
- }
133
-
134
- return () => {
135
- const { renderParams } = props
136
- const { widget, $formView } = renderParams
137
-
138
- return h(VxeUIFormItemComponent, {
139
- class: ['vxe-form-design--widget-render-form-item'],
140
- field: widget.field,
141
- title: widget.title
142
- }, {
143
- default () {
144
- return h(getCurrComponent('a-checkbox-group') as ComponentOptions, {
145
- value: $formView ? $formView.getItemValue(widget) : null,
146
- options: checkboxOptions.value,
147
- onChange: changeEvent,
148
- 'onUpdate:value' (val: any) {
149
- if ($formView) {
150
- $formView.setItemValue(widget, val)
151
- }
152
- }
153
- })
154
- }
155
- })
156
- }
157
- }
158
- })
159
-
160
- return {
161
- getWidgetACheckboxConfig,
162
- WidgetACheckboxFormComponent,
163
- WidgetACheckboxViewComponent
164
- }
165
- }
1
+ import { defineComponent, h, PropType, ComponentOptions, computed } from 'vue'
2
+ import { useWidgetPropDataSource, WidgetDataSourceOptionObjVO } from './use'
3
+ import { getCurrComponent } from '../util/comp'
4
+ import XEUtils from 'xe-utils'
5
+
6
+ import type { VxeUIExport, VxeGlobalRendererHandles } from 'vxe-pc-ui'
7
+
8
+ interface WidgetACheckboxFormObjVO {
9
+ options: WidgetDataSourceOptionObjVO[]
10
+ }
11
+
12
+ export function createWidgetACheckbox (VxeUI: VxeUIExport) {
13
+ const getWidgetACheckboxConfig = (params: VxeGlobalRendererHandles.CreateFormDesignWidgetConfigParams): VxeGlobalRendererHandles.CreateFormDesignWidgetConfigObj<WidgetACheckboxFormObjVO> => {
14
+ return {
15
+ title: '复选框',
16
+ icon: 'vxe-icon-checkbox-checked',
17
+ options: {
18
+ options: XEUtils.range(0, 3).map((v, i) => {
19
+ return {
20
+ value: VxeUI.getI18n('vxe.formDesign.widgetProp.dataSource.defValue', [i + 1])
21
+ }
22
+ })
23
+ }
24
+ }
25
+ }
26
+
27
+ const WidgetACheckboxFormComponent = defineComponent({
28
+ props: {
29
+ renderOpts: {
30
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewOptions>,
31
+ default: () => ({})
32
+ },
33
+ renderParams: {
34
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewParams<WidgetACheckboxFormObjVO>>,
35
+ default: () => ({})
36
+ }
37
+ },
38
+ emits: [],
39
+ setup (props) {
40
+ const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
41
+ const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
42
+ const VxeUISwitchComponent = VxeUI.getComponent('VxeSwitch')
43
+ const VxeUIInputComponent = VxeUI.getComponent('VxeInput')
44
+
45
+ const { renderDataSourceFormItem } = useWidgetPropDataSource(VxeUI, props, false)
46
+
47
+ return () => {
48
+ const { renderParams } = props
49
+ const { widget } = renderParams
50
+
51
+ return h(VxeUIFormComponent, {
52
+ class: 'vxe-form-design--widget-render-form-wrapper',
53
+ vertical: true,
54
+ span: 24,
55
+ titleBold: true,
56
+ titleOverflow: true,
57
+ data: widget.options
58
+ }, {
59
+ default () {
60
+ return [
61
+ h(VxeUIFormItemComponent, {
62
+ title: VxeUI.getI18n('vxe.formDesign.widgetProp.name')
63
+ }, {
64
+ default () {
65
+ return h(VxeUIInputComponent, {
66
+ modelValue: widget.title,
67
+ 'onUpdate:modelValue' (val: any) {
68
+ widget.title = val
69
+ }
70
+ })
71
+ }
72
+ }),
73
+ h(VxeUIFormItemComponent, {
74
+ title: VxeUI.getI18n('vxe.formDesign.widgetProp.placeholder'),
75
+ field: 'placeholder',
76
+ itemRender: { name: 'ElInput' }
77
+ }),
78
+ h(VxeUIFormItemComponent, {
79
+ title: VxeUI.getI18n('vxe.formDesign.widgetProp.required')
80
+ }, {
81
+ default () {
82
+ return h(VxeUISwitchComponent, {
83
+ modelValue: widget.required,
84
+ 'onUpdate:modelValue' (val: any) {
85
+ widget.required = val
86
+ }
87
+ })
88
+ }
89
+ }),
90
+ renderDataSourceFormItem()
91
+ ]
92
+ }
93
+ })
94
+ }
95
+ }
96
+ })
97
+
98
+ const WidgetACheckboxViewComponent = defineComponent({
99
+ props: {
100
+ renderOpts: {
101
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewOptions>,
102
+ default: () => ({})
103
+ },
104
+ renderParams: {
105
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewParams<WidgetACheckboxFormObjVO>>,
106
+ default: () => ({})
107
+ }
108
+ },
109
+ emits: [],
110
+ setup (props) {
111
+ const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
112
+
113
+ const checkboxOptions = computed(() => {
114
+ const { renderParams } = props
115
+ const { widget } = renderParams
116
+ const { options } = widget
117
+ return options.options.map(item => {
118
+ return {
119
+ label: item.value,
120
+ value: item.value
121
+ }
122
+ })
123
+ })
124
+
125
+ const changeEvent = () => {
126
+ const { renderParams } = props
127
+ const { widget, $formView } = renderParams
128
+ if ($formView) {
129
+ const itemValue = $formView ? $formView.getItemValue(widget) : null
130
+ $formView.updateWidgetStatus(widget, itemValue)
131
+ }
132
+ }
133
+
134
+ return () => {
135
+ const { renderParams } = props
136
+ const { widget, $formView } = renderParams
137
+
138
+ return h(VxeUIFormItemComponent, {
139
+ class: ['vxe-form-design--widget-render-form-item'],
140
+ field: widget.field,
141
+ title: widget.title
142
+ }, {
143
+ default () {
144
+ return h(getCurrComponent('a-checkbox-group') as ComponentOptions, {
145
+ value: $formView ? $formView.getItemValue(widget) : null,
146
+ options: checkboxOptions.value,
147
+ onChange: changeEvent,
148
+ 'onUpdate:value' (val: any) {
149
+ if ($formView) {
150
+ $formView.setItemValue(widget, val)
151
+ }
152
+ }
153
+ })
154
+ }
155
+ })
156
+ }
157
+ }
158
+ })
159
+
160
+ return {
161
+ getWidgetACheckboxConfig,
162
+ WidgetACheckboxFormComponent,
163
+ WidgetACheckboxViewComponent
164
+ }
165
+ }
@@ -1,145 +1,145 @@
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 WidgetADatePickerFormObjVO {
7
- placeholder: string
8
- }
9
-
10
- export function createWidgetADatePicker (VxeUI: VxeUIExport) {
11
- const getWidgetADatePickerConfig = (params: VxeGlobalRendererHandles.CreateFormDesignWidgetConfigParams): VxeGlobalRendererHandles.CreateFormDesignWidgetConfigObj<WidgetADatePickerFormObjVO> => {
12
- return {
13
- title: '日期',
14
- icon: 'vxe-icon-input',
15
- options: {
16
- placeholder: ''
17
- }
18
- }
19
- }
20
-
21
- const WidgetADatePickerFormComponent = defineComponent({
22
- props: {
23
- renderOpts: {
24
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewOptions>,
25
- default: () => ({})
26
- },
27
- renderParams: {
28
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewParams<WidgetADatePickerFormObjVO>>,
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
- const VxeUIInputComponent = VxeUI.getComponent('VxeInput')
38
-
39
- return () => {
40
- const { renderParams } = props
41
- const { widget } = renderParams
42
-
43
- return h(VxeUIFormComponent, {
44
- class: 'vxe-form-design--widget-render-form-wrapper',
45
- vertical: true,
46
- span: 24,
47
- titleBold: true,
48
- titleOverflow: true,
49
- data: widget.options
50
- }, {
51
- default () {
52
- return [
53
- h(VxeUIFormItemComponent, {
54
- title: VxeUI.getI18n('vxe.formDesign.widgetProp.name')
55
- }, {
56
- default () {
57
- return h(VxeUIInputComponent, {
58
- modelValue: widget.title,
59
- 'onUpdate:modelValue' (val: any) {
60
- widget.title = val
61
- }
62
- })
63
- }
64
- }),
65
- h(VxeUIFormItemComponent, {
66
- title: VxeUI.getI18n('vxe.formDesign.widgetProp.placeholder'),
67
- field: 'placeholder',
68
- itemRender: { name: 'VxeInput' }
69
- }),
70
- h(VxeUIFormItemComponent, {
71
- title: VxeUI.getI18n('vxe.formDesign.widgetProp.required')
72
- }, {
73
- default () {
74
- return h(VxeUISwitchComponent, {
75
- modelValue: widget.required,
76
- 'onUpdate:modelValue' (val: any) {
77
- widget.required = val
78
- }
79
- })
80
- }
81
- })
82
- ]
83
- }
84
- })
85
- }
86
- }
87
- })
88
-
89
- const WidgetADatePickerViewComponent = defineComponent({
90
- props: {
91
- renderOpts: {
92
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewOptions>,
93
- default: () => ({})
94
- },
95
- renderParams: {
96
- type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewParams<WidgetADatePickerFormObjVO>>,
97
- default: () => ({})
98
- }
99
- },
100
- emits: [],
101
- setup (props) {
102
- const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
103
-
104
- const changeEvent = () => {
105
- const { renderParams } = props
106
- const { widget, $formView } = renderParams
107
- if ($formView) {
108
- const itemValue = $formView ? $formView.getItemValue(widget) : null
109
- $formView.updateWidgetStatus(widget, itemValue)
110
- }
111
- }
112
-
113
- return () => {
114
- const { renderParams } = props
115
- const { widget, $formView } = renderParams
116
- const { options } = widget
117
-
118
- return h(VxeUIFormItemComponent, {
119
- class: ['vxe-form-design--widget-render-form-item'],
120
- field: widget.field,
121
- title: widget.title
122
- }, {
123
- default () {
124
- return h(getCurrComponent('a-date-picker') as ComponentOptions, {
125
- value: $formView ? $formView.getItemValue(widget) : null,
126
- placeholder: options.placeholder,
127
- onChange: changeEvent,
128
- 'onUpdate:value' (val: any) {
129
- if ($formView) {
130
- $formView.setItemValue(widget, val)
131
- }
132
- }
133
- })
134
- }
135
- })
136
- }
137
- }
138
- })
139
-
140
- return {
141
- getWidgetADatePickerConfig,
142
- WidgetADatePickerFormComponent,
143
- WidgetADatePickerViewComponent
144
- }
145
- }
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 WidgetADatePickerFormObjVO {
7
+ placeholder: string
8
+ }
9
+
10
+ export function createWidgetADatePicker (VxeUI: VxeUIExport) {
11
+ const getWidgetADatePickerConfig = (params: VxeGlobalRendererHandles.CreateFormDesignWidgetConfigParams): VxeGlobalRendererHandles.CreateFormDesignWidgetConfigObj<WidgetADatePickerFormObjVO> => {
12
+ return {
13
+ title: '日期',
14
+ icon: 'vxe-icon-input',
15
+ options: {
16
+ placeholder: ''
17
+ }
18
+ }
19
+ }
20
+
21
+ const WidgetADatePickerFormComponent = defineComponent({
22
+ props: {
23
+ renderOpts: {
24
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewOptions>,
25
+ default: () => ({})
26
+ },
27
+ renderParams: {
28
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetFormViewParams<WidgetADatePickerFormObjVO>>,
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
+ const VxeUIInputComponent = VxeUI.getComponent('VxeInput')
38
+
39
+ return () => {
40
+ const { renderParams } = props
41
+ const { widget } = renderParams
42
+
43
+ return h(VxeUIFormComponent, {
44
+ class: 'vxe-form-design--widget-render-form-wrapper',
45
+ vertical: true,
46
+ span: 24,
47
+ titleBold: true,
48
+ titleOverflow: true,
49
+ data: widget.options
50
+ }, {
51
+ default () {
52
+ return [
53
+ h(VxeUIFormItemComponent, {
54
+ title: VxeUI.getI18n('vxe.formDesign.widgetProp.name')
55
+ }, {
56
+ default () {
57
+ return h(VxeUIInputComponent, {
58
+ modelValue: widget.title,
59
+ 'onUpdate:modelValue' (val: any) {
60
+ widget.title = val
61
+ }
62
+ })
63
+ }
64
+ }),
65
+ h(VxeUIFormItemComponent, {
66
+ title: VxeUI.getI18n('vxe.formDesign.widgetProp.placeholder'),
67
+ field: 'placeholder',
68
+ itemRender: { name: 'VxeInput' }
69
+ }),
70
+ h(VxeUIFormItemComponent, {
71
+ title: VxeUI.getI18n('vxe.formDesign.widgetProp.required')
72
+ }, {
73
+ default () {
74
+ return h(VxeUISwitchComponent, {
75
+ modelValue: widget.required,
76
+ 'onUpdate:modelValue' (val: any) {
77
+ widget.required = val
78
+ }
79
+ })
80
+ }
81
+ })
82
+ ]
83
+ }
84
+ })
85
+ }
86
+ }
87
+ })
88
+
89
+ const WidgetADatePickerViewComponent = defineComponent({
90
+ props: {
91
+ renderOpts: {
92
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewOptions>,
93
+ default: () => ({})
94
+ },
95
+ renderParams: {
96
+ type: Object as PropType<VxeGlobalRendererHandles.RenderFormDesignWidgetViewParams<WidgetADatePickerFormObjVO>>,
97
+ default: () => ({})
98
+ }
99
+ },
100
+ emits: [],
101
+ setup (props) {
102
+ const VxeUIFormItemComponent = VxeUI.getComponent('VxeFormItem')
103
+
104
+ const changeEvent = () => {
105
+ const { renderParams } = props
106
+ const { widget, $formView } = renderParams
107
+ if ($formView) {
108
+ const itemValue = $formView ? $formView.getItemValue(widget) : null
109
+ $formView.updateWidgetStatus(widget, itemValue)
110
+ }
111
+ }
112
+
113
+ return () => {
114
+ const { renderParams } = props
115
+ const { widget, $formView } = renderParams
116
+ const { options } = widget
117
+
118
+ return h(VxeUIFormItemComponent, {
119
+ class: ['vxe-form-design--widget-render-form-item'],
120
+ field: widget.field,
121
+ title: widget.title
122
+ }, {
123
+ default () {
124
+ return h(getCurrComponent('a-date-picker') as ComponentOptions, {
125
+ value: $formView ? $formView.getItemValue(widget) : null,
126
+ placeholder: options.placeholder,
127
+ onChange: changeEvent,
128
+ 'onUpdate:value' (val: any) {
129
+ if ($formView) {
130
+ $formView.setItemValue(widget, val)
131
+ }
132
+ }
133
+ })
134
+ }
135
+ })
136
+ }
137
+ }
138
+ })
139
+
140
+ return {
141
+ getWidgetADatePickerConfig,
142
+ WidgetADatePickerFormComponent,
143
+ WidgetADatePickerViewComponent
144
+ }
145
+ }