vxe-pc-ui 3.0.1 → 3.0.2
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/README.md +23 -25
- package/es/calendar/index.js +12 -0
- package/es/calendar/src/calendar.js +1227 -0
- package/es/calendar/style.css +247 -0
- package/es/calendar/style.min.css +1 -0
- package/es/checkbox/src/checkbox.js +6 -1
- package/es/checkbox/src/group.js +6 -1
- package/es/collapse/index.js +12 -0
- package/es/collapse/src/collapse-pane.js +39 -0
- package/es/collapse/src/collapse.js +39 -0
- package/es/collapse/style.css +0 -0
- package/es/collapse/style.min.css +0 -0
- package/es/collapse-pane/index.js +12 -0
- package/es/collapse-pane/style.css +0 -0
- package/es/collapse-pane/style.min.css +0 -0
- package/es/components.js +27 -27
- package/es/date-picker/src/date-picker.js +17 -13
- package/es/drawer/src/drawer.js +17 -12
- package/es/form/index.js +13 -0
- package/es/form/render/index.js +461 -0
- package/es/form/src/form-config-item.js +201 -0
- package/es/form/src/form-gather.js +87 -0
- package/es/form/src/form-item.js +291 -0
- package/es/form/src/form.js +762 -0
- package/es/form/src/itemInfo.js +43 -0
- package/es/form/src/render.js +78 -0
- package/es/form/src/util.js +66 -0
- package/es/form/style.css +470 -0
- package/es/form/style.min.css +1 -0
- package/es/form-gather/index.js +12 -0
- package/es/form-gather/style.css +0 -0
- package/es/form-gather/style.min.css +0 -0
- package/es/form-item/index.js +12 -0
- package/es/form-item/style.css +0 -0
- package/es/form-item/style.min.css +0 -0
- package/es/icon/style.css +1 -1
- package/es/icon-picker/src/icon-picker.js +5 -1
- package/es/image/src/preview.js +1 -2
- package/es/input/src/input.js +19 -15
- package/es/list/index.js +12 -0
- package/es/list/src/list.js +373 -0
- package/es/list/style.css +28 -0
- package/es/list/style.min.css +1 -0
- package/es/loading/src/loading.js +5 -0
- package/es/menu/src/menu.js +6 -2
- package/es/modal/src/modal.js +7 -4
- package/es/number-input/src/number-input.js +11 -7
- package/es/pager/style.css +303 -0
- package/es/pager/style.min.css +1 -0
- package/es/password-input/src/password-input.js +7 -3
- package/es/pulldown/src/pulldown.js +6 -2
- package/es/radio/src/button.js +6 -2
- package/es/radio/src/group.js +6 -2
- package/es/radio/src/radio.js +6 -2
- package/es/select/src/select.js +16 -1
- package/es/select/src/util.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/switch/src/switch.js +6 -2
- package/es/tabs/src/tabs.js +8 -3
- package/es/textarea/src/textarea.js +9 -5
- package/es/tooltip/src/tooltip.js +6 -1
- package/es/tree/index.js +12 -0
- package/es/tree/src/tree.js +1216 -0
- package/es/tree/style.css +219 -0
- package/es/tree/style.min.css +1 -0
- package/es/tree-select/index.js +12 -0
- package/es/tree-select/src/tree-select.js +685 -0
- package/es/tree-select/style.css +129 -0
- package/es/tree-select/style.min.css +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/vn.js +1 -1
- package/es/upload/src/upload.js +9 -5
- package/es/vxe-calendar/index.js +3 -0
- package/es/vxe-calendar/style.css +247 -0
- package/es/vxe-calendar/style.min.css +1 -0
- package/es/vxe-collapse/index.js +3 -0
- package/es/vxe-collapse/style.css +0 -0
- package/es/vxe-collapse/style.min.css +0 -0
- package/es/vxe-collapse-pane/index.js +3 -0
- package/es/vxe-collapse-pane/style.css +0 -0
- package/es/vxe-collapse-pane/style.min.css +0 -0
- package/es/vxe-form/index.js +3 -0
- package/es/vxe-form/style.css +470 -0
- package/es/vxe-form/style.min.css +1 -0
- package/es/vxe-form-gather/index.js +3 -0
- package/es/vxe-form-gather/style.css +0 -0
- package/es/vxe-form-gather/style.min.css +0 -0
- package/es/vxe-form-item/index.js +3 -0
- package/es/vxe-form-item/style.css +0 -0
- package/es/vxe-form-item/style.min.css +0 -0
- package/es/vxe-list/index.js +3 -0
- package/es/vxe-list/style.css +28 -0
- package/es/vxe-list/style.min.css +1 -0
- package/es/vxe-pager/index.js +3 -0
- package/es/vxe-pager/style.css +303 -0
- package/es/vxe-pager/style.min.css +1 -0
- package/es/vxe-tree/index.js +3 -0
- package/es/vxe-tree/style.css +219 -0
- package/es/vxe-tree/style.min.css +1 -0
- package/es/vxe-tree-select/index.js +3 -0
- package/es/vxe-tree-select/style.css +129 -0
- package/es/vxe-tree-select/style.min.css +1 -0
- package/lib/calendar/index.js +19 -0
- package/lib/calendar/index.min.js +1 -0
- package/lib/calendar/src/calendar.js +1286 -0
- package/lib/calendar/src/calendar.min.js +1 -0
- package/lib/calendar/style/index.js +1 -0
- package/lib/calendar/style/style.css +247 -0
- package/lib/calendar/style/style.min.css +1 -0
- package/lib/checkbox/src/checkbox.js +6 -1
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/checkbox/src/group.js +6 -1
- package/lib/checkbox/src/group.min.js +1 -1
- package/lib/collapse/index.js +19 -0
- package/lib/collapse/index.min.js +1 -0
- package/lib/collapse/src/collapse-pane.js +48 -0
- package/lib/collapse/src/collapse-pane.min.js +1 -0
- package/lib/collapse/src/collapse.js +48 -0
- package/lib/collapse/src/collapse.min.js +1 -0
- package/lib/collapse/style/index.js +1 -0
- package/lib/collapse/style/style.css +0 -0
- package/lib/collapse/style/style.min.css +0 -0
- package/lib/collapse-pane/index.js +19 -0
- package/lib/collapse-pane/index.min.js +1 -0
- package/lib/collapse-pane/style/index.js +1 -0
- package/lib/collapse-pane/style/style.css +0 -0
- package/lib/collapse-pane/style/style.min.css +0 -0
- package/lib/components.js +114 -39
- package/lib/components.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +17 -13
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/drawer/src/drawer.js +17 -12
- package/lib/drawer/src/drawer.min.js +1 -1
- package/lib/form/index.js +20 -0
- package/lib/form/index.min.js +1 -0
- package/lib/form/render/index.js +509 -0
- package/lib/form/render/index.min.js +1 -0
- package/lib/form/src/form-config-item.js +210 -0
- package/lib/form/src/form-config-item.min.js +1 -0
- package/lib/form/src/form-gather.js +99 -0
- package/lib/form/src/form-gather.min.js +1 -0
- package/lib/form/src/form-item.js +299 -0
- package/lib/form/src/form-item.min.js +1 -0
- package/lib/form/src/form.js +856 -0
- package/lib/form/src/form.min.js +1 -0
- package/lib/form/src/itemInfo.js +60 -0
- package/lib/form/src/itemInfo.min.js +1 -0
- package/lib/form/src/render.js +94 -0
- package/lib/form/src/render.min.js +1 -0
- package/lib/form/src/util.js +93 -0
- package/lib/form/src/util.min.js +1 -0
- package/lib/form/style/index.js +1 -0
- package/lib/form/style/style.css +470 -0
- package/lib/form/style/style.min.css +1 -0
- package/lib/form-gather/index.js +19 -0
- package/lib/form-gather/index.min.js +1 -0
- package/lib/form-gather/style/index.js +1 -0
- package/lib/form-gather/style/style.css +0 -0
- package/lib/form-gather/style/style.min.css +0 -0
- package/lib/form-item/index.js +19 -0
- package/lib/form-item/index.min.js +1 -0
- package/lib/form-item/style/index.js +1 -0
- package/lib/form-item/style/style.css +0 -0
- package/lib/form-item/style/style.min.css +0 -0
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/icon-picker/src/icon-picker.js +5 -1
- package/lib/icon-picker/src/icon-picker.min.js +1 -1
- package/lib/image/src/preview.js +1 -2
- package/lib/image/src/preview.min.js +1 -1
- package/lib/index.umd.js +11284 -5009
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +19 -15
- package/lib/input/src/input.min.js +1 -1
- package/lib/list/index.js +19 -0
- package/lib/list/index.min.js +1 -0
- package/lib/list/src/list.js +415 -0
- package/lib/list/src/list.min.js +1 -0
- package/lib/list/style/index.js +1 -0
- package/lib/list/style/style.css +28 -0
- package/lib/list/style/style.min.css +1 -0
- package/lib/loading/src/loading.js +5 -0
- package/lib/loading/src/loading.min.js +1 -1
- package/lib/menu/src/menu.js +6 -2
- package/lib/menu/src/menu.min.js +1 -1
- package/lib/modal/src/modal.js +7 -4
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/number-input/src/number-input.js +11 -7
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/pager/style/index.js +1 -0
- package/lib/pager/style/style.css +303 -0
- package/lib/pager/style/style.min.css +1 -0
- package/lib/password-input/src/password-input.js +7 -3
- package/lib/password-input/src/password-input.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +6 -2
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/radio/src/button.js +6 -2
- package/lib/radio/src/button.min.js +1 -1
- package/lib/radio/src/group.js +6 -2
- package/lib/radio/src/group.min.js +1 -1
- package/lib/radio/src/radio.js +6 -2
- package/lib/radio/src/radio.min.js +1 -1
- package/lib/select/src/select.js +16 -1
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/src/util.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/src/switch.js +6 -2
- package/lib/switch/src/switch.min.js +1 -1
- package/lib/tabs/src/tabs.js +8 -3
- package/lib/tabs/src/tabs.min.js +1 -1
- package/lib/textarea/src/textarea.js +9 -5
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/tooltip/src/tooltip.js +6 -1
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tree/index.js +19 -0
- package/lib/tree/index.min.js +1 -0
- package/lib/tree/src/tree.js +1324 -0
- package/lib/tree/src/tree.min.js +1 -0
- package/lib/tree/style/index.js +1 -0
- package/lib/tree/style/style.css +219 -0
- package/lib/tree/style/style.min.css +1 -0
- package/lib/tree-select/index.js +19 -0
- package/lib/tree-select/index.min.js +1 -0
- package/lib/tree-select/src/tree-select.js +695 -0
- package/lib/tree-select/src/tree-select.min.js +1 -0
- package/lib/tree-select/style/index.js +1 -0
- package/lib/tree-select/style/style.css +129 -0
- package/lib/tree-select/style/style.min.css +1 -0
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/vn.js +1 -1
- package/lib/ui/src/vn.min.js +1 -1
- package/lib/upload/src/upload.js +9 -5
- package/lib/upload/src/upload.min.js +1 -1
- package/lib/vxe-calendar/index.js +23 -0
- package/lib/vxe-calendar/index.min.js +1 -0
- package/lib/vxe-calendar/style/index.js +1 -0
- package/lib/vxe-calendar/style/style.css +247 -0
- package/lib/vxe-calendar/style/style.min.css +1 -0
- package/lib/vxe-collapse/index.js +23 -0
- package/lib/vxe-collapse/index.min.js +1 -0
- package/lib/vxe-collapse/style/index.js +1 -0
- package/lib/vxe-collapse/style/style.css +0 -0
- package/lib/vxe-collapse/style/style.min.css +0 -0
- package/lib/vxe-collapse-pane/index.js +23 -0
- package/lib/vxe-collapse-pane/index.min.js +1 -0
- package/lib/vxe-collapse-pane/style/index.js +1 -0
- package/lib/vxe-collapse-pane/style/style.css +0 -0
- package/lib/vxe-collapse-pane/style/style.min.css +0 -0
- package/lib/vxe-form/index.js +23 -0
- package/lib/vxe-form/index.min.js +1 -0
- package/lib/vxe-form/style/index.js +1 -0
- package/lib/vxe-form/style/style.css +470 -0
- package/lib/vxe-form/style/style.min.css +1 -0
- package/lib/vxe-form-gather/index.js +23 -0
- package/lib/vxe-form-gather/index.min.js +1 -0
- package/lib/vxe-form-gather/style/index.js +1 -0
- package/lib/vxe-form-gather/style/style.css +0 -0
- package/lib/vxe-form-gather/style/style.min.css +0 -0
- package/lib/vxe-form-item/index.js +23 -0
- package/lib/vxe-form-item/index.min.js +1 -0
- package/lib/vxe-form-item/style/index.js +1 -0
- package/lib/vxe-form-item/style/style.css +0 -0
- package/lib/vxe-form-item/style/style.min.css +0 -0
- package/lib/vxe-list/index.js +23 -0
- package/lib/vxe-list/index.min.js +1 -0
- package/lib/vxe-list/style/index.js +1 -0
- package/lib/vxe-list/style/style.css +28 -0
- package/lib/vxe-list/style/style.min.css +1 -0
- package/lib/vxe-pager/index.js +23 -0
- package/lib/vxe-pager/index.min.js +1 -0
- package/lib/vxe-pager/style/index.js +1 -0
- package/lib/vxe-pager/style/style.css +303 -0
- package/lib/vxe-pager/style/style.min.css +1 -0
- package/lib/vxe-tree/index.js +23 -0
- package/lib/vxe-tree/index.min.js +1 -0
- package/lib/vxe-tree/style/index.js +1 -0
- package/lib/vxe-tree/style/style.css +219 -0
- package/lib/vxe-tree/style/style.min.css +1 -0
- package/lib/vxe-tree-select/index.js +23 -0
- package/lib/vxe-tree-select/index.min.js +1 -0
- package/lib/vxe-tree-select/style/index.js +1 -0
- package/lib/vxe-tree-select/style/style.css +129 -0
- package/lib/vxe-tree-select/style/style.min.css +1 -0
- package/package.json +1 -1
- package/packages/calendar/index.ts +16 -0
- package/packages/calendar/src/calendar.ts +1281 -0
- package/packages/checkbox/src/checkbox.ts +7 -1
- package/packages/checkbox/src/group.ts +8 -2
- package/packages/collapse/index.ts +16 -0
- package/packages/collapse/src/collapse-pane.ts +47 -0
- package/packages/collapse/src/collapse.ts +47 -0
- package/packages/collapse-pane/index.ts +16 -0
- package/packages/components.ts +27 -27
- package/packages/date-picker/src/date-picker.ts +18 -13
- package/packages/drawer/src/drawer.ts +18 -12
- package/packages/form/index.ts +17 -0
- package/packages/form/render/index.ts +499 -0
- package/packages/form/src/form-config-item.ts +219 -0
- package/packages/form/src/form-gather.ts +104 -0
- package/packages/form/src/form-item.ts +322 -0
- package/packages/form/src/form.ts +809 -0
- package/packages/form/src/itemInfo.ts +47 -0
- package/packages/form/src/render.ts +98 -0
- package/packages/form/src/util.ts +80 -0
- package/packages/form-gather/index.ts +16 -0
- package/packages/form-item/index.ts +16 -0
- package/packages/icon-picker/src/icon-picker.ts +6 -1
- package/packages/image/src/preview.ts +1 -2
- package/packages/input/src/input.ts +20 -15
- package/packages/layout-footer/src/layout-footer.ts +1 -0
- package/packages/list/index.ts +16 -0
- package/packages/list/src/list.ts +403 -0
- package/packages/loading/src/loading.ts +6 -0
- package/packages/menu/src/menu.ts +7 -2
- package/packages/modal/src/modal.ts +8 -4
- package/packages/number-input/src/number-input.ts +12 -7
- package/packages/password-input/src/password-input.ts +8 -3
- package/packages/pulldown/src/pulldown.ts +7 -2
- package/packages/radio/src/button.ts +7 -2
- package/packages/radio/src/group.ts +7 -2
- package/packages/radio/src/radio.ts +7 -2
- package/packages/select/src/select.ts +17 -1
- package/packages/select/src/util.ts +4 -3
- package/packages/switch/src/switch.ts +7 -2
- package/packages/tabs/src/tabs.ts +9 -3
- package/packages/textarea/src/textarea.ts +10 -5
- package/packages/tooltip/src/tooltip.ts +7 -1
- package/packages/tree/index.ts +16 -0
- package/packages/tree/src/tree.ts +1292 -0
- package/packages/tree-select/index.ts +16 -0
- package/packages/tree-select/src/tree-select.ts +743 -0
- package/packages/ui/src/vn.ts +1 -1
- package/packages/upload/src/upload.ts +10 -5
- package/types/components/calendar.d.ts +6 -0
- package/types/components/colgroup.d.ts +1 -0
- package/types/components/column.d.ts +1 -0
- package/types/components/drawer.d.ts +11 -10
- package/types/components/form-item.d.ts +1 -1
- package/types/components/form.d.ts +8 -1
- package/types/components/list.d.ts +1 -0
- package/types/components/table.d.ts +43 -4
- package/types/components/toolbar.d.ts +5 -0
- package/types/components/tree-select.d.ts +4 -0
- package/types/ui/index.d.ts +0 -5
- package/types/ui/renderer.d.ts +37 -36
- package/types/handles/form-design.d.ts +0 -4
- package/types/handles/index.d.ts +0 -3
- package/types/handles/list-design.d.ts +0 -4
- package/types/handles/table.d.ts +0 -4
- /package/es/icon/style/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/es/icon/style/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
- /package/es/icon/style/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
- /package/es/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/es/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
- /package/es/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
- /package/lib/icon/style/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
- /package/lib/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
- /package/lib/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
- /package/lib/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
|
+
import XEUtils from 'xe-utils';
|
|
3
|
+
import { getIcon, getI18n, renderer, renderEmptyElement, globalMixins } from '../../ui';
|
|
4
|
+
import { getFuncText, isEnableConf } from '../../ui/src/utils';
|
|
5
|
+
import { getSlotVNs } from '../../ui/src/vn';
|
|
6
|
+
import { renderTitle } from './render';
|
|
7
|
+
import { isActiveItem } from './util';
|
|
8
|
+
const VxeFormConfigItem = defineVxeComponent({
|
|
9
|
+
name: 'VxeFormConfigItem',
|
|
10
|
+
mixins: [
|
|
11
|
+
globalMixins.sizeMixin
|
|
12
|
+
],
|
|
13
|
+
props: {
|
|
14
|
+
itemConfig: Object
|
|
15
|
+
},
|
|
16
|
+
inject: {
|
|
17
|
+
$xeForm: {
|
|
18
|
+
default: null
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
provide() {
|
|
22
|
+
const xeFormItemInfo = this;
|
|
23
|
+
return {
|
|
24
|
+
xeFormItemInfo,
|
|
25
|
+
$xeFormGather: null
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
computed: Object.assign({}, {}),
|
|
29
|
+
methods: {
|
|
30
|
+
renderVN(h) {
|
|
31
|
+
const $xeFormConfigItem = this;
|
|
32
|
+
const props = $xeFormConfigItem;
|
|
33
|
+
const $xeForm = $xeFormConfigItem.$xeForm;
|
|
34
|
+
const formProps = $xeForm;
|
|
35
|
+
const formReactData = $xeForm.reactData;
|
|
36
|
+
const { data, rules, readonly, disabled, span: allSpan, align: allAlign, titleBold: allTitleBold, titleAlign: allTitleAlign, titleWidth: allTitleWidth, titleColon: allTitleColon, titleAsterisk: allTitleAsterisk, titleOverflow: allTitleOverflow, vertical: allVertical, padding: allPadding } = formProps;
|
|
37
|
+
const item = props.itemConfig;
|
|
38
|
+
const { collapseAll } = formReactData;
|
|
39
|
+
const validOpts = $xeForm.computeValidOpts;
|
|
40
|
+
const { slots, title, visible, folding, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, vertical, padding, children, showTitle, contentClassName, contentStyle, titleClassName, titleStyle } = item;
|
|
41
|
+
const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
|
|
42
|
+
const itemClassName = compConf ? (compConf.formItemClassName || compConf.itemClassName) : '';
|
|
43
|
+
const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
|
|
44
|
+
const itemContentClassName = compConf ? (compConf.formItemContentClassName || compConf.itemContentClassName) : '';
|
|
45
|
+
const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
|
|
46
|
+
const itemTitleClassName = compConf ? (compConf.formItemTitleClassName || compConf.itemTitleClassName) : '';
|
|
47
|
+
const itemTitleStyle = compConf ? (compConf.formItemTitleStyle || compConf.itemTitleStyle) : null;
|
|
48
|
+
const defaultSlot = slots ? slots.default : null;
|
|
49
|
+
const titleSlot = slots ? slots.title : null;
|
|
50
|
+
const span = item.span || allSpan;
|
|
51
|
+
const align = item.align || allAlign;
|
|
52
|
+
const itemPadding = XEUtils.eqNull(padding) ? allPadding : padding;
|
|
53
|
+
const itemVertical = XEUtils.eqNull(vertical) ? allVertical : vertical;
|
|
54
|
+
const titleBold = XEUtils.eqNull(item.titleBold) ? allTitleBold : item.titleBold;
|
|
55
|
+
const titleAlign = XEUtils.eqNull(item.titleAlign) ? allTitleAlign : item.titleAlign;
|
|
56
|
+
const titleWidth = itemVertical ? null : (XEUtils.eqNull(item.titleWidth) ? allTitleWidth : item.titleWidth);
|
|
57
|
+
const titleColon = XEUtils.eqNull(item.titleColon) ? allTitleColon : item.titleColon;
|
|
58
|
+
const titleAsterisk = XEUtils.eqNull(item.titleAsterisk) ? allTitleAsterisk : item.titleAsterisk;
|
|
59
|
+
const itemOverflow = XEUtils.eqNull(titleOverflow) ? allTitleOverflow : titleOverflow;
|
|
60
|
+
const ovEllipsis = itemOverflow === 'ellipsis';
|
|
61
|
+
const ovTitle = itemOverflow === 'title';
|
|
62
|
+
const ovTooltip = itemOverflow === true || itemOverflow === 'tooltip';
|
|
63
|
+
const hasEllipsis = ovTitle || ovTooltip || ovEllipsis;
|
|
64
|
+
const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeForm.xegrid };
|
|
65
|
+
if (visible === false) {
|
|
66
|
+
return renderEmptyElement($xeFormConfigItem);
|
|
67
|
+
}
|
|
68
|
+
let isRequired = false;
|
|
69
|
+
let isValid = false;
|
|
70
|
+
if (!readonly && rules) {
|
|
71
|
+
const itemRules = rules[field];
|
|
72
|
+
if (itemRules && itemRules.length) {
|
|
73
|
+
isValid = true;
|
|
74
|
+
isRequired = itemRules.some((rule) => rule.required);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// 如果为项集合
|
|
78
|
+
const isGather = children && children.length > 0;
|
|
79
|
+
if (isGather) {
|
|
80
|
+
const childVNs = children.map((childItem, index) => {
|
|
81
|
+
return h(VxeFormConfigItem, {
|
|
82
|
+
key: index,
|
|
83
|
+
props: {
|
|
84
|
+
itemConfig: childItem
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return childVNs.length
|
|
89
|
+
? h('div', {
|
|
90
|
+
class: ['vxe-form--gather vxe-form--item-row', item.id, span ? `vxe-form--item-col_${span} is--span` : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '']
|
|
91
|
+
}, childVNs)
|
|
92
|
+
: renderEmptyElement($xeFormConfigItem);
|
|
93
|
+
}
|
|
94
|
+
let contentVNs = [];
|
|
95
|
+
const rftContent = compConf ? (compConf.renderFormItemContent || compConf.renderItemContent) : null;
|
|
96
|
+
if (defaultSlot) {
|
|
97
|
+
contentVNs = $xeForm.callSlot(defaultSlot, params);
|
|
98
|
+
}
|
|
99
|
+
else if (rftContent) {
|
|
100
|
+
contentVNs = getSlotVNs(rftContent(h, itemRender, params));
|
|
101
|
+
}
|
|
102
|
+
else if (field) {
|
|
103
|
+
contentVNs = [XEUtils.toValueString(XEUtils.get(data, field))];
|
|
104
|
+
}
|
|
105
|
+
if (collapseNode) {
|
|
106
|
+
contentVNs.push(h('div', {
|
|
107
|
+
class: 'vxe-form--item-trigger-node',
|
|
108
|
+
on: {
|
|
109
|
+
click: $xeForm.toggleCollapseEvent
|
|
110
|
+
}
|
|
111
|
+
}, [
|
|
112
|
+
h('span', {
|
|
113
|
+
class: 'vxe-form--item-trigger-text'
|
|
114
|
+
}, collapseAll ? getI18n('vxe.form.unfolding') : getI18n('vxe.form.folding')),
|
|
115
|
+
h('i', {
|
|
116
|
+
class: ['vxe-form--item-trigger-icon', collapseAll ? getIcon().FORM_FOLDING : getIcon().FORM_UNFOLDING]
|
|
117
|
+
})
|
|
118
|
+
]));
|
|
119
|
+
}
|
|
120
|
+
if (errRule && validOpts.showMessage) {
|
|
121
|
+
contentVNs.push(h('div', {
|
|
122
|
+
class: 'vxe-form--item-valid',
|
|
123
|
+
style: errRule.maxWidth
|
|
124
|
+
? {
|
|
125
|
+
width: `${errRule.maxWidth}px`
|
|
126
|
+
}
|
|
127
|
+
: {}
|
|
128
|
+
}, errRule.content));
|
|
129
|
+
}
|
|
130
|
+
const ons = ovTooltip
|
|
131
|
+
? {
|
|
132
|
+
mouseenter(evnt) {
|
|
133
|
+
$xeForm.triggerTitleTipEvent(evnt, params);
|
|
134
|
+
},
|
|
135
|
+
mouseleave: $xeForm.handleTitleTipLeaveEvent
|
|
136
|
+
}
|
|
137
|
+
: {};
|
|
138
|
+
return h('div', {
|
|
139
|
+
class: [
|
|
140
|
+
'vxe-form--item',
|
|
141
|
+
item.id,
|
|
142
|
+
span ? `vxe-form--item-col_${span} is--span` : '',
|
|
143
|
+
className ? (XEUtils.isFunction(className) ? className(params) : className) : '',
|
|
144
|
+
itemClassName ? (XEUtils.isFunction(itemClassName) ? itemClassName(params) : itemClassName) : '',
|
|
145
|
+
{
|
|
146
|
+
'is--title': title,
|
|
147
|
+
'is--colon': titleColon,
|
|
148
|
+
'is--bold': titleBold,
|
|
149
|
+
'is--padding': itemPadding,
|
|
150
|
+
'is--vertical': itemVertical,
|
|
151
|
+
'is--asterisk': titleAsterisk,
|
|
152
|
+
'is--valid': isValid,
|
|
153
|
+
'is--required': isRequired,
|
|
154
|
+
'is--hidden': folding && collapseAll,
|
|
155
|
+
'is--active': isActiveItem($xeForm, item),
|
|
156
|
+
'is--error': showError
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
style: XEUtils.isFunction(itemStyle) ? itemStyle(params) : (itemStyle || {})
|
|
160
|
+
}, [
|
|
161
|
+
h('div', {
|
|
162
|
+
class: 'vxe-form--item-inner'
|
|
163
|
+
}, [
|
|
164
|
+
(showTitle !== false) && (title || titleSlot)
|
|
165
|
+
? h('div', {
|
|
166
|
+
class: [
|
|
167
|
+
'vxe-form--item-title',
|
|
168
|
+
titleAlign ? `align--${titleAlign}` : '',
|
|
169
|
+
hasEllipsis ? 'is--ellipsis' : '',
|
|
170
|
+
itemTitleClassName ? (XEUtils.isFunction(itemTitleClassName) ? itemTitleClassName(params) : itemTitleClassName) : '',
|
|
171
|
+
titleClassName ? (XEUtils.isFunction(titleClassName) ? titleClassName(params) : titleClassName) : ''
|
|
172
|
+
],
|
|
173
|
+
style: Object.assign({}, XEUtils.isFunction(itemTitleStyle) ? itemTitleStyle(params) : itemTitleStyle, XEUtils.isFunction(titleStyle) ? titleStyle(params) : titleStyle, titleWidth
|
|
174
|
+
? {
|
|
175
|
+
width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
|
|
176
|
+
}
|
|
177
|
+
: null),
|
|
178
|
+
attrs: {
|
|
179
|
+
title: ovTitle ? getFuncText(title) : null
|
|
180
|
+
},
|
|
181
|
+
on: ons
|
|
182
|
+
}, renderTitle(h, $xeFormConfigItem, $xeForm, item))
|
|
183
|
+
: null,
|
|
184
|
+
h('div', {
|
|
185
|
+
class: [
|
|
186
|
+
'vxe-form--item-content',
|
|
187
|
+
align ? `align--${align}` : '',
|
|
188
|
+
itemContentClassName ? (XEUtils.isFunction(itemContentClassName) ? itemContentClassName(params) : itemContentClassName) : '',
|
|
189
|
+
contentClassName ? (XEUtils.isFunction(contentClassName) ? contentClassName(params) : contentClassName) : ''
|
|
190
|
+
],
|
|
191
|
+
style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
|
|
192
|
+
}, contentVNs)
|
|
193
|
+
])
|
|
194
|
+
]);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
render(h) {
|
|
198
|
+
return this.renderVN(h);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
export default VxeFormConfigItem;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
|
+
import XEUtils from 'xe-utils';
|
|
3
|
+
import { globalMixins } from '../../ui';
|
|
4
|
+
import { createItem, watchItem, destroyItem, assembleItem } from './util';
|
|
5
|
+
import { formItemProps } from './form-item';
|
|
6
|
+
const formItemPropKeys = Object.keys(formItemProps);
|
|
7
|
+
export default defineVxeComponent({
|
|
8
|
+
name: 'VxeFormGather',
|
|
9
|
+
mixins: [
|
|
10
|
+
globalMixins.sizeMixin
|
|
11
|
+
],
|
|
12
|
+
props: formItemProps,
|
|
13
|
+
inject: {
|
|
14
|
+
$xeForm: {
|
|
15
|
+
default: null
|
|
16
|
+
},
|
|
17
|
+
$xeParentFormGather: {
|
|
18
|
+
from: '$xeFormGather',
|
|
19
|
+
default: null
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
const xID = XEUtils.uniqueId();
|
|
24
|
+
const formItem = {};
|
|
25
|
+
const reactData = {};
|
|
26
|
+
return {
|
|
27
|
+
xID,
|
|
28
|
+
formItem,
|
|
29
|
+
reactData
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
computed: Object.assign({}, {}),
|
|
33
|
+
methods: {
|
|
34
|
+
renderVN(h) {
|
|
35
|
+
const $xeFormGather = this;
|
|
36
|
+
const props = $xeFormGather;
|
|
37
|
+
const slots = $xeFormGather.$scopedSlots;
|
|
38
|
+
const formItem = $xeFormGather.formItem;
|
|
39
|
+
const $xeForm = $xeFormGather.$xeForm;
|
|
40
|
+
const { className, field } = props;
|
|
41
|
+
const span = props.span || ($xeForm ? $xeForm.span : null);
|
|
42
|
+
const defaultSlot = slots.default;
|
|
43
|
+
const params = { $form: $xeForm, data: $xeForm ? $xeForm.data : {}, item: formItem, field: field, property: field };
|
|
44
|
+
return h('div', {
|
|
45
|
+
ref: 'refElem',
|
|
46
|
+
class: ['vxe-form--gather vxe-form--item-row', formItem.id, span ? `vxe-form--item-col_${span} is--span` : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '']
|
|
47
|
+
}, defaultSlot ? defaultSlot({}) : []);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
provide() {
|
|
51
|
+
const $xeFormGather = this;
|
|
52
|
+
const formItem = $xeFormGather.formItem;
|
|
53
|
+
return {
|
|
54
|
+
$xeFormGather,
|
|
55
|
+
$xeFormItem: null,
|
|
56
|
+
xeFormItemInfo: {
|
|
57
|
+
itemConfig: formItem
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
created() {
|
|
62
|
+
const $xeFormGather = this;
|
|
63
|
+
const props = $xeFormGather;
|
|
64
|
+
const $xeForm = $xeFormGather.$xeForm;
|
|
65
|
+
const formItem = createItem($xeForm, props);
|
|
66
|
+
formItem.children = [];
|
|
67
|
+
$xeFormGather.formItem = formItem;
|
|
68
|
+
watchItem($xeFormGather, formItemPropKeys, formItem);
|
|
69
|
+
},
|
|
70
|
+
mounted() {
|
|
71
|
+
const $xeFormGather = this;
|
|
72
|
+
const formItem = $xeFormGather.formItem;
|
|
73
|
+
const $xeForm = $xeFormGather.$xeForm;
|
|
74
|
+
const $xeParentFormGather = $xeFormGather.$xeParentFormGather;
|
|
75
|
+
const elem = $xeFormGather.$refs.refElem;
|
|
76
|
+
assembleItem($xeForm, elem, formItem, $xeParentFormGather);
|
|
77
|
+
},
|
|
78
|
+
beforeDestroy() {
|
|
79
|
+
const $xeFormGather = this;
|
|
80
|
+
const formItem = $xeFormGather.formItem;
|
|
81
|
+
const $xeForm = $xeFormGather.$xeForm;
|
|
82
|
+
destroyItem($xeForm, formItem);
|
|
83
|
+
},
|
|
84
|
+
render(h) {
|
|
85
|
+
return this.renderVN(h);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
|
+
import XEUtils from 'xe-utils';
|
|
3
|
+
import { getIcon, getI18n, renderer, renderEmptyElement, globalMixins } from '../../ui';
|
|
4
|
+
import { getFuncText, isEnableConf } from '../../ui/src/utils';
|
|
5
|
+
import { getSlotVNs } from '../../ui/src/vn';
|
|
6
|
+
import { createItem, watchItem, destroyItem, assembleItem, isActiveItem } from './util';
|
|
7
|
+
import { renderTitle } from './render';
|
|
8
|
+
export const formItemProps = {
|
|
9
|
+
title: String,
|
|
10
|
+
field: String,
|
|
11
|
+
span: [String, Number],
|
|
12
|
+
align: String,
|
|
13
|
+
titleBold: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: null
|
|
16
|
+
},
|
|
17
|
+
titleAlign: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
titleWidth: {
|
|
22
|
+
type: [String, Number],
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
titleColon: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: null
|
|
28
|
+
},
|
|
29
|
+
titleAsterisk: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
showTitle: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
},
|
|
37
|
+
vertical: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: null
|
|
40
|
+
},
|
|
41
|
+
padding: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: null
|
|
44
|
+
},
|
|
45
|
+
className: [String, Function],
|
|
46
|
+
contentClassName: [String, Function],
|
|
47
|
+
contentStyle: [Object, Function],
|
|
48
|
+
titleClassName: [String, Function],
|
|
49
|
+
titleStyle: [Object, Function],
|
|
50
|
+
titleOverflow: {
|
|
51
|
+
type: [Boolean, String],
|
|
52
|
+
default: null
|
|
53
|
+
},
|
|
54
|
+
titlePrefix: Object,
|
|
55
|
+
titleSuffix: Object,
|
|
56
|
+
resetValue: { default: null },
|
|
57
|
+
visibleMethod: Function,
|
|
58
|
+
visible: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
folding: Boolean,
|
|
63
|
+
collapseNode: Boolean,
|
|
64
|
+
itemRender: Object,
|
|
65
|
+
rules: Array
|
|
66
|
+
};
|
|
67
|
+
const formItemPropKeys = Object.keys(formItemProps);
|
|
68
|
+
export default defineVxeComponent({
|
|
69
|
+
name: 'VxeFormItem',
|
|
70
|
+
mixins: [
|
|
71
|
+
globalMixins.sizeMixin
|
|
72
|
+
],
|
|
73
|
+
props: formItemProps,
|
|
74
|
+
inject: {
|
|
75
|
+
$xeForm: {
|
|
76
|
+
default: null
|
|
77
|
+
},
|
|
78
|
+
$xeFormGather: {
|
|
79
|
+
default: null
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
data() {
|
|
83
|
+
const xID = XEUtils.uniqueId();
|
|
84
|
+
const formItem = {};
|
|
85
|
+
const reactData = {};
|
|
86
|
+
return {
|
|
87
|
+
xID,
|
|
88
|
+
formItem,
|
|
89
|
+
reactData
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
computed: Object.assign({}, {}),
|
|
93
|
+
methods: {
|
|
94
|
+
renderItem(h, $xeForm, item) {
|
|
95
|
+
const $xeFormItem = this;
|
|
96
|
+
const formProps = $xeForm;
|
|
97
|
+
const formReactData = $xeForm.reactData;
|
|
98
|
+
const { data, rules, readonly, disabled, titleBold: allTitleBold, titleAlign: allTitleAlign, titleWidth: allTitleWidth, titleColon: allTitleColon, titleAsterisk: allTitleAsterisk, titleOverflow: allTitleOverflow, vertical: allVertical, padding: allPadding } = formProps;
|
|
99
|
+
const { collapseAll } = formReactData;
|
|
100
|
+
const validOpts = $xeForm.computeValidOpts;
|
|
101
|
+
const { slots, title, visible, folding, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, vertical, padding, showTitle, contentClassName, contentStyle, titleClassName, titleStyle } = item;
|
|
102
|
+
const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
|
|
103
|
+
const itemClassName = compConf ? (compConf.formItemClassName || compConf.itemClassName) : '';
|
|
104
|
+
const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
|
|
105
|
+
const itemContentClassName = compConf ? (compConf.formItemContentClassName || compConf.itemContentClassName) : '';
|
|
106
|
+
const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
|
|
107
|
+
const itemTitleClassName = compConf ? (compConf.formItemTitleClassName || compConf.itemTitleClassName) : '';
|
|
108
|
+
const itemTitleStyle = compConf ? (compConf.formItemTitleStyle || compConf.itemTitleStyle) : null;
|
|
109
|
+
const defaultSlot = slots ? slots.default : null;
|
|
110
|
+
const titleSlot = slots ? slots.title : null;
|
|
111
|
+
const span = item.span || formProps.span;
|
|
112
|
+
const align = item.align || formProps.align;
|
|
113
|
+
const itemPadding = XEUtils.eqNull(padding) ? allPadding : padding;
|
|
114
|
+
const itemVertical = XEUtils.eqNull(vertical) ? allVertical : vertical;
|
|
115
|
+
const titleBold = XEUtils.eqNull(item.titleBold) ? allTitleBold : item.titleBold;
|
|
116
|
+
const titleAlign = XEUtils.eqNull(item.titleAlign) ? allTitleAlign : item.titleAlign;
|
|
117
|
+
const titleWidth = itemVertical ? null : (XEUtils.eqNull(item.titleWidth) ? allTitleWidth : item.titleWidth);
|
|
118
|
+
const titleColon = XEUtils.eqNull(item.titleColon) ? allTitleColon : item.titleColon;
|
|
119
|
+
const titleAsterisk = XEUtils.eqNull(item.titleAsterisk) ? allTitleAsterisk : item.titleAsterisk;
|
|
120
|
+
const itemOverflow = XEUtils.eqNull(titleOverflow) ? allTitleOverflow : titleOverflow;
|
|
121
|
+
const ovEllipsis = itemOverflow === 'ellipsis';
|
|
122
|
+
const ovTitle = itemOverflow === 'title';
|
|
123
|
+
const ovTooltip = itemOverflow === true || itemOverflow === 'tooltip';
|
|
124
|
+
const hasEllipsis = ovTitle || ovTooltip || ovEllipsis;
|
|
125
|
+
const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeForm.xegrid };
|
|
126
|
+
let isRequired = false;
|
|
127
|
+
let isValid = false;
|
|
128
|
+
if (visible === false) {
|
|
129
|
+
return renderEmptyElement($xeFormItem);
|
|
130
|
+
}
|
|
131
|
+
if (!readonly && rules) {
|
|
132
|
+
const itemRules = rules[field];
|
|
133
|
+
if (itemRules && itemRules.length) {
|
|
134
|
+
isValid = true;
|
|
135
|
+
isRequired = itemRules.some((rule) => rule.required);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
let contentVNs = [];
|
|
139
|
+
const rftContent = compConf ? (compConf.renderFormItemContent || compConf.renderItemContent) : null;
|
|
140
|
+
if (defaultSlot) {
|
|
141
|
+
contentVNs = $xeForm.callSlot(defaultSlot, params);
|
|
142
|
+
}
|
|
143
|
+
else if (rftContent) {
|
|
144
|
+
contentVNs = getSlotVNs(rftContent(h, itemRender, params));
|
|
145
|
+
}
|
|
146
|
+
else if (field) {
|
|
147
|
+
contentVNs = [`${XEUtils.get(data, field)}`];
|
|
148
|
+
}
|
|
149
|
+
if (collapseNode) {
|
|
150
|
+
contentVNs.push(h('div', {
|
|
151
|
+
class: 'vxe-form--item-trigger-node',
|
|
152
|
+
on: {
|
|
153
|
+
click: $xeForm.toggleCollapseEvent
|
|
154
|
+
}
|
|
155
|
+
}, [
|
|
156
|
+
h('span', {
|
|
157
|
+
class: 'vxe-form--item-trigger-text'
|
|
158
|
+
}, collapseAll ? getI18n('vxe.form.unfolding') : getI18n('vxe.form.folding')),
|
|
159
|
+
h('i', {
|
|
160
|
+
class: ['vxe-form--item-trigger-icon', collapseAll ? getIcon().FORM_FOLDING : getIcon().FORM_UNFOLDING]
|
|
161
|
+
})
|
|
162
|
+
]));
|
|
163
|
+
}
|
|
164
|
+
if (errRule && validOpts.showMessage) {
|
|
165
|
+
contentVNs.push(h('div', {
|
|
166
|
+
class: 'vxe-form--item-valid',
|
|
167
|
+
style: errRule.maxWidth
|
|
168
|
+
? {
|
|
169
|
+
width: `${errRule.maxWidth}px`
|
|
170
|
+
}
|
|
171
|
+
: {}
|
|
172
|
+
}, errRule.message));
|
|
173
|
+
}
|
|
174
|
+
const ons = ovTooltip
|
|
175
|
+
? {
|
|
176
|
+
mouseenter(evnt) {
|
|
177
|
+
$xeForm.triggerTitleTipEvent(evnt, params);
|
|
178
|
+
},
|
|
179
|
+
mouseleave: $xeForm.handleTitleTipLeaveEvent
|
|
180
|
+
}
|
|
181
|
+
: {};
|
|
182
|
+
return h('div', {
|
|
183
|
+
ref: 'refElem',
|
|
184
|
+
class: [
|
|
185
|
+
'vxe-form--item',
|
|
186
|
+
item.id,
|
|
187
|
+
span ? `vxe-form--item-col_${span} is--span` : '',
|
|
188
|
+
className ? (XEUtils.isFunction(className) ? className(params) : className) : '',
|
|
189
|
+
itemClassName ? (XEUtils.isFunction(itemClassName) ? itemClassName(params) : itemClassName) : '',
|
|
190
|
+
{
|
|
191
|
+
'is--title': title,
|
|
192
|
+
'is--colon': titleColon,
|
|
193
|
+
'is--bold': titleBold,
|
|
194
|
+
'is--padding': itemPadding,
|
|
195
|
+
'is--vertical': itemVertical,
|
|
196
|
+
'is--asterisk': titleAsterisk,
|
|
197
|
+
'is--valid': isValid,
|
|
198
|
+
'is--required': isRequired,
|
|
199
|
+
'is--hidden': folding && collapseAll,
|
|
200
|
+
'is--active': isActiveItem($xeForm, item),
|
|
201
|
+
'is--error': showError
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
style: XEUtils.isFunction(itemStyle) ? itemStyle(params) : (itemStyle || {})
|
|
205
|
+
}, [
|
|
206
|
+
h('div', {
|
|
207
|
+
class: 'vxe-form--item-inner'
|
|
208
|
+
}, [
|
|
209
|
+
(showTitle !== false) && (title || titleSlot)
|
|
210
|
+
? h('div', {
|
|
211
|
+
class: [
|
|
212
|
+
'vxe-form--item-title',
|
|
213
|
+
titleAlign ? `align--${titleAlign}` : '',
|
|
214
|
+
hasEllipsis ? 'is--ellipsis' : '',
|
|
215
|
+
itemTitleClassName ? (XEUtils.isFunction(itemTitleClassName) ? itemTitleClassName(params) : itemTitleClassName) : '',
|
|
216
|
+
titleClassName ? (XEUtils.isFunction(titleClassName) ? titleClassName(params) : titleClassName) : ''
|
|
217
|
+
],
|
|
218
|
+
style: Object.assign({}, XEUtils.isFunction(itemTitleStyle) ? itemTitleStyle(params) : itemTitleStyle, XEUtils.isFunction(titleStyle) ? titleStyle(params) : titleStyle, titleWidth
|
|
219
|
+
? {
|
|
220
|
+
width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
|
|
221
|
+
}
|
|
222
|
+
: null),
|
|
223
|
+
attrs: {
|
|
224
|
+
title: ovTitle ? getFuncText(title) : null
|
|
225
|
+
},
|
|
226
|
+
on: ons
|
|
227
|
+
}, renderTitle(h, $xeFormItem, $xeForm, item))
|
|
228
|
+
: null,
|
|
229
|
+
h('div', {
|
|
230
|
+
class: [
|
|
231
|
+
'vxe-form--item-content',
|
|
232
|
+
align ? `align--${align}` : '',
|
|
233
|
+
itemContentClassName ? (XEUtils.isFunction(itemContentClassName) ? itemContentClassName(params) : itemContentClassName) : '',
|
|
234
|
+
contentClassName ? (XEUtils.isFunction(contentClassName) ? contentClassName(params) : contentClassName) : ''
|
|
235
|
+
],
|
|
236
|
+
style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
|
|
237
|
+
}, contentVNs)
|
|
238
|
+
])
|
|
239
|
+
]);
|
|
240
|
+
},
|
|
241
|
+
renderVN(h) {
|
|
242
|
+
const $xeFormItem = this;
|
|
243
|
+
const formItem = $xeFormItem.formItem;
|
|
244
|
+
const $xeForm = $xeFormItem.$xeForm;
|
|
245
|
+
const customLayout = $xeForm ? $xeForm.customLayout : false;
|
|
246
|
+
return customLayout
|
|
247
|
+
? $xeFormItem.renderItem(h, $xeForm, formItem)
|
|
248
|
+
: h('div', {
|
|
249
|
+
ref: 'refElem'
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
provide() {
|
|
254
|
+
const $xeFormItem = this;
|
|
255
|
+
const formItem = $xeFormItem.formItem;
|
|
256
|
+
return {
|
|
257
|
+
$xeFormGather: null,
|
|
258
|
+
$xeFormItem,
|
|
259
|
+
xeFormItemInfo: {
|
|
260
|
+
itemConfig: formItem
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
created() {
|
|
265
|
+
const $xeFormItem = this;
|
|
266
|
+
const props = $xeFormItem;
|
|
267
|
+
const $xeForm = $xeFormItem.$xeForm;
|
|
268
|
+
const formItem = createItem($xeForm, props);
|
|
269
|
+
$xeFormItem.formItem = formItem;
|
|
270
|
+
watchItem($xeFormItem, formItemPropKeys, formItem);
|
|
271
|
+
},
|
|
272
|
+
mounted() {
|
|
273
|
+
const $xeFormItem = this;
|
|
274
|
+
const slots = $xeFormItem.$scopedSlots;
|
|
275
|
+
const formItem = $xeFormItem.formItem;
|
|
276
|
+
const $xeForm = $xeFormItem.$xeForm;
|
|
277
|
+
const $xeFormGather = $xeFormItem.$xeFormGather;
|
|
278
|
+
formItem.slots = slots;
|
|
279
|
+
const elem = $xeFormItem.$refs.refElem;
|
|
280
|
+
assembleItem($xeForm, elem, formItem, $xeFormGather);
|
|
281
|
+
},
|
|
282
|
+
beforeDestroy() {
|
|
283
|
+
const $xeFormItem = this;
|
|
284
|
+
const formItem = $xeFormItem.formItem;
|
|
285
|
+
const $xeForm = $xeFormItem.$xeForm;
|
|
286
|
+
destroyItem($xeForm, formItem);
|
|
287
|
+
},
|
|
288
|
+
render(h) {
|
|
289
|
+
return this.renderVN(h);
|
|
290
|
+
}
|
|
291
|
+
});
|