vxe-pc-ui 3.0.16 → 3.1.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.
Files changed (154) hide show
  1. package/README.md +1 -1
  2. package/es/components.js +3 -0
  3. package/es/date-picker/src/date-picker.js +18 -4
  4. package/es/drawer/src/drawer.js +18 -2
  5. package/es/form/src/form-config-item.js +26 -157
  6. package/es/form/src/form-group.js +104 -0
  7. package/es/form/src/form-item.js +43 -143
  8. package/es/form/src/form.js +15 -2
  9. package/es/form/src/itemInfo.js +3 -0
  10. package/es/form/src/render.js +184 -19
  11. package/es/form/src/util.js +2 -2
  12. package/es/form/style.css +139 -70
  13. package/es/form/style.min.css +1 -1
  14. package/es/form-gather/index.js +2 -1
  15. package/es/form-group/index.js +12 -0
  16. package/es/form-group/style.css +0 -0
  17. package/es/form-group/style.min.css +0 -0
  18. package/es/icon/style.css +1 -1
  19. package/es/menu/src/menu.js +211 -62
  20. package/es/menu/style.css +25 -4
  21. package/es/menu/style.min.css +1 -1
  22. package/es/modal/src/modal.js +18 -2
  23. package/es/password-input/src/password-input.js +10 -10
  24. package/es/password-input/style.css +199 -199
  25. package/es/password-input/style.min.css +1 -1
  26. package/es/style.css +1 -1
  27. package/es/style.min.css +1 -1
  28. package/es/ui/index.js +10 -3
  29. package/es/ui/src/dom.js +1 -1
  30. package/es/ui/src/log.js +1 -1
  31. package/es/vxe-form/style.css +139 -70
  32. package/es/vxe-form/style.min.css +1 -1
  33. package/es/vxe-form-group/index.js +3 -0
  34. package/es/vxe-form-group/style.css +0 -0
  35. package/es/vxe-form-group/style.min.css +0 -0
  36. package/es/vxe-menu/style.css +25 -4
  37. package/es/vxe-menu/style.min.css +1 -1
  38. package/es/vxe-password-input/style.css +199 -199
  39. package/es/vxe-password-input/style.min.css +1 -1
  40. package/helper/vetur/attributes.json +1 -1
  41. package/helper/vetur/tags.json +1 -1
  42. package/lib/components.js +13 -1
  43. package/lib/components.min.js +1 -1
  44. package/lib/date-picker/src/date-picker.js +17 -4
  45. package/lib/date-picker/src/date-picker.min.js +1 -1
  46. package/lib/drawer/src/drawer.js +22 -2
  47. package/lib/drawer/src/drawer.min.js +1 -1
  48. package/lib/form/src/form-config-item.js +20 -146
  49. package/lib/form/src/form-config-item.min.js +1 -1
  50. package/lib/form/src/form-group.js +120 -0
  51. package/lib/form/src/form-group.min.js +1 -0
  52. package/lib/form/src/form-item.js +35 -130
  53. package/lib/form/src/form-item.min.js +1 -1
  54. package/lib/form/src/form.js +21 -2
  55. package/lib/form/src/form.min.js +1 -1
  56. package/lib/form/src/itemInfo.js +3 -0
  57. package/lib/form/src/itemInfo.min.js +1 -1
  58. package/lib/form/src/render.js +209 -8
  59. package/lib/form/src/render.min.js +1 -1
  60. package/lib/form/src/util.js +2 -2
  61. package/lib/form/style/style.css +139 -70
  62. package/lib/form/style/style.min.css +1 -1
  63. package/lib/form-gather/index.js +7 -4
  64. package/lib/form-gather/index.min.js +1 -1
  65. package/lib/form-group/index.js +19 -0
  66. package/lib/form-group/index.min.js +1 -0
  67. package/lib/form-group/style/index.js +1 -0
  68. package/lib/form-group/style/style.css +0 -0
  69. package/lib/form-group/style/style.min.css +0 -0
  70. package/lib/icon/style/style.css +1 -1
  71. package/lib/icon/style/style.min.css +1 -1
  72. package/lib/index.umd.js +669 -423
  73. package/lib/index.umd.min.js +1 -1
  74. package/lib/menu/src/menu.js +203 -64
  75. package/lib/menu/src/menu.min.js +1 -1
  76. package/lib/menu/style/style.css +25 -4
  77. package/lib/menu/style/style.min.css +1 -1
  78. package/lib/modal/src/modal.js +22 -2
  79. package/lib/modal/src/modal.min.js +1 -1
  80. package/lib/password-input/src/password-input.js +10 -10
  81. package/lib/password-input/src/password-input.min.js +1 -1
  82. package/lib/password-input/style/style.css +199 -199
  83. package/lib/password-input/style/style.min.css +1 -1
  84. package/lib/style.css +1 -1
  85. package/lib/style.min.css +1 -1
  86. package/lib/ui/index.js +10 -3
  87. package/lib/ui/index.min.js +1 -1
  88. package/lib/ui/src/dom.js +1 -1
  89. package/lib/ui/src/dom.min.js +1 -1
  90. package/lib/ui/src/log.js +1 -1
  91. package/lib/ui/src/log.min.js +1 -1
  92. package/lib/vxe-form/style/style.css +139 -70
  93. package/lib/vxe-form/style/style.min.css +1 -1
  94. package/lib/vxe-form-group/index.js +23 -0
  95. package/lib/vxe-form-group/index.min.js +1 -0
  96. package/lib/vxe-form-group/style/index.js +1 -0
  97. package/lib/vxe-form-group/style/style.css +0 -0
  98. package/lib/vxe-form-group/style/style.min.css +0 -0
  99. package/lib/vxe-menu/style/style.css +25 -4
  100. package/lib/vxe-menu/style/style.min.css +1 -1
  101. package/lib/vxe-password-input/style/style.css +199 -199
  102. package/lib/vxe-password-input/style/style.min.css +1 -1
  103. package/package.json +1 -1
  104. package/packages/components.ts +3 -0
  105. package/packages/date-picker/src/date-picker.ts +18 -4
  106. package/packages/drawer/src/drawer.ts +18 -2
  107. package/packages/form/src/form-config-item.ts +28 -165
  108. package/packages/form/src/form-group.ts +121 -0
  109. package/packages/form/src/form-item.ts +48 -160
  110. package/packages/form/src/form.ts +15 -2
  111. package/packages/form/src/itemInfo.ts +3 -0
  112. package/packages/form/src/render.ts +199 -20
  113. package/packages/form/src/util.ts +4 -4
  114. package/packages/form-gather/index.ts +3 -1
  115. package/packages/form-group/index.ts +16 -0
  116. package/packages/menu/src/menu.ts +220 -65
  117. package/packages/modal/src/modal.ts +18 -2
  118. package/packages/password-input/src/password-input.ts +10 -10
  119. package/packages/ui/index.ts +9 -2
  120. package/packages/ui/src/dom.ts +1 -1
  121. package/styles/all.scss +1 -0
  122. package/styles/components/form-group.scss +0 -0
  123. package/styles/components/form.scss +219 -65
  124. package/styles/components/menu.scss +26 -8
  125. package/styles/components/password-input.scss +70 -70
  126. package/styles/theme/base.scss +4 -4
  127. package/styles/theme/dark.scss +6 -1
  128. package/styles/theme/light.scss +5 -1
  129. package/types/all.d.ts +3 -0
  130. package/types/components/date-picker.d.ts +2 -0
  131. package/types/components/drawer.d.ts +4 -0
  132. package/types/components/form-group.d.ts +63 -0
  133. package/types/components/form-item.d.ts +12 -0
  134. package/types/components/form.d.ts +9 -0
  135. package/types/components/grid.d.ts +11 -0
  136. package/types/components/menu.d.ts +6 -0
  137. package/types/components/modal.d.ts +4 -0
  138. package/types/ui/global-config.d.ts +2 -0
  139. package/es/form/src/form-gather.js +0 -87
  140. package/lib/form/src/form-gather.js +0 -99
  141. package/lib/form/src/form-gather.min.js +0 -1
  142. package/packages/form/src/form-gather.ts +0 -104
  143. /package/es/icon/style/{iconfont.1726713527185.ttf → iconfont.1727060767813.ttf} +0 -0
  144. /package/es/icon/style/{iconfont.1726713527185.woff → iconfont.1727060767813.woff} +0 -0
  145. /package/es/icon/style/{iconfont.1726713527185.woff2 → iconfont.1727060767813.woff2} +0 -0
  146. /package/es/{iconfont.1726713527185.ttf → iconfont.1727060767813.ttf} +0 -0
  147. /package/es/{iconfont.1726713527185.woff → iconfont.1727060767813.woff} +0 -0
  148. /package/es/{iconfont.1726713527185.woff2 → iconfont.1727060767813.woff2} +0 -0
  149. /package/lib/icon/style/{iconfont.1726713527185.ttf → iconfont.1727060767813.ttf} +0 -0
  150. /package/lib/icon/style/{iconfont.1726713527185.woff → iconfont.1727060767813.woff} +0 -0
  151. /package/lib/icon/style/{iconfont.1726713527185.woff2 → iconfont.1727060767813.woff2} +0 -0
  152. /package/lib/{iconfont.1726713527185.ttf → iconfont.1727060767813.ttf} +0 -0
  153. /package/lib/{iconfont.1726713527185.woff → iconfont.1727060767813.woff} +0 -0
  154. /package/lib/{iconfont.1726713527185.woff2 → iconfont.1727060767813.woff2} +0 -0
