vxe-table 4.2.4-beta.2 → 4.2.4

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 (106) hide show
  1. package/es/all.js +0 -2
  2. package/es/button/style.css +0 -5
  3. package/es/checkbox/src/checkbox.js +6 -0
  4. package/es/checkbox/src/group.js +7 -1
  5. package/es/edit/src/hook.js +35 -4
  6. package/es/form/src/form-config-item.js +152 -0
  7. package/es/form/src/form-gather.js +12 -3
  8. package/es/form/src/form-item.js +22 -3
  9. package/es/form/src/form.js +28 -119
  10. package/es/form/src/itemInfo.js +2 -0
  11. package/es/form/style.css +6 -6
  12. package/es/icon/style.css +10 -9
  13. package/es/input/src/input.js +50 -5
  14. package/es/input/style.css +5 -0
  15. package/es/radio/src/button.js +6 -0
  16. package/es/radio/src/group.js +8 -2
  17. package/es/radio/src/radio.js +6 -0
  18. package/es/select/src/select.js +7 -1
  19. package/es/style.css +1 -1
  20. package/es/style.min.css +1 -1
  21. package/es/switch/src/switch.js +7 -1
  22. package/es/table/src/table.js +3 -2
  23. package/es/textarea/src/textarea.js +7 -1
  24. package/es/tools/log.js +1 -1
  25. package/es/v-x-e-table/index.js +1 -1
  26. package/es/validator/src/hook.js +1 -1
  27. package/lib/all.js +15 -15
  28. package/lib/all.min.js +1 -1
  29. package/lib/button/style/style.css +0 -5
  30. package/lib/button/style/style.min.css +1 -1
  31. package/lib/checkbox/src/checkbox.js +7 -1
  32. package/lib/checkbox/src/checkbox.min.js +1 -1
  33. package/lib/checkbox/src/group.js +7 -1
  34. package/lib/checkbox/src/group.min.js +1 -1
  35. package/lib/edit/src/hook.js +35 -4
  36. package/lib/edit/src/hook.min.js +1 -1
  37. package/lib/form/src/form-config-item.js +212 -0
  38. package/lib/form/src/form-config-item.min.js +1 -0
  39. package/lib/form/src/form-gather.js +14 -3
  40. package/lib/form/src/form-gather.min.js +1 -1
  41. package/lib/form/src/form-item.js +25 -2
  42. package/lib/form/src/form-item.min.js +1 -1
  43. package/lib/form/src/form.js +30 -149
  44. package/lib/form/src/form.min.js +1 -1
  45. package/lib/form/src/itemInfo.js +2 -0
  46. package/lib/form/src/itemInfo.min.js +1 -1
  47. package/lib/form/style/style.css +6 -6
  48. package/lib/form/style/style.min.css +1 -1
  49. package/lib/icon/style/style.css +10 -9
  50. package/lib/icon/style/style.min.css +1 -1
  51. package/lib/index.umd.js +2072 -1839
  52. package/lib/index.umd.min.js +1 -1
  53. package/lib/input/src/input.js +54 -5
  54. package/lib/input/src/input.min.js +1 -1
  55. package/lib/input/style/style.css +5 -0
  56. package/lib/input/style/style.min.css +1 -1
  57. package/lib/radio/src/button.js +7 -1
  58. package/lib/radio/src/button.min.js +1 -1
  59. package/lib/radio/src/group.js +8 -2
  60. package/lib/radio/src/group.min.js +1 -1
  61. package/lib/radio/src/radio.js +7 -1
  62. package/lib/radio/src/radio.min.js +1 -1
  63. package/lib/select/src/select.js +7 -1
  64. package/lib/select/src/select.min.js +1 -1
  65. package/lib/style.css +1 -1
  66. package/lib/style.min.css +1 -1
  67. package/lib/switch/src/switch.js +8 -1
  68. package/lib/switch/src/switch.min.js +1 -1
  69. package/lib/table/src/table.js +4 -2
  70. package/lib/table/src/table.min.js +1 -1
  71. package/lib/textarea/src/textarea.js +7 -1
  72. package/lib/textarea/src/textarea.min.js +1 -1
  73. package/lib/tools/log.js +1 -1
  74. package/lib/tools/log.min.js +1 -1
  75. package/lib/v-x-e-table/index.js +1 -1
  76. package/lib/v-x-e-table/index.min.js +1 -1
  77. package/lib/validator/src/hook.js +1 -1
  78. package/lib/validator/src/hook.min.js +1 -1
  79. package/package.json +2 -2
  80. package/packages/all.ts +0 -2
  81. package/packages/checkbox/src/checkbox.ts +7 -1
  82. package/packages/checkbox/src/group.ts +8 -2
  83. package/packages/edit/src/hook.ts +35 -4
  84. package/packages/form/src/form-config-item.ts +156 -0
  85. package/packages/form/src/form-gather.ts +13 -3
  86. package/packages/form/src/form-item.ts +24 -3
  87. package/packages/form/src/form.ts +28 -126
  88. package/packages/form/src/itemInfo.ts +2 -0
  89. package/packages/input/src/input.ts +54 -6
  90. package/packages/radio/src/button.ts +7 -1
  91. package/packages/radio/src/group.ts +9 -3
  92. package/packages/radio/src/radio.ts +7 -1
  93. package/packages/select/src/select.ts +8 -2
  94. package/packages/switch/src/switch.ts +8 -2
  95. package/packages/table/src/table.ts +3 -2
  96. package/packages/textarea/src/textarea.ts +8 -2
  97. package/packages/validator/src/hook.ts +1 -1
  98. package/styles/button.scss +0 -5
  99. package/styles/form.scss +17 -19
  100. package/styles/icon.scss +10 -9
  101. package/styles/input.scss +4 -0
  102. package/styles/variable.scss +1 -0
  103. package/types/all.d.ts +0 -1
  104. package/types/edit.d.ts +38 -5
  105. package/types/form-item.d.ts +10 -0
  106. package/types/form.d.ts +14 -2
package/es/all.js CHANGED
@@ -7,7 +7,6 @@ import { Edit } from './edit';
7
7
  import { Export } from './export';
8
8
  import { Keyboard } from './keyboard';
9
9
  import { Validator } from './validator';
10
- import { Header } from './header';
11
10
  import { Footer } from './footer';
12
11
  import { Column } from './column';
13
12
  import { Colgroup } from './colgroup';
@@ -38,7 +37,6 @@ import zhCN from './locale/lang/zh-CN';
38
37
  // 按需加载的组件
39
38
  var components = [
40
39
  // 功能模块
41
- Header,
42
40
  Footer,
43
41
  Icon,
44
42
  Filter,
@@ -343,11 +343,6 @@
343
343
  .vxe-button + .vxe-button--dropdown {
344
344
  margin-left: 12px; }
345
345
 
346
- .vxe-button--loading-icon,
347
- .vxe-button--icon,
348
- .vxe-button--content {
349
- vertical-align: middle; }
350
-
351
346
  .vxe-button--loading-icon,
352
347
  .vxe-button--icon {
353
348
  min-width: 14px; }
@@ -22,6 +22,8 @@ export default defineComponent({
22
22
  ],
23
23
  setup: function (props, context) {
24
24
  var slots = context.slots, emit = context.emit;
25
+ var $xeform = inject('$xeform', null);
26
+ var $xeformiteminfo = inject('$xeformiteminfo', null);
25
27
  var xID = XEUtils.uniqueId();
26
28
  var $xecheckbox = {
27
29
  xID: xID,
@@ -50,6 +52,10 @@ export default defineComponent({
50
52
  else {
51
53
  emit('update:modelValue', value);
52
54
  checkboxMethods.dispatchEvent('change', params, evnt);
55
+ // 自动更新校验状态
56
+ if ($xeform && $xeformiteminfo) {
57
+ $xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, value);
58
+ }
53
59
  }
54
60
  }
55
61
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, h, provide } from 'vue';
1
+ import { defineComponent, h, provide, inject } from 'vue';
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf';
3
3
  import XEUtils from 'xe-utils';
4
4
  import { useSize } from '../../hooks/size';
@@ -15,6 +15,8 @@ export default defineComponent({
15
15
  ],
16
16
  setup: function (props, context) {
17
17
  var slots = context.slots, emit = context.emit;
18
+ var $xeform = inject('$xeform', null);
19
+ var $xeformiteminfo = inject('$xeformiteminfo', null);
18
20
  var xID = XEUtils.uniqueId();
19
21
  var $xecheckboxgroup = {
20
22
  xID: xID,
@@ -42,6 +44,10 @@ export default defineComponent({
42
44
  }
43
45
  emit('update:modelValue', checklist);
44
46
  $xecheckboxgroup.dispatchEvent('change', Object.assign({ checklist: checklist }, params), evnt);
47
+ // 自动更新校验状态
48
+ if ($xeform && $xeformiteminfo) {
49
+ $xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, checklist);
50
+ }
45
51
  }
46
52
  };
47
53
  Object.assign($xecheckboxgroup, checkboxGroupMethods, checkboxGroupPrivateMethods);
@@ -461,6 +461,9 @@ var editHook = {
461
461
  return [];
462
462
  },
463
463
  getActiveRecord: function () {
464
+ return this.getEditRecord();
465
+ },
466
+ getEditRecord: function () {
464
467
  var editStore = reactData.editStore;
465
468
  var afterFullData = internalData.afterFullData;
466
469
  var el = refElem.value;
@@ -481,10 +484,17 @@ var editHook = {
481
484
  }
482
485
  return null;
483
486
  },
487
+ clearActived: function (evnt) {
488
+ // if (process.env.NODE_ENV === 'development') {
489
+ // warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit'])
490
+ // }
491
+ // 即将废弃
492
+ return this.clearEdit(evnt);
493
+ },
484
494
  /**
485
495
  * 清除激活的编辑
486
496
  */
487
- clearActived: function (evnt) {
497
+ clearEdit: function (evnt) {
488
498
  var editStore = reactData.editStore;
489
499
  var actived = editStore.actived;
490
500
  var row = actived.row, column = actived.column;
@@ -516,25 +526,46 @@ var editHook = {
516
526
  removeCellSelectedClass();
517
527
  return nextTick();
518
528
  },
529
+ isActiveByRow: function (row) {
530
+ // if (process.env.NODE_ENV === 'development') {
531
+ // warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
532
+ // }
533
+ // 即将废弃
534
+ return this.isEditByRow(row);
535
+ },
519
536
  /**
520
537
  * 判断行是否为激活编辑状态
521
538
  * @param {Row} row 行对象
522
539
  */
523
- isActiveByRow: function (row) {
540
+ isEditByRow: function (row) {
524
541
  var editStore = reactData.editStore;
525
542
  return editStore.actived.row === row;
526
543
  },
544
+ setActiveRow: function (row) {
545
+ // if (process.env.NODE_ENV === 'development') {
546
+ // warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow'])
547
+ // }
548
+ // 即将废弃
549
+ return editMethods.setEditRow(row);
550
+ },
527
551
  /**
528
552
  * 激活行编辑
529
553
  */
530
- setActiveRow: function (row) {
554
+ setEditRow: function (row) {
531
555
  var visibleColumn = internalData.visibleColumn;
532
556
  return $xetable.setActiveCell(row, XEUtils.find(visibleColumn, function (column) { return isEnableConf(column.editRender); }));
533
557
  },
558
+ setActiveCell: function (row, fieldOrColumn) {
559
+ // if (process.env.NODE_ENV === 'development') {
560
+ // warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell'])
561
+ // }
562
+ // 即将废弃
563
+ return editMethods.setEditCell(row, fieldOrColumn);
564
+ },
534
565
  /**
535
566
  * 激活单元格编辑
536
567
  */
537
- setActiveCell: function (row, fieldOrColumn) {
568
+ setEditCell: function (row, fieldOrColumn) {
538
569
  var editConfig = props.editConfig;
539
570
  var column = XEUtils.isString(fieldOrColumn) ? $xetable.getColumnByField(fieldOrColumn) : fieldOrColumn;
540
571
  if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
@@ -0,0 +1,152 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { defineComponent, h, inject, provide, createCommentVNode } from 'vue';
13
+ import XEUtils from 'xe-utils';
14
+ import GlobalConfig from '../../v-x-e-table/src/conf';
15
+ import { VXETable } from '../../v-x-e-table';
16
+ import { getFuncText, isEnableConf } from '../../tools/utils';
17
+ import { renderTitle } from './render';
18
+ var VxeFormConfigItem = defineComponent({
19
+ name: 'VxeFormConfigItem',
20
+ props: {
21
+ itemConfig2: Object,
22
+ itemConfig: Object
23
+ },
24
+ setup: function (props) {
25
+ var $xeform = inject('$xeform', {});
26
+ var xeformiteminfo = { itemConfig: props.itemConfig };
27
+ provide('$xeformiteminfo', xeformiteminfo);
28
+ provide('$xeformgather', null);
29
+ var renderVN = function () {
30
+ var reactData = $xeform.reactData;
31
+ var _a = $xeform.props, data = _a.data, rules = _a.rules, allSpan = _a.span, allAlign = _a.align, allTitleAlign = _a.titleAlign, allTitleWidth = _a.titleWidth, allTitleColon = _a.titleColon, allTitleAsterisk = _a.titleAsterisk, allTitleOverflow = _a.titleOverflow;
32
+ var computeValidOpts = $xeform.getComputeMaps().computeValidOpts;
33
+ var item = props.itemConfig;
34
+ var collapseAll = reactData.collapseAll;
35
+ var validOpts = computeValidOpts.value;
36
+ var slots = item.slots, title = item.title, visible = item.visible, folding = item.folding, visibleMethod = item.visibleMethod, field = item.field, collapseNode = item.collapseNode, itemRender = item.itemRender, showError = item.showError, errRule = item.errRule, className = item.className, titleOverflow = item.titleOverflow, children = item.children;
37
+ var compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null;
38
+ var defaultSlot = slots ? slots.default : null;
39
+ var titleSlot = slots ? slots.title : null;
40
+ var span = item.span || allSpan;
41
+ var align = item.align || allAlign;
42
+ var titleAlign = item.titleAlign || allTitleAlign;
43
+ var titleWidth = item.titleWidth || allTitleWidth;
44
+ var titleColon = item.titleColon === null ? allTitleColon : item.titleColon;
45
+ var titleAsterisk = item.titleAsterisk === null ? allTitleAsterisk : item.titleAsterisk;
46
+ var itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow;
47
+ var showEllipsis = itemOverflow === 'ellipsis';
48
+ var showTitle = itemOverflow === 'title';
49
+ var showTooltip = itemOverflow === true || itemOverflow === 'tooltip';
50
+ var hasEllipsis = showTitle || showTooltip || showEllipsis;
51
+ var itemVisibleMethod = visibleMethod;
52
+ var params = { data: data, field: field, property: field, item: item, $form: $xeform };
53
+ if (visible === false) {
54
+ return createCommentVNode();
55
+ }
56
+ var isRequired = false;
57
+ if (rules) {
58
+ var itemRules = rules[field];
59
+ if (itemRules) {
60
+ isRequired = itemRules.some(function (rule) { return rule.required; });
61
+ }
62
+ }
63
+ // 如果为项集合
64
+ var isGather = children && children.length > 0;
65
+ if (isGather) {
66
+ var childVNs = children.map(function (childItem, index) {
67
+ return h(VxeFormConfigItem, {
68
+ key: index,
69
+ itemConfig: childItem
70
+ });
71
+ });
72
+ return childVNs.length ? h('div', {
73
+ class: ['vxe-form--gather vxe-row', item.id, span ? "vxe-col--" + span + " is--span" : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '']
74
+ }, childVNs) : createCommentVNode();
75
+ }
76
+ if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
77
+ itemVisibleMethod = compConf.itemVisibleMethod;
78
+ }
79
+ var contentVNs = [];
80
+ if (defaultSlot) {
81
+ contentVNs = $xeform.callSlot(defaultSlot, params);
82
+ }
83
+ else if (compConf && compConf.renderItemContent) {
84
+ contentVNs = compConf.renderItemContent(itemRender, params);
85
+ }
86
+ else if (field) {
87
+ contentVNs = ["" + XEUtils.get(data, field)];
88
+ }
89
+ if (collapseNode) {
90
+ contentVNs.push(h('div', {
91
+ class: 'vxe-form--item-trigger-node',
92
+ onClick: $xeform.toggleCollapseEvent
93
+ }, [
94
+ h('span', {
95
+ class: 'vxe-form--item-trigger-text'
96
+ }, collapseAll ? GlobalConfig.i18n('vxe.form.unfolding') : GlobalConfig.i18n('vxe.form.folding')),
97
+ h('i', {
98
+ class: ['vxe-form--item-trigger-icon', collapseAll ? GlobalConfig.icon.FORM_FOLDING : GlobalConfig.icon.FORM_UNFOLDING]
99
+ })
100
+ ]));
101
+ }
102
+ if (errRule && validOpts.showMessage) {
103
+ contentVNs.push(h('div', {
104
+ class: 'vxe-form--item-valid',
105
+ style: errRule.maxWidth ? {
106
+ width: errRule.maxWidth + "px"
107
+ } : null
108
+ }, errRule.content));
109
+ }
110
+ var ons = showTooltip ? {
111
+ onMouseenter: function (evnt) {
112
+ $xeform.triggerTitleTipEvent(evnt, params);
113
+ },
114
+ onMouseleave: $xeform.handleTitleTipLeaveEvent
115
+ } : {};
116
+ return h('div', {
117
+ class: ['vxe-form--item', item.id, span ? "vxe-col--" + span + " is--span" : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
118
+ 'is--title': title,
119
+ 'is--colon': titleColon,
120
+ 'is--asterisk': titleAsterisk,
121
+ 'is--required': isRequired,
122
+ 'is--hidden': folding && collapseAll,
123
+ 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
124
+ 'is--error': showError
125
+ }],
126
+ itemConfig: item,
127
+ key: item.id
128
+ }, [
129
+ h('div', {
130
+ class: 'vxe-form--item-inner'
131
+ }, [
132
+ title || titleSlot ? h('div', __assign({ class: ['vxe-form--item-title', titleAlign ? "align--" + titleAlign : null, {
133
+ 'is--ellipsis': hasEllipsis
134
+ }], style: titleWidth ? {
135
+ width: isNaN(titleWidth) ? titleWidth : titleWidth + "px"
136
+ } : null, title: showTitle ? getFuncText(title) : null }, ons), renderTitle($xeform, item)) : null,
137
+ h('div', {
138
+ class: ['vxe-form--item-content', align ? "align--" + align : null]
139
+ }, contentVNs)
140
+ ])
141
+ ]);
142
+ };
143
+ var $xeformconfigitem = {
144
+ renderVN: renderVN
145
+ };
146
+ return $xeformconfigitem;
147
+ },
148
+ render: function () {
149
+ return this.renderVN();
150
+ }
151
+ });
152
+ export default VxeFormConfigItem;
@@ -9,12 +9,15 @@ export default defineComponent({
9
9
  var slots = _a.slots;
10
10
  var refElem = ref();
11
11
  var $xeform = inject('$xeform', {});
12
- var formGather = inject('xeformgather', null);
12
+ var formGather = inject('$xeformgather', null);
13
13
  var defaultSlot = slots.default;
14
14
  var formItem = reactive(createItem($xeform, props));
15
15
  var xeformitem = { formItem: formItem };
16
+ var xeformiteminfo = { itemConfig: formItem };
16
17
  formItem.children = [];
17
- provide('xeformgather', xeformitem);
18
+ provide('$xeformiteminfo', xeformiteminfo);
19
+ provide('$xeformgather', xeformitem);
20
+ provide('$xeformitem', null);
18
21
  watchItem(props, formItem);
19
22
  onMounted(function () {
20
23
  assemItem($xeform, refElem.value, formItem, formGather);
@@ -34,6 +37,12 @@ export default defineComponent({
34
37
  ref: refElem
35
38
  }, defaultSlot ? defaultSlot() : []);
36
39
  };
37
- return renderVN;
40
+ var $xeformgather = {
41
+ renderVN: renderVN
42
+ };
43
+ return $xeformgather;
44
+ },
45
+ render: function () {
46
+ return this.renderVN();
38
47
  }
39
48
  });
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { defineComponent, h, onUnmounted, inject, ref, onMounted } from 'vue';
12
+ import { defineComponent, h, onUnmounted, inject, ref, provide, onMounted } from 'vue';
13
13
  import XEUtils from 'xe-utils';
14
14
  import GlobalConfig from '../../v-x-e-table/src/conf';
15
15
  import { VXETable } from '../../v-x-e-table';
@@ -23,6 +23,14 @@ export var formItemProps = {
23
23
  align: String,
24
24
  titleAlign: String,
25
25
  titleWidth: [String, Number],
26
+ titleColon: {
27
+ type: Boolean,
28
+ default: null
29
+ },
30
+ titleAsterisk: {
31
+ type: Boolean,
32
+ default: null
33
+ },
26
34
  className: [String, Function],
27
35
  titleOverflow: { type: [Boolean, String], default: null },
28
36
  titlePrefix: Object,
@@ -41,9 +49,14 @@ export default defineComponent({
41
49
  var slots = _a.slots;
42
50
  var refElem = ref();
43
51
  var $xeform = inject('$xeform', {});
44
- var formGather = inject('xeformgather', null);
52
+ var formGather = inject('$xeformgather', null);
45
53
  var formItem = createItem($xeform, props);
54
+ var xeformitem = { formItem: formItem };
55
+ var xeformiteminfo = { itemConfig: formItem };
46
56
  formItem.slots = slots;
57
+ provide('$xeformiteminfo', xeformiteminfo);
58
+ provide('$xeformitem', xeformitem);
59
+ provide('$xeformgather', null);
47
60
  watchItem(props, formItem);
48
61
  onMounted(function () {
49
62
  assemItem($xeform, refElem.value, formItem, formGather);
@@ -149,6 +162,12 @@ export default defineComponent({
149
162
  ref: refElem
150
163
  });
151
164
  };
152
- return renderVN;
165
+ var $xeformitem = {
166
+ renderVN: renderVN
167
+ };
168
+ return $xeformitem;
169
+ },
170
+ render: function () {
171
+ return this.renderVN();
153
172
  }
154
173
  });
@@ -17,8 +17,8 @@ import { getFuncText, isEnableConf, eqEmptyValue } from '../../tools/utils';
17
17
  import { errLog } from '../../tools/log';
18
18
  import { scrollToView } from '../../tools/dom';
19
19
  import { createItem, handleFieldOrItem } from './util';
20
- import { renderTitle } from './render';
21
20
  import { useSize } from '../../hooks/size';
21
+ import VxeFormConfigItem from './form-config-item';
22
22
  var Rule = /** @class */ (function () {
23
23
  function Rule(rule) {
24
24
  Object.assign(this, {
@@ -319,7 +319,7 @@ export default defineComponent({
319
319
  }
320
320
  else {
321
321
  var isArrType = type === 'array';
322
- var hasEmpty = isArrType ? (!XEUtils.isArray(itemValue_1) || !itemValue_1.length) : eqEmptyValue(itemValue_1);
322
+ var hasEmpty = isArrType || XEUtils.isArray(itemValue_1) ? (!XEUtils.isArray(itemValue_1) || !itemValue_1.length) : eqEmptyValue(itemValue_1);
323
323
  if (required ? (hasEmpty || validErrorRuleValue(rule, itemValue_1)) : (!hasEmpty && validErrorRuleValue(rule, itemValue_1))) {
324
324
  errorRules.push(new Rule(rule));
325
325
  }
@@ -470,130 +470,31 @@ export default defineComponent({
470
470
  closeTooltip();
471
471
  }
472
472
  };
473
- /**
474
- * 更新项状态
475
- * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
476
- * 如果单元格配置了校验规则,则会进行校验
477
- */
478
- var updateStatus = function (scope, itemValue) {
479
- var property = scope.property;
480
- if (property) {
481
- validItemRules('change', property, itemValue)
473
+ var triggerItemEvent = function (evnt, field, itemValue) {
474
+ if (field) {
475
+ return validItemRules(evnt ? evnt.type : 'all', field, itemValue)
482
476
  .then(function () {
483
- clearValidate(property);
477
+ clearValidate(field);
484
478
  })
485
479
  .catch(function (_a) {
486
480
  var rule = _a.rule;
487
- var item = getItemByField(property);
481
+ var item = getItemByField(field);
488
482
  if (item) {
489
483
  item.showError = true;
490
484
  item.errRule = rule;
491
485
  }
492
486
  });
493
487
  }
488
+ return nextTick();
494
489
  };
495
- var renderItems = function (itemList) {
496
- var data = props.data, rules = props.rules, allTitleOverflow = props.titleOverflow;
497
- var collapseAll = reactData.collapseAll;
498
- var validOpts = computeValidOpts.value;
499
- return itemList.map(function (item) {
500
- var slots = item.slots, title = item.title, visible = item.visible, folding = item.folding, visibleMethod = item.visibleMethod, field = item.field, collapseNode = item.collapseNode, itemRender = item.itemRender, showError = item.showError, errRule = item.errRule, className = item.className, titleOverflow = item.titleOverflow, children = item.children;
501
- var compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null;
502
- var defaultSlot = slots ? slots.default : null;
503
- var titleSlot = slots ? slots.title : null;
504
- var span = item.span || props.span;
505
- var align = item.align || props.align;
506
- var titleAlign = item.titleAlign || props.titleAlign;
507
- var titleWidth = item.titleWidth || props.titleWidth;
508
- var itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow;
509
- var showEllipsis = itemOverflow === 'ellipsis';
510
- var showTitle = itemOverflow === 'title';
511
- var showTooltip = itemOverflow === true || itemOverflow === 'tooltip';
512
- var hasEllipsis = showTitle || showTooltip || showEllipsis;
513
- var itemVisibleMethod = visibleMethod;
514
- var params = { data: data, field: field, property: field, item: item, $form: $xeform };
515
- if (visible === false) {
516
- return createCommentVNode();
517
- }
518
- var isRequired = false;
519
- if (rules) {
520
- var itemRules = rules[field];
521
- if (itemRules) {
522
- isRequired = itemRules.some(function (rule) { return rule.required; });
523
- }
524
- }
525
- // 如果为项集合
526
- var isGather = children && children.length > 0;
527
- if (isGather) {
528
- var childVNs = renderItems(item.children);
529
- return childVNs.length ? h('div', {
530
- class: ['vxe-form--gather vxe-row', item.id, span ? "vxe-col--" + span + " is--span" : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '']
531
- }, childVNs) : createCommentVNode();
532
- }
533
- if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
534
- itemVisibleMethod = compConf.itemVisibleMethod;
535
- }
536
- var contentVNs = [];
537
- if (defaultSlot) {
538
- contentVNs = callSlot(defaultSlot, params);
539
- }
540
- else if (compConf && compConf.renderItemContent) {
541
- contentVNs = compConf.renderItemContent(itemRender, params);
542
- }
543
- else if (field) {
544
- contentVNs = ["" + XEUtils.get(data, field)];
545
- }
546
- if (collapseNode) {
547
- contentVNs.push(h('div', {
548
- class: 'vxe-form--item-trigger-node',
549
- onClick: toggleCollapseEvent
550
- }, [
551
- h('span', {
552
- class: 'vxe-form--item-trigger-text'
553
- }, collapseAll ? GlobalConfig.i18n('vxe.form.unfolding') : GlobalConfig.i18n('vxe.form.folding')),
554
- h('i', {
555
- class: ['vxe-form--item-trigger-icon', collapseAll ? GlobalConfig.icon.FORM_FOLDING : GlobalConfig.icon.FORM_UNFOLDING]
556
- })
557
- ]));
558
- }
559
- if (errRule && validOpts.showMessage) {
560
- contentVNs.push(h('div', {
561
- class: 'vxe-form--item-valid',
562
- style: errRule.maxWidth ? {
563
- width: errRule.maxWidth + "px"
564
- } : null
565
- }, errRule.content));
566
- }
567
- var ons = showTooltip ? {
568
- onMouseenter: function (evnt) {
569
- triggerTitleTipEvent(evnt, params);
570
- },
571
- onMouseleave: handleTitleTipLeaveEvent
572
- } : {};
573
- return h('div', {
574
- class: ['vxe-form--item', item.id, span ? "vxe-col--" + span + " is--span" : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
575
- 'is--title': title,
576
- 'is--required': isRequired,
577
- 'is--hidden': folding && collapseAll,
578
- 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
579
- 'is--error': showError
580
- }],
581
- key: item.id
582
- }, [
583
- h('div', {
584
- class: 'vxe-form--item-inner'
585
- }, [
586
- title || titleSlot ? h('div', __assign({ class: ['vxe-form--item-title', titleAlign ? "align--" + titleAlign : null, {
587
- 'is--ellipsis': hasEllipsis
588
- }], style: titleWidth ? {
589
- width: isNaN(titleWidth) ? titleWidth : titleWidth + "px"
590
- } : null, title: showTitle ? getFuncText(title) : null }, ons), renderTitle($xeform, item)) : null,
591
- h('div', {
592
- class: ['vxe-form--item-content', align ? "align--" + align : null]
593
- }, contentVNs)
594
- ])
595
- ]);
596
- });
490
+ /**
491
+ * 更新项状态
492
+ * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
493
+ * 如果单元格配置了校验规则,则会进行校验
494
+ */
495
+ var updateStatus = function (scope, itemValue) {
496
+ var field = scope.field;
497
+ return triggerItemEvent(new Event('change'), field, itemValue);
597
498
  };
598
499
  formMethods = {
599
500
  dispatchEvent: function (type, params, evnt) {
@@ -611,6 +512,7 @@ export default defineComponent({
611
512
  };
612
513
  var formPrivateMethods = {
613
514
  callSlot: callSlot,
515
+ triggerItemEvent: triggerItemEvent,
614
516
  toggleCollapseEvent: toggleCollapseEvent,
615
517
  triggerTitleTipEvent: triggerTitleTipEvent,
616
518
  handleTitleTipLeaveEvent: handleTitleTipLeaveEvent
@@ -637,7 +539,7 @@ export default defineComponent({
637
539
  });
638
540
  var renderVN = function () {
639
541
  var _a;
640
- var loading = props.loading, className = props.className, data = props.data, titleColon = props.titleColon, titleAsterisk = props.titleAsterisk, customLayout = props.customLayout;
542
+ var loading = props.loading, className = props.className, data = props.data, customLayout = props.customLayout;
641
543
  var formItems = reactData.formItems;
642
544
  // const formItems: any[] = []
643
545
  var vSize = computeSize.value;
@@ -647,8 +549,6 @@ export default defineComponent({
647
549
  ref: refElem,
648
550
  class: ['vxe-form', className ? (XEUtils.isFunction(className) ? className({ items: formItems, data: data, $form: $xeform }) : className) : '', (_a = {},
649
551
  _a["size--" + vSize] = vSize,
650
- _a['is--colon'] = titleColon,
651
- _a['is--asterisk'] = titleAsterisk,
652
552
  _a['is--loading'] = loading,
653
553
  _a)],
654
554
  onSubmit: submitEvent,
@@ -656,7 +556,13 @@ export default defineComponent({
656
556
  }, [
657
557
  h('div', {
658
558
  class: 'vxe-form--wrapper vxe-row'
659
- }, customLayout ? (defaultSlot ? defaultSlot({}) : []) : renderItems(formItems)),
559
+ }, customLayout ? (defaultSlot ? defaultSlot({}) : []) : formItems.map(function (item, index) {
560
+ return h(VxeFormConfigItem, {
561
+ key: index,
562
+ itemConfig2: item,
563
+ itemConfig: item
564
+ });
565
+ })),
660
566
  h('div', {
661
567
  class: 'vxe-form-slots',
662
568
  ref: 'hideItem'
@@ -678,6 +584,9 @@ export default defineComponent({
678
584
  };
679
585
  $xeform.renderVN = renderVN;
680
586
  provide('$xeform', $xeform);
587
+ provide('$xeformgather', null);
588
+ provide('$xeformitem', null);
589
+ provide('$xeformiteminfo', null);
681
590
  return $xeform;
682
591
  },
683
592
  render: function () {
@@ -9,6 +9,8 @@ var ItemInfo = /** @class */ (function () {
9
9
  align: item.align,
10
10
  titleAlign: item.titleAlign,
11
11
  titleWidth: item.titleWidth,
12
+ titleColon: item.titleColon,
13
+ titleAsterisk: item.titleAsterisk,
12
14
  titlePrefix: item.titlePrefix,
13
15
  titleSuffix: item.titleSuffix,
14
16
  titleOverflow: item.titleOverflow,
package/es/form/style.css CHANGED
@@ -112,7 +112,12 @@
112
112
  .vxe-form .vxe-form--item.is--active:not(.is--hidden) {
113
113
  display: inline-block; }
114
114
 
115
- .vxe-form.is--asterisk .vxe-form--item.is--required .vxe-form--item-title-content:before {
115
+ .vxe-form--item.is--colon .vxe-form--item-title-postfix:after {
116
+ content: ":";
117
+ font-weight: normal;
118
+ margin-left: 0.2em; }
119
+
120
+ .vxe-form--item.is--asterisk.is--required .vxe-form--item-title-content:before {
116
121
  content: "*";
117
122
  color: #f56c6c;
118
123
  font-family: Verdana,Arial,Tahoma;
@@ -120,11 +125,6 @@
120
125
  font-weight: normal;
121
126
  vertical-align: middle; }
122
127
 
123
- .vxe-form.is--colon .vxe-form--item-title-postfix:after {
124
- content: ":";
125
- font-weight: normal;
126
- margin-left: 0.2em; }
127
-
128
128
  .vxe-form--item.is--span .vxe-default-input:not([type="submit"]):not([type="reset"]),
129
129
  .vxe-form--item.is--span .vxe-default-textarea,
130
130
  .vxe-form--item.is--span .vxe-default-select,