package/README.md CHANGED
@@ -46,7 +46,7 @@
46
46
  * [ ] flow-view 流程设计器-视图渲染
47
47
  * [x] form 表单
48
48
  * [x] form-design 表单设计器
49
- * [x] form-gather 表单-容器
49
+ * [x] form-group 表单-分组
50
50
  * [x] form-item 表单-项
51
51
  * [x] form-view 表单设计器-视图渲染
52
52
  * [x] icon 图标
package/es/components.js CHANGED
@@ -22,6 +22,7 @@ import VxeDrawer, { DrawerController } from './drawer';
22
22
  import VxeForm from './form';
23
23
  // import VxeFormDesign from './form-design'
24
24
  import VxeFormGather from './form-gather';
25
+ import VxeFormGroup from './form-group';
25
26
  import VxeFormItem from './form-item';
26
27
  // import VxeFormView from './form-view'
27
28
  import VxeIcon from './icon';
@@ -91,6 +92,7 @@ const components = [
91
92
  VxeForm,
92
93
  // VxeFormDesign,
93
94
  VxeFormGather,
95
+ VxeFormGroup,
94
96
  VxeFormItem,
95
97
  // VxeFormView,
96
98
  VxeIcon,
@@ -176,6 +178,7 @@ export * from './drawer';
176
178
  export * from './form';
177
179
  // export * from './form-design'
178
180
  export * from './form-gather';
181
+ export * from './form-group';
179
182
  export * from './form-item';
180
183
  // export * from './form-view'
181
184
  export * from './icon';
@@ -666,6 +666,20 @@ export default defineVxeComponent({
666
666
  reactData.isActivated = false;
667
667
  return $xeDatePicker.$nextTick();
668
668
  },
669
+ updateModelValue(modelValue) {
670
+ const $xeDatePicker = this;
671
+ const reactData = $xeDatePicker.reactData;
672
+ let val = '';
673
+ if (modelValue) {
674
+ if (XEUtils.isNumber(modelValue) && /^[0-9]{11,15}$/.test(`${modelValue}`)) {
675
+ val = new Date(modelValue);
676
+ }
677
+ else {
678
+ val = modelValue;
679
+ }
680
+ }
681
+ reactData.inputValue = val;
682
+ },
669
683
  parseDate(value, format) {
670
684
  const $xeDatePicker = this;
671
685
  const props = $xeDatePicker;
@@ -824,7 +838,9 @@ export default defineVxeComponent({
824
838
  */
825
839
  initValue() {
826
840
  const $xeDatePicker = this;
841
+ const props = $xeDatePicker;
827
842
  const isDatePickerType = $xeDatePicker.computeIsDatePickerType;
843
+ $xeDatePicker.updateModelValue(props.value);
828
844
  if (isDatePickerType) {
829
845
  $xeDatePicker.changeValue();
830
846
  }
@@ -2361,17 +2377,15 @@ export default defineVxeComponent({
2361
2377
  watch: {
2362
2378
  value(val) {
2363
2379
  const $xeDatePicker = this;
2364
- const reactData = $xeDatePicker.reactData;
2365
- reactData.inputValue = val;
2380
+ $xeDatePicker.updateModelValue(val);
2366
2381
  $xeDatePicker.changeValue();
2367
2382
  },
2368
2383
  type() {
2369
2384
  const $xeDatePicker = this;
2370
- const props = $xeDatePicker;
2371
2385
  const reactData = $xeDatePicker.reactData;
2372
2386
  // 切换类型是重置内置变量
2373
2387
  Object.assign(reactData, {
2374
- inputValue: props.value,
2388
+ inputValue: '',
2375
2389
  datetimePanelValue: null,
2376
2390
  datePanelValue: null,
2377
2391
  datePanelLabel: '',
@@ -43,6 +43,14 @@ export default defineVxeComponent({
43
43
  type: Boolean,
44
44
  default: () => getConfig().drawer.escClosable
45
45
  },
46
+ cancelClosable: {
47
+ type: Boolean,
48
+ default: () => getConfig().drawer.cancelClosable
49
+ },
50
+ confirmClosable: {
51
+ type: Boolean,
52
+ default: () => getConfig().drawer.confirmClosable
53
+ },
46
54
  showHeader: {
47
55
  type: Boolean,
48
56
  default: () => getConfig().drawer.showHeader
@@ -214,15 +222,23 @@ export default defineVxeComponent({
214
222
  },
215
223
  confirmEvent(evnt) {
216
224
  const $xeDrawer = this;
225
+ const props = $xeDrawer;
226
+ const { confirmClosable } = props;
217
227
  const type = 'confirm';
218
228
  $xeDrawer.dispatchEvent(type, { type }, evnt);
219
- $xeDrawer.closeDrawer(type);
229
+ if (confirmClosable) {
230
+ $xeDrawer.closeDrawer(type);
231
+ }
220
232
  },
221
233
  cancelEvent(evnt) {
222
234
  const $xeDrawer = this;
235
+ const props = $xeDrawer;
236
+ const { cancelClosable } = props;
223
237
  const type = 'cancel';
224
238
  $xeDrawer.dispatchEvent(type, { type }, evnt);
225
- $xeDrawer.closeDrawer(type);
239
+ if (cancelClosable) {
240
+ $xeDrawer.closeDrawer(type);
241
+ }
226
242
  },
227
243
  openDrawer() {
228
244
  const $xeDrawer = this;
@@ -1,10 +1,8 @@
1
1
  import { defineVxeComponent } from '../../ui/src/comp';
2
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';
3
+ import { renderer, globalMixins, renderEmptyElement } from '../../ui';
4
+ import { isEnableConf } from '../../ui/src/utils';
5
+ import { renderTitle, getItemClass, getItemContentClass, renderItemContent } from './render';
8
6
  const VxeFormConfigItem = defineVxeComponent({
9
7
  name: 'VxeFormConfigItem',
10
8
  mixins: [
@@ -22,176 +20,47 @@ const VxeFormConfigItem = defineVxeComponent({
22
20
  const xeFormItemInfo = this;
23
21
  return {
24
22
  xeFormItemInfo,
25
- $xeFormGather: null
23
+ $xeFormGroup: null
26
24
  };
27
25
  },
28
26
  computed: Object.assign({}, {}),
29
27
  methods: {
30
- renderVN(h) {
28
+ renderItem(h, $xeForm, item) {
31
29
  const $xeFormConfigItem = this;
32
- const props = $xeFormConfigItem;
33
- const $xeForm = $xeFormConfigItem.$xeForm;
34
30
  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;
31
+ const { data, readonly, disabled } = formProps;
32
+ const { visible, field, itemRender, contentStyle, children, showContent } = item;
41
33
  const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
42
- const itemClassName = compConf ? (compConf.formItemClassName || compConf.itemClassName) : '';
43
34
  const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
44
- const itemContentClassName = compConf ? (compConf.formItemContentClassName || compConf.itemContentClassName) : '';
45
35
  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
36
  const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeForm.xegrid };
37
+ const hasGroup = children && children.length > 0;
65
38
  if (visible === false) {
66
39
  return renderEmptyElement($xeFormConfigItem);
67
40
  }
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, h);
98
- }
99
- else if (rftContent) {
100
- contentVNs = getSlotVNs(rftContent.call($xeForm, 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
41
  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
- ],
42
+ key: item.id,
43
+ class: getItemClass($xeForm, item),
159
44
  style: XEUtils.isFunction(itemStyle) ? itemStyle(params) : (itemStyle || {})
160
45
  }, [
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
- ],
46
+ renderTitle(h, $xeForm, item),
47
+ showContent === false
48
+ ? renderEmptyElement($xeFormConfigItem)
49
+ : h('div', {
50
+ class: getItemContentClass($xeForm, item),
191
51
  style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
192
- }, contentVNs)
193
- ])
52
+ }, hasGroup
53
+ ? children.map((childItem) => $xeFormConfigItem.renderItem(h, $xeForm, childItem))
54
+ : [
55
+ renderItemContent(h, $xeForm, item)
56
+ ])
194
57
  ]);
58
+ },
59
+ renderVN(h) {
60
+ const $xeFormConfigItem = this;
61
+ const props = $xeFormConfigItem;
62
+ const $xeForm = $xeFormConfigItem.$xeForm;
63
+ return $xeFormConfigItem.renderItem(h, $xeForm, props.itemConfig);
195
64
  }
196
65
  },
197
66
  render(h) {
@@ -0,0 +1,104 @@
1
+ import { defineVxeComponent } from '../../ui/src/comp';
2
+ import XEUtils from 'xe-utils';
3
+ import { renderer, globalMixins, renderEmptyElement } from '../../ui';
4
+ import { isEnableConf } from '../../ui/src/utils';
5
+ import { createItem, watchItem, destroyItem, assembleItem } from './util';
6
+ import { formItemProps } from './form-item';
7
+ import { renderTitle, getItemClass, getItemContentClass } from './render';
8
+ const formItemPropKeys = Object.keys(formItemProps);
9
+ export default defineVxeComponent({
10
+ name: 'VxeFormGroup',
11
+ mixins: [
12
+ globalMixins.sizeMixin
13
+ ],
14
+ props: formItemProps,
15
+ inject: {
16
+ $xeForm: {
17
+ default: null
18
+ },
19
+ $xeParentFormGroup: {
20
+ from: '$xeFormGroup',
21
+ default: null
22
+ }
23
+ },
24
+ data() {
25
+ const xID = XEUtils.uniqueId();
26
+ const formItem = {};
27
+ const reactData = {};
28
+ return {
29
+ xID,
30
+ formItem,
31
+ reactData
32
+ };
33
+ },
34
+ computed: Object.assign({}, {}),
35
+ methods: {
36
+ renderVN(h) {
37
+ const $xeFormGroup = this;
38
+ const slots = $xeFormGroup.$scopedSlots;
39
+ const formItem = $xeFormGroup.formItem;
40
+ const $xeForm = $xeFormGroup.$xeForm;
41
+ const formProps = $xeForm;
42
+ const item = formItem;
43
+ const { data, readonly, disabled } = formProps;
44
+ const { visible, field, itemRender, contentStyle } = item;
45
+ const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
46
+ const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
47
+ const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
48
+ const defaultSlot = slots ? slots.default : null;
49
+ const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeForm.xegrid };
50
+ if (visible === false) {
51
+ return renderEmptyElement($xeFormGroup);
52
+ }
53
+ return h('div', {
54
+ ref: 'refElem',
55
+ key: item.id,
56
+ class: getItemClass($xeForm, item, true),
57
+ style: XEUtils.isFunction(itemStyle) ? itemStyle(params) : (itemStyle || {})
58
+ }, [
59
+ renderTitle(h, $xeForm, item, true),
60
+ h('div', {
61
+ class: getItemContentClass($xeForm, item, true),
62
+ style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
63
+ }, defaultSlot ? defaultSlot({}) : [])
64
+ ]);
65
+ }
66
+ },
67
+ provide() {
68
+ const $xeFormGroup = this;
69
+ const formItem = $xeFormGroup.formItem;
70
+ return {
71
+ $xeFormGroup,
72
+ $xeFormItem: null,
73
+ xeFormItemInfo: {
74
+ itemConfig: formItem
75
+ }
76
+ };
77
+ },
78
+ created() {
79
+ const $xeFormGroup = this;
80
+ const props = $xeFormGroup;
81
+ const $xeForm = $xeFormGroup.$xeForm;
82
+ const formItem = createItem($xeForm, props);
83
+ formItem.children = [];
84
+ $xeFormGroup.formItem = formItem;
85
+ watchItem($xeFormGroup, formItemPropKeys, formItem);
86
+ },
87
+ mounted() {
88
+ const $xeFormGroup = this;
89
+ const formItem = $xeFormGroup.formItem;
90
+ const $xeForm = $xeFormGroup.$xeForm;
91
+ const $xeParentFormGroup = $xeFormGroup.$xeParentFormGroup;
92
+ const elem = $xeFormGroup.$refs.refElem;
93
+ assembleItem($xeForm, elem, formItem, $xeParentFormGroup);
94
+ },
95
+ beforeDestroy() {
96
+ const $xeFormGroup = this;
97
+ const formItem = $xeFormGroup.formItem;
98
+ const $xeForm = $xeFormGroup.$xeForm;
99
+ destroyItem($xeForm, formItem);
100
+ },
101
+ render(h) {
102
+ return this.renderVN(h);
103
+ }
104
+ });