vxe-pc-ui 4.8.11 → 4.8.13

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 (66) hide show
  1. package/README.md +4 -4
  2. package/es/form/index.js +0 -1
  3. package/es/form/src/form-config-item.js +1 -0
  4. package/es/form/src/form-group.js +1 -0
  5. package/es/form/src/form-item.js +1 -0
  6. package/es/form/src/form.js +67 -9
  7. package/es/form/src/render.js +5 -5
  8. package/es/icon/style.css +1 -1
  9. package/es/style.css +1 -1
  10. package/es/style.min.css +1 -1
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/dom.js +9 -0
  13. package/es/ui/src/log.js +1 -1
  14. package/lib/form/index.js +0 -1
  15. package/lib/form/index.min.js +1 -1
  16. package/lib/form/src/form-config-item.js +1 -0
  17. package/lib/form/src/form-config-item.min.js +1 -1
  18. package/lib/form/src/form-group.js +1 -0
  19. package/lib/form/src/form-group.min.js +1 -1
  20. package/lib/form/src/form-item.js +1 -0
  21. package/lib/form/src/form-item.min.js +1 -1
  22. package/lib/form/src/form.js +75 -8
  23. package/lib/form/src/form.min.js +1 -1
  24. package/lib/form/src/render.js +6 -3
  25. package/lib/form/src/render.min.js +1 -1
  26. package/lib/icon/style/style.css +1 -1
  27. package/lib/icon/style/style.min.css +1 -1
  28. package/lib/index.umd.js +1409 -1328
  29. package/lib/index.umd.min.js +1 -1
  30. package/lib/style.css +1 -1
  31. package/lib/style.min.css +1 -1
  32. package/lib/ui/index.js +1 -1
  33. package/lib/ui/index.min.js +1 -1
  34. package/lib/ui/src/dom.js +10 -0
  35. package/lib/ui/src/dom.min.js +1 -1
  36. package/lib/ui/src/log.js +1 -1
  37. package/lib/ui/src/log.min.js +1 -1
  38. package/package.json +1 -1
  39. package/packages/form/index.ts +0 -1
  40. package/packages/form/src/form-config-item.ts +1 -0
  41. package/packages/form/src/form-group.ts +1 -0
  42. package/packages/form/src/form-item.ts +1 -0
  43. package/packages/form/src/form.ts +71 -10
  44. package/packages/form/src/render.ts +11 -11
  45. package/packages/ui/src/dom.ts +10 -0
  46. package/types/components/form.d.ts +11 -2
  47. package/types/components/gantt-module/gantt-view.d.ts +164 -0
  48. package/types/components/gantt-module/index.d.ts +1 -0
  49. package/types/components/gantt.d.ts +113 -29
  50. package/types/components/grid.d.ts +38 -18
  51. package/types/components/table-module/custom.d.ts +2 -1
  52. package/types/components/table.d.ts +32 -9
  53. package/types/ui/commands.d.ts +3 -1
  54. package/types/ui/hooks.d.ts +2 -0
  55. /package/es/icon/{iconfont.1754563062233.ttf → iconfont.1754905375075.ttf} +0 -0
  56. /package/es/icon/{iconfont.1754563062233.woff → iconfont.1754905375075.woff} +0 -0
  57. /package/es/icon/{iconfont.1754563062233.woff2 → iconfont.1754905375075.woff2} +0 -0
  58. /package/es/{iconfont.1754563062233.ttf → iconfont.1754905375075.ttf} +0 -0
  59. /package/es/{iconfont.1754563062233.woff → iconfont.1754905375075.woff} +0 -0
  60. /package/es/{iconfont.1754563062233.woff2 → iconfont.1754905375075.woff2} +0 -0
  61. /package/lib/icon/style/{iconfont.1754563062233.ttf → iconfont.1754905375075.ttf} +0 -0
  62. /package/lib/icon/style/{iconfont.1754563062233.woff → iconfont.1754905375075.woff} +0 -0
  63. /package/lib/icon/style/{iconfont.1754563062233.woff2 → iconfont.1754905375075.woff2} +0 -0
  64. /package/lib/{iconfont.1754563062233.ttf → iconfont.1754905375075.ttf} +0 -0
  65. /package/lib/{iconfont.1754563062233.woff → iconfont.1754905375075.woff} +0 -0
  66. /package/lib/{iconfont.1754563062233.woff2 → iconfont.1754905375075.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -4321,14 +4321,14 @@ function checkDynamic() {
4321
4321
  }
4322
4322
  ;// CONCATENATED MODULE: ./packages/ui/src/log.ts
4323
4323
 
4324
- const log_version = `ui v${"4.8.11"}`;
4324
+ const log_version = `ui v${"4.8.13"}`;
4325
4325
  const warnLog = log.create('warn', log_version);
4326
4326
  const errLog = log.create('error', log_version);
4327
4327
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
4328
4328
 
4329
4329
 
4330
4330
 
4331
- const ui_version = "4.8.11";
4331
+ const ui_version = "4.8.13";
4332
4332
  index_esm_VxeUI.uiVersion = ui_version;
4333
4333
  index_esm_VxeUI.dynamicApp = dynamicApp;
4334
4334
  function config(options) {
@@ -5195,6 +5195,15 @@ function getPaddingTopBottomSize(elem) {
5195
5195
  }
5196
5196
  return 0;
5197
5197
  }
5198
+ function getPaddingLeftRightSize(elem) {
5199
+ if (elem) {
5200
+ const computedStyle = getComputedStyle(elem);
5201
+ const paddingLeft = XEUtils.toNumber(computedStyle.paddingLeft);
5202
+ const paddingRight = XEUtils.toNumber(computedStyle.paddingRight);
5203
+ return paddingLeft + paddingRight;
5204
+ }
5205
+ return 0;
5206
+ }
5198
5207
  const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded';
5199
5208
  const scrollIntoView = 'scrollIntoView';
5200
5209
  function scrollToView(elem) {
@@ -21483,11 +21492,14 @@ function renderTitle($xeForm, item, isGroup) {
21483
21492
  },
21484
21493
  onMouseleave: $xeForm.handleTitleTipLeaveEvent
21485
21494
  } : {};
21495
+ const itStyle = Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(itemTitleStyle) ? itemTitleStyle(params) : itemTitleStyle, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(titleStyle) ? titleStyle(params) : titleStyle);
21496
+ if (titleWidth && titleWidth !== 'auto' && showContent !== false) {
21497
+ itStyle.width = toCssUnit(titleWidth);
21498
+ }
21486
21499
  return isTitle ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
21487
21500
  class: [isGroup || hasGroup ? 'vxe-form--group-title' : '', 'vxe-form--item-title', titleAlign ? `align--${titleAlign}` : '', hasEllipsis ? 'is--ellipsis' : '', itemTitleClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(itemTitleClassName) ? itemTitleClassName(params) : itemTitleClassName : '', titleClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(titleClassName) ? titleClassName(params) : titleClassName : ''],
21488
- style: Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(itemTitleStyle) ? itemTitleStyle(params) : itemTitleStyle, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(titleStyle) ? titleStyle(params) : titleStyle, titleWidth && showContent !== false ? {
21489
- width: toCssUnit(titleWidth)
21490
- } : null),
21501
+ style: itStyle,
21502
+ itemid: item.id,
21491
21503
  title: ovTitle ? getFuncText(title) : null,
21492
21504
  ...ons
21493
21505
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
@@ -21669,6 +21681,7 @@ const VxeFormConfigItem = defineVxeComponent({
21669
21681
  }
21670
21682
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
21671
21683
  key: item.id,
21684
+ itemid: item.id,
21672
21685
  class: getItemClass($xeForm, item),
21673
21686
  style: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(itemStyle) ? itemStyle(params) : itemStyle
21674
21687
  }, [renderTitle($xeForm, item), showContent === false ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)() : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
@@ -21690,1077 +21703,148 @@ const VxeFormConfigItem = defineVxeComponent({
21690
21703
  }
21691
21704
  });
21692
21705
  /* harmony default export */ var form_config_item = (VxeFormConfigItem);
21693
- ;// CONCATENATED MODULE: ./packages/form/src/form.ts
21694
-
21695
-
21696
-
21697
-
21698
-
21699
-
21700
-
21701
-
21706
+ ;// CONCATENATED MODULE: ./packages/form/render/index.ts
21702
21707
 
21703
21708
 
21704
21709
 
21705
21710
 
21706
21711
 
21707
- class Rule {
21708
- constructor(rule) {
21709
- Object.assign(this, {
21710
- $options: rule,
21711
- required: rule.required,
21712
- min: rule.min,
21713
- max: rule.min,
21714
- type: rule.type,
21715
- pattern: rule.pattern,
21716
- validator: rule.validator,
21717
- trigger: rule.trigger,
21718
- maxWidth: rule.maxWidth
21719
- });
21720
- }
21721
- get content() {
21722
- return getFuncText(this.$options.content || this.$options.message);
21723
- }
21724
- get message() {
21725
- return this.content;
21726
- }
21712
+ const componentDefaultModelProp = 'modelValue';
21713
+ /**
21714
+ * 已废弃
21715
+ * @deprecated
21716
+ */
21717
+ function getOldComponentName(name) {
21718
+ return `vxe-${name.replace('$', '')}`;
21727
21719
  }
21728
- // 如果存在 pattern,判断正则
21729
- function validREValue(pattern, val) {
21730
- if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
21731
- return false;
21732
- }
21733
- return true;
21720
+ function getDefaultComponent({
21721
+ name
21722
+ }) {
21723
+ return getComponent(name) || (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(name);
21734
21724
  }
21735
- // 如果存在 max,判断最大值
21736
- function validMaxValue(max, num) {
21737
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(max) && num > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(max)) {
21738
- return false;
21739
- }
21740
- return true;
21725
+ /**
21726
+ * 已废弃
21727
+ * @deprecated
21728
+ */
21729
+ function getOldComponent({
21730
+ name
21731
+ }) {
21732
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(getOldComponentName(name));
21741
21733
  }
21742
- // 如果存在 min,判断最小值
21743
- function validMinValue(min, num) {
21744
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(min) && num < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(min)) {
21745
- return false;
21734
+ function getNativeAttrs(renderOpts) {
21735
+ let {
21736
+ name,
21737
+ attrs
21738
+ } = renderOpts;
21739
+ if (name === 'input') {
21740
+ attrs = Object.assign({
21741
+ type: 'text'
21742
+ }, attrs);
21746
21743
  }
21747
- return true;
21744
+ return attrs;
21748
21745
  }
21749
- function validRuleValue(rule, val, required) {
21746
+ function getComponentFormItemProps(renderOpts, params, value, defaultProps) {
21747
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign({}, defaultProps, renderOpts.props, {
21748
+ [componentDefaultModelProp]: value
21749
+ });
21750
+ }
21751
+ /**
21752
+ * 原生事件处理
21753
+ * @param renderOpts
21754
+ * @param params
21755
+ * @param modelFunc
21756
+ * @param changeFunc
21757
+ */
21758
+ function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
21750
21759
  const {
21751
- type,
21752
- min,
21753
- max,
21754
- pattern
21755
- } = rule;
21756
- const isArrType = type === 'array';
21757
- const isNumType = type === 'number';
21758
- const isStrType = type === 'string';
21759
- const strVal = `${val}`;
21760
- if (!validREValue(pattern, strVal)) {
21761
- return false;
21760
+ events
21761
+ } = renderOpts;
21762
+ const modelEvent = getModelEvent(renderOpts.name);
21763
+ const changeEvent = getChangeEvent(renderOpts.name);
21764
+ const isSameEvent = changeEvent === modelEvent;
21765
+ const ons = {};
21766
+ if (events) {
21767
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
21768
+ ons[getOnName(key)] = function (...args) {
21769
+ func(params, ...args);
21770
+ };
21771
+ });
21762
21772
  }
21763
- if (isArrType) {
21764
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val)) {
21765
- return false;
21766
- }
21767
- if (required) {
21768
- if (!val.length) {
21769
- return false;
21773
+ if (modelFunc) {
21774
+ ons[getOnName(modelEvent)] = function (targetEvnt) {
21775
+ modelFunc(targetEvnt);
21776
+ if (isSameEvent && changeFunc) {
21777
+ changeFunc(targetEvnt);
21770
21778
  }
21771
- }
21772
- if (!validMinValue(min, val.length)) {
21773
- return false;
21774
- }
21775
- if (!validMaxValue(max, val.length)) {
21776
- return false;
21777
- }
21778
- } else if (isNumType) {
21779
- const numVal = Number(val);
21780
- if (isNaN(numVal)) {
21781
- return false;
21782
- }
21783
- if (!validMinValue(min, numVal)) {
21784
- return false;
21785
- }
21786
- if (!validMaxValue(max, numVal)) {
21787
- return false;
21788
- }
21789
- } else {
21790
- if (isStrType) {
21791
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val)) {
21792
- return false;
21779
+ if (events && events[modelEvent]) {
21780
+ events[modelEvent](params, targetEvnt);
21793
21781
  }
21794
- }
21795
- if (required) {
21796
- if (!strVal) {
21797
- return false;
21782
+ };
21783
+ }
21784
+ if (!isSameEvent && changeFunc) {
21785
+ ons[getOnName(changeEvent)] = function (...args) {
21786
+ changeFunc(...args);
21787
+ if (events && events[changeEvent]) {
21788
+ events[changeEvent](params, ...args);
21798
21789
  }
21799
- }
21800
- if (!validMinValue(min, strVal.length)) {
21801
- return false;
21802
- }
21803
- if (!validMaxValue(max, strVal.length)) {
21804
- return false;
21805
- }
21790
+ };
21806
21791
  }
21807
- return true;
21792
+ return ons;
21808
21793
  }
21809
- function checkRuleStatus(rule, val) {
21794
+ /**
21795
+ * 组件事件处理
21796
+ * @param renderOpts
21797
+ * @param params
21798
+ * @param modelFunc
21799
+ * @param changeFunc
21800
+ */
21801
+ function getComponentOns(renderOpts, params, eFns, eventOns) {
21810
21802
  const {
21811
- required
21812
- } = rule;
21813
- const isEmptyVal = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val) ? !val.length : eqEmptyValue(val);
21814
- if (required) {
21815
- if (isEmptyVal) {
21816
- return false;
21817
- }
21818
- if (!validRuleValue(rule, val, required)) {
21819
- return false;
21820
- }
21821
- } else {
21822
- if (!isEmptyVal) {
21823
- if (!validRuleValue(rule, val, required)) {
21824
- return false;
21803
+ events
21804
+ } = renderOpts;
21805
+ const {
21806
+ model: modelFunc,
21807
+ change: changeFunc
21808
+ } = eFns || {};
21809
+ const modelEvent = getModelEvent(renderOpts.name);
21810
+ const changeEvent = getChangeEvent(renderOpts.name);
21811
+ const ons = {};
21812
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
21813
+ ons[getOnName(key)] = function (...args) {
21814
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
21815
+ errLog('vxe.error.errFunc', [func]);
21825
21816
  }
21826
- }
21817
+ func(params, ...args);
21818
+ };
21819
+ });
21820
+ if (modelFunc) {
21821
+ ons[getOnName(modelEvent)] = function (targetEvnt) {
21822
+ modelFunc(targetEvnt);
21823
+ if (events && events[modelEvent]) {
21824
+ events[modelEvent](params, targetEvnt);
21825
+ }
21826
+ };
21827
21827
  }
21828
- return true;
21828
+ if (changeFunc) {
21829
+ ons[getOnName(changeEvent)] = function (...args) {
21830
+ changeFunc(...args);
21831
+ if (events && events[changeEvent]) {
21832
+ events[changeEvent](params, ...args);
21833
+ }
21834
+ };
21835
+ }
21836
+ return eventOns ? Object.assign(ons, eventOns) : ons;
21829
21837
  }
21830
- function createInternalData() {
21831
- return {
21832
- meTimeout: undefined,
21833
- stTimeout: undefined,
21834
- tooltipStore: {
21835
- item: null,
21836
- visible: false
21837
- },
21838
- itemFormatCache: {}
21839
- };
21840
- }
21841
- /* harmony default export */ var src_form = (defineVxeComponent({
21842
- name: 'VxeForm',
21843
- props: {
21844
- collapseStatus: {
21845
- type: Boolean,
21846
- default: true
21847
- },
21848
- loading: Boolean,
21849
- data: Object,
21850
- size: {
21851
- type: String,
21852
- default: () => getConfig().form.size || getConfig().size
21853
- },
21854
- span: {
21855
- type: [String, Number],
21856
- default: () => getConfig().form.span
21857
- },
21858
- align: {
21859
- type: String,
21860
- default: () => getConfig().form.align
21861
- },
21862
- verticalAlign: {
21863
- type: String,
21864
- default: () => getConfig().form.verticalAlign
21865
- },
21866
- border: {
21867
- type: Boolean,
21868
- default: () => getConfig().form.border
21869
- },
21870
- titleBackground: {
21871
- type: Boolean,
21872
- default: () => getConfig().form.titleBackground
21873
- },
21874
- titleBold: {
21875
- type: Boolean,
21876
- default: () => getConfig().form.titleBold
21877
- },
21878
- titleAlign: {
21879
- type: String,
21880
- default: () => getConfig().form.titleAlign
21881
- },
21882
- titleWidth: {
21883
- type: [String, Number],
21884
- default: () => getConfig().form.titleWidth
21885
- },
21886
- titleColon: {
21887
- type: Boolean,
21888
- default: () => getConfig().form.titleColon
21889
- },
21890
- titleAsterisk: {
21891
- type: Boolean,
21892
- default: () => getConfig().form.titleAsterisk
21893
- },
21894
- titleOverflow: {
21895
- type: [Boolean, String],
21896
- default: () => getConfig().form.titleOverflow
21897
- },
21898
- vertical: {
21899
- type: Boolean,
21900
- default: () => getConfig().form.vertical
21901
- },
21902
- padding: {
21903
- type: Boolean,
21904
- default: () => getConfig().form.padding
21905
- },
21906
- className: [String, Function],
21907
- readonly: Boolean,
21908
- disabled: Boolean,
21909
- items: Array,
21910
- rules: Object,
21911
- preventSubmit: {
21912
- type: Boolean,
21913
- default: () => getConfig().form.preventSubmit
21914
- },
21915
- validConfig: Object,
21916
- tooltipConfig: Object,
21917
- collapseConfig: Object,
21918
- customLayout: {
21919
- type: Boolean,
21920
- default: () => getConfig().form.customLayout
21921
- },
21922
- params: Object
21923
- },
21924
- emits: ['update:collapseStatus', 'collapse', 'toggle-collapse', 'submit', 'submit-invalid', 'reset'],
21925
- setup(props, context) {
21926
- const {
21927
- slots,
21928
- emit
21929
- } = context;
21930
- const $xeGrid = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGrid', null);
21931
- const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
21932
- const {
21933
- computeSize
21934
- } = useSize(props);
21935
- const reactData = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)({
21936
- collapseAll: props.collapseStatus,
21937
- staticItems: [],
21938
- formItems: []
21939
- });
21940
- const internalData = createInternalData();
21941
- const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
21942
- const refTooltip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
21943
- let formMethods = {};
21944
- const computeValidOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
21945
- return Object.assign({}, getConfig().form.validConfig, props.validConfig);
21946
- });
21947
- const computeTooltipOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
21948
- return Object.assign({}, getConfig().tooltip, getConfig().form.tooltipConfig, props.tooltipConfig);
21949
- });
21950
- const computeCollapseOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
21951
- return Object.assign({}, getConfig().form.collapseConfig, props.collapseConfig);
21952
- });
21953
- const refMaps = {
21954
- refElem
21955
- };
21956
- const computeMaps = {
21957
- computeSize,
21958
- computeValidOpts,
21959
- computeTooltipOpts,
21960
- computeCollapseOpts
21961
- };
21962
- const $xeForm = {
21963
- xID,
21964
- props,
21965
- context,
21966
- reactData,
21967
- internalData,
21968
- xeGrid: $xeGrid,
21969
- getRefMaps: () => refMaps,
21970
- getComputeMaps: () => computeMaps
21971
- };
21972
- const callSlot = (slotFunc, params) => {
21973
- if (slotFunc) {
21974
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
21975
- slotFunc = slots[slotFunc] || null;
21976
- }
21977
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(slotFunc)) {
21978
- return vn_getSlotVNs(slotFunc(params));
21979
- }
21980
- }
21981
- return [];
21982
- };
21983
- const loadItem = list => {
21984
- if (list.length) {
21985
- list.forEach(item => {
21986
- if (item.slots) {
21987
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(item.slots, func => {
21988
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
21989
- if (!slots[func]) {
21990
- errLog('vxe.error.notSlot', [func]);
21991
- }
21992
- }
21993
- });
21994
- }
21995
- });
21996
- }
21997
- reactData.staticItems = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(list, item => createItem($xeForm, item), {
21998
- children: 'children'
21999
- });
22000
- internalData.itemFormatCache = {};
22001
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22002
- };
22003
- const getItems = () => {
22004
- const itemList = [];
22005
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(reactData.formItems, item => {
22006
- itemList.push(item);
22007
- }, {
22008
- children: 'children'
22009
- });
22010
- return itemList;
22011
- };
22012
- const getItemByField = field => {
22013
- const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(reactData.formItems, item => item.field === field, {
22014
- children: 'children'
22015
- });
22016
- return rest ? rest.item : null;
22017
- };
22018
- const getCollapseStatus = () => {
22019
- return reactData.collapseAll;
22020
- };
22021
- const toggleCollapse = () => {
22022
- const status = !getCollapseStatus();
22023
- reactData.collapseAll = status;
22024
- emit('update:collapseStatus', status);
22025
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22026
- };
22027
- const toggleCollapseEvent = evnt => {
22028
- toggleCollapse();
22029
- const status = getCollapseStatus();
22030
- formMethods.dispatchEvent('toggle-collapse', {
22031
- status,
22032
- collapse: status,
22033
- data: props.data
22034
- }, evnt);
22035
- formMethods.dispatchEvent('collapse', {
22036
- status,
22037
- collapse: status,
22038
- data: props.data
22039
- }, evnt);
22040
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
22041
- if ($xeGrid) {
22042
- $xeGrid.recalculate();
22043
- }
22044
- });
22045
- };
22046
- const clearValidate = fieldOrItem => {
22047
- if (fieldOrItem) {
22048
- let fields = fieldOrItem;
22049
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrItem)) {
22050
- fields = [fieldOrItem];
22051
- }
22052
- fields.forEach(field => {
22053
- if (field) {
22054
- const item = handleFieldOrItem($xeForm, field);
22055
- if (item) {
22056
- item.showError = false;
22057
- }
22058
- }
22059
- });
22060
- } else {
22061
- getItems().forEach(item => {
22062
- item.showError = false;
22063
- });
22064
- }
22065
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22066
- };
22067
- const getResetValue = (item, data, itemValue) => {
22068
- const {
22069
- field,
22070
- resetValue
22071
- } = item;
22072
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resetValue)) {
22073
- return resetValue({
22074
- field,
22075
- item,
22076
- data,
22077
- $form: $xeForm,
22078
- $grid: $xeGrid
22079
- });
22080
- } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(resetValue)) {
22081
- // 默认
22082
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(itemValue)) {
22083
- return [];
22084
- }
22085
- }
22086
- return resetValue;
22087
- };
22088
- const reset = () => {
22089
- const {
22090
- data
22091
- } = props;
22092
- const itemList = getItems();
22093
- if (data) {
22094
- itemList.forEach(item => {
22095
- const {
22096
- field,
22097
- itemRender
22098
- } = item;
22099
- if (isEnableConf(itemRender)) {
22100
- const {
22101
- name,
22102
- startField,
22103
- endField
22104
- } = itemRender;
22105
- const compConf = renderer.get(name);
22106
- const fiResetMethod = compConf ? compConf.formItemResetMethod || compConf.itemResetMethod : null;
22107
- if (compConf && fiResetMethod) {
22108
- fiResetMethod({
22109
- data,
22110
- field,
22111
- property: field,
22112
- item,
22113
- $form: $xeForm,
22114
- $grid: $xeGrid
22115
- });
22116
- } else if (field) {
22117
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22118
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, getResetValue(item, data, itemValue));
22119
- }
22120
- if (startField && endField) {
22121
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, startField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, startField)));
22122
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, endField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, endField)));
22123
- }
22124
- }
22125
- });
22126
- }
22127
- internalData.itemFormatCache = {};
22128
- return clearValidate();
22129
- };
22130
- const resetEvent = evnt => {
22131
- evnt.preventDefault();
22132
- reset();
22133
- formMethods.dispatchEvent('reset', {
22134
- data: props.data
22135
- }, evnt);
22136
- };
22137
- const handleFocus = fields => {
22138
- const el = refElem.value;
22139
- if (el) {
22140
- for (let i = 0; i < fields.length; i++) {
22141
- const field = fields[i];
22142
- const item = getItemByField(field);
22143
- if (item && isEnableConf(item.itemRender)) {
22144
- const {
22145
- itemRender
22146
- } = item;
22147
- const compConf = renderer.get(itemRender.name);
22148
- // 定位到第一个
22149
- if (!i) {
22150
- scrollToView(el.querySelector(`.${item.id}`));
22151
- }
22152
- let inputElem = null;
22153
- const autoFocus = itemRender.autoFocus || itemRender.autofocus || (compConf ? compConf.formItemAutoFocus : null);
22154
- // 如果指定了聚焦 class
22155
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(autoFocus)) {
22156
- inputElem = autoFocus({
22157
- $form: $xeForm,
22158
- $grid: $xeGrid,
22159
- item,
22160
- data: props.data,
22161
- field
22162
- });
22163
- } else {
22164
- if (autoFocus === true) {
22165
- // 自动匹配模式,会自动匹配第一个可输入元素
22166
- inputElem = el.querySelector(`.${item.id} input,textarea`);
22167
- } else if (autoFocus) {
22168
- inputElem = el.querySelector(`.${item.id} ${autoFocus}`);
22169
- }
22170
- }
22171
- if (inputElem) {
22172
- inputElem.focus();
22173
- break;
22174
- }
22175
- }
22176
- }
22177
- }
22178
- };
22179
- /**
22180
- * 校验数据
22181
- * 按表格行、列顺序依次校验(同步或异步)
22182
- * 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
22183
- * 如果校验失败则,触发回调或者 Promise<(ErrMap 校验不通过列的信息)>
22184
- * 如果是传回调方式这返回一个 (ErrMap 校验不通过列的信息)
22185
- *
22186
- * rule 配置:
22187
- * required=Boolean 是否必填
22188
- * min=Number 最小长度
22189
- * max=Number 最大长度
22190
- * validator=Function({ itemValue, rule, rules, data, property }) 自定义校验,接收一个 Promise
22191
- * trigger=change 触发方式
22192
- */
22193
- const validItemRules = (validType, fields, val) => {
22194
- const {
22195
- data,
22196
- rules: formRules
22197
- } = props;
22198
- const errorMaps = {};
22199
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fields)) {
22200
- fields = [fields];
22201
- }
22202
- return Promise.all(fields.map(property => {
22203
- const errorRules = [];
22204
- const syncVailds = [];
22205
- if (property && formRules) {
22206
- const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(formRules, property);
22207
- if (rules) {
22208
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(val) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, property) : val;
22209
- rules.forEach(rule => {
22210
- const {
22211
- trigger,
22212
- validator
22213
- } = rule;
22214
- if (validType === 'all' || !trigger || validType === trigger) {
22215
- if (validator) {
22216
- const validParams = {
22217
- itemValue,
22218
- rule,
22219
- rules,
22220
- data,
22221
- field: property,
22222
- property,
22223
- $form: $xeForm
22224
- };
22225
- let customValid;
22226
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
22227
- const gvItem = validators.get(validator);
22228
- if (gvItem) {
22229
- const validatorMethod = gvItem.formItemValidatorMethod || gvItem.itemValidatorMethod;
22230
- if (validatorMethod) {
22231
- customValid = validatorMethod(validParams);
22232
- } else {
22233
- warnLog('vxe.error.notValidators', [validator]);
22234
- }
22235
- } else {
22236
- errLog('vxe.error.notValidators', [validator]);
22237
- }
22238
- } else {
22239
- customValid = validator(validParams);
22240
- }
22241
- if (customValid) {
22242
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
22243
- errorRules.push(new Rule({
22244
- type: 'custom',
22245
- trigger,
22246
- content: customValid.message,
22247
- rule: new Rule(rule)
22248
- }));
22249
- } else if (customValid.catch) {
22250
- // 如果为异步校验(注:异步校验是并发无序的)
22251
- syncVailds.push(customValid.catch(e => {
22252
- errorRules.push(new Rule({
22253
- type: 'custom',
22254
- trigger,
22255
- content: e ? e.message : rule.content || rule.message,
22256
- rule: new Rule(rule)
22257
- }));
22258
- }));
22259
- }
22260
- }
22261
- } else {
22262
- if (!checkRuleStatus(rule, itemValue)) {
22263
- errorRules.push(new Rule(rule));
22264
- }
22265
- }
22266
- }
22267
- });
22268
- }
22269
- }
22270
- return Promise.all(syncVailds).then(() => {
22271
- if (errorRules.length) {
22272
- errorMaps[property] = errorRules.map(rule => {
22273
- return {
22274
- $form: $xeForm,
22275
- rule,
22276
- data,
22277
- field: property,
22278
- property
22279
- };
22280
- });
22281
- }
22282
- });
22283
- })).then(() => {
22284
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEmpty(errorMaps)) {
22285
- return Promise.reject(errorMaps);
22286
- }
22287
- });
22288
- };
22289
- const beginValidate = (itemList, type, callback) => {
22290
- const {
22291
- data,
22292
- rules: formRules
22293
- } = props;
22294
- const validOpts = computeValidOpts.value;
22295
- const validRest = {};
22296
- const validFields = [];
22297
- const itemValids = [];
22298
- clearTimeout(internalData.meTimeout);
22299
- if (data && formRules) {
22300
- itemList.forEach(item => {
22301
- const {
22302
- field
22303
- } = item;
22304
- if (field && !isHiddenItem($xeForm, item) && isActiveItem($xeForm, item)) {
22305
- itemValids.push(validItemRules(type || 'all', field).then(() => {
22306
- item.errRule = null;
22307
- }).catch(errorMaps => {
22308
- const rest = errorMaps[field];
22309
- if (!validRest[field]) {
22310
- validRest[field] = [];
22311
- }
22312
- validRest[field].push(rest);
22313
- validFields.push(field);
22314
- item.errRule = rest[0].rule;
22315
- return Promise.reject(rest);
22316
- }));
22317
- }
22318
- });
22319
- return Promise.all(itemValids).then(() => {
22320
- if (callback) {
22321
- callback();
22322
- }
22323
- }).catch(() => {
22324
- return new Promise(resolve => {
22325
- internalData.meTimeout = setTimeout(() => {
22326
- itemList.forEach(item => {
22327
- if (item.errRule) {
22328
- item.showError = true;
22329
- }
22330
- });
22331
- }, 20);
22332
- if (validOpts.autoPos !== false) {
22333
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
22334
- handleFocus(validFields);
22335
- });
22336
- }
22337
- if (callback) {
22338
- callback(validRest);
22339
- resolve();
22340
- } else {
22341
- resolve(validRest);
22342
- }
22343
- });
22344
- });
22345
- }
22346
- if (callback) {
22347
- callback();
22348
- }
22349
- return Promise.resolve();
22350
- };
22351
- const validate = callback => {
22352
- const {
22353
- readonly
22354
- } = props;
22355
- clearValidate();
22356
- if (readonly) {
22357
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22358
- }
22359
- return beginValidate(getItems(), '', callback);
22360
- };
22361
- const validateField = (fieldOrItem, callback) => {
22362
- const {
22363
- readonly
22364
- } = props;
22365
- if (readonly) {
22366
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22367
- }
22368
- let fields = [];
22369
- if (fieldOrItem) {
22370
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrItem)) {
22371
- fields = fieldOrItem;
22372
- } else {
22373
- fields = [fieldOrItem];
22374
- }
22375
- }
22376
- return beginValidate(fields.map(field => handleFieldOrItem($xeForm, field)), '', callback);
22377
- };
22378
- const submitEvent = evnt => {
22379
- const {
22380
- readonly
22381
- } = props;
22382
- evnt.preventDefault();
22383
- if (!props.preventSubmit) {
22384
- clearValidate();
22385
- if (readonly) {
22386
- formMethods.dispatchEvent('submit', {
22387
- data: props.data
22388
- }, evnt);
22389
- return;
22390
- }
22391
- beginValidate(getItems()).then(errMap => {
22392
- if (errMap) {
22393
- formMethods.dispatchEvent('submit-invalid', {
22394
- data: props.data,
22395
- errMap
22396
- }, evnt);
22397
- } else {
22398
- formMethods.dispatchEvent('submit', {
22399
- data: props.data
22400
- }, evnt);
22401
- }
22402
- });
22403
- }
22404
- };
22405
- const closeTooltip = () => {
22406
- const {
22407
- tooltipStore
22408
- } = internalData;
22409
- const $tooltip = refTooltip.value;
22410
- if (tooltipStore.visible) {
22411
- Object.assign(tooltipStore, {
22412
- item: null,
22413
- visible: false
22414
- });
22415
- if ($tooltip) {
22416
- $tooltip.close();
22417
- }
22418
- }
22419
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22420
- };
22421
- const triggerTitleTipEvent = (evnt, params) => {
22422
- const {
22423
- item
22424
- } = params;
22425
- const {
22426
- tooltipStore
22427
- } = internalData;
22428
- const $tooltip = refTooltip.value;
22429
- const overflowElem = evnt.currentTarget.children[0];
22430
- const content = (overflowElem.textContent || '').trim();
22431
- const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
22432
- clearTimeout(internalData.stTimeout);
22433
- if (tooltipStore.item !== item) {
22434
- closeTooltip();
22435
- }
22436
- if (content && isCellOverflow) {
22437
- Object.assign(tooltipStore, {
22438
- item,
22439
- visible: true
22440
- });
22441
- if ($tooltip) {
22442
- $tooltip.open(overflowElem, content);
22443
- }
22444
- }
22445
- };
22446
- const handleTitleTipLeaveEvent = () => {
22447
- const tooltipOpts = computeTooltipOpts.value;
22448
- let $tooltip = refTooltip.value;
22449
- if ($tooltip) {
22450
- $tooltip.setActived(false);
22451
- }
22452
- if (tooltipOpts.enterable) {
22453
- internalData.stTimeout = setTimeout(() => {
22454
- $tooltip = refTooltip.value;
22455
- if ($tooltip && !$tooltip.isActived()) {
22456
- closeTooltip();
22457
- }
22458
- }, tooltipOpts.leaveDelay);
22459
- } else {
22460
- closeTooltip();
22461
- }
22462
- };
22463
- const triggerItemEvent = (evnt, field, itemValue) => {
22464
- if (field) {
22465
- return validItemRules(evnt ? ['blur'].includes(evnt.type) ? 'blur' : 'change' : 'all', field, itemValue).then(() => {
22466
- clearValidate(field);
22467
- }).catch(errorMaps => {
22468
- const rest = errorMaps[field];
22469
- const item = getItemByField(field);
22470
- if (rest && item) {
22471
- item.showError = true;
22472
- item.errRule = rest[0].rule;
22473
- }
22474
- });
22475
- }
22476
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22477
- };
22478
- /**
22479
- * 更新项状态
22480
- * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
22481
- * 如果单元格配置了校验规则,则会进行校验
22482
- */
22483
- const updateStatus = (scope, itemValue) => {
22484
- const {
22485
- field
22486
- } = scope;
22487
- return triggerItemEvent(new Event('change'), field, itemValue);
22488
- };
22489
- formMethods = {
22490
- dispatchEvent(type, params, evnt) {
22491
- emit(type, createEvent(evnt, {
22492
- $form: $xeForm,
22493
- $grid: $xeGrid
22494
- }, params));
22495
- },
22496
- reset,
22497
- validate,
22498
- validateField,
22499
- clearValidate,
22500
- updateStatus,
22501
- toggleCollapse,
22502
- getItems,
22503
- getItemByField,
22504
- closeTooltip
22505
- };
22506
- const formPrivateMethods = {
22507
- callSlot,
22508
- triggerItemEvent,
22509
- toggleCollapseEvent,
22510
- triggerTitleTipEvent,
22511
- handleTitleTipLeaveEvent
22512
- };
22513
- Object.assign($xeForm, formMethods, formPrivateMethods);
22514
- const renderVN = () => {
22515
- const {
22516
- loading,
22517
- border,
22518
- className,
22519
- data,
22520
- customLayout
22521
- } = props;
22522
- const {
22523
- formItems
22524
- } = reactData;
22525
- // const formItems: any[] = []
22526
- const vSize = computeSize.value;
22527
- const tooltipOpts = computeTooltipOpts.value;
22528
- const defaultSlot = slots.default;
22529
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('form', {
22530
- ref: refElem,
22531
- class: ['vxe-form', className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(className) ? className({
22532
- items: formItems,
22533
- data,
22534
- $form: $xeForm
22535
- }) : className : '', {
22536
- [`size--${vSize}`]: vSize,
22537
- 'is--border': border,
22538
- 'custom--layout': customLayout,
22539
- 'is--loading': loading
22540
- }],
22541
- onSubmit: submitEvent,
22542
- onReset: resetEvent
22543
- }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
22544
- class: 'vxe-form--wrapper vxe-form--item-row'
22545
- }, customLayout ? defaultSlot ? defaultSlot({}) : [] : formItems.map((item, index) => {
22546
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(form_config_item, {
22547
- key: index,
22548
- itemConfig: item
22549
- });
22550
- })), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
22551
- class: 'vxe-form-slots',
22552
- ref: 'hideItem'
22553
- }, customLayout ? [] : defaultSlot ? defaultSlot({}) : []),
22554
- /**
22555
- * 加载中
22556
- */
22557
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(src_loading, {
22558
- class: 'vxe-form--loading',
22559
- modelValue: loading
22560
- }),
22561
- /**
22562
- * 工具提示
22563
- */
22564
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(tooltip, {
22565
- ref: refTooltip,
22566
- ...tooltipOpts
22567
- })]);
22568
- };
22569
- const staticItemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
22570
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems.length, () => {
22571
- staticItemFlag.value++;
22572
- });
22573
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems, () => {
22574
- staticItemFlag.value++;
22575
- });
22576
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(staticItemFlag, () => {
22577
- reactData.formItems = reactData.staticItems;
22578
- });
22579
- const itemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
22580
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items ? props.items.length : -1, () => {
22581
- itemFlag.value++;
22582
- });
22583
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items, () => {
22584
- itemFlag.value++;
22585
- });
22586
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(itemFlag, () => {
22587
- loadItem(props.items || []);
22588
- });
22589
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.collapseStatus, value => {
22590
- reactData.collapseAll = !!value;
22591
- });
22592
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.readonly, () => {
22593
- clearValidate();
22594
- });
22595
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.disabled, () => {
22596
- clearValidate();
22597
- });
22598
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
22599
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
22600
- if (props.customLayout && props.items) {
22601
- errLog('vxe.error.errConflicts', ['custom-layout', 'items']);
22602
- }
22603
- });
22604
- });
22605
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onUnmounted)(() => {
22606
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
22607
- });
22608
- if (props.items) {
22609
- loadItem(props.items);
22610
- }
22611
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('xeFormItemInfo', null);
22612
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeForm', $xeForm);
22613
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormGroup', null);
22614
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormItem', null);
22615
- $xeForm.renderVN = renderVN;
22616
- return $xeForm;
22617
- },
22618
- render() {
22619
- return this.renderVN();
22620
- }
22621
- }));
22622
- ;// CONCATENATED MODULE: ./packages/form/render/index.ts
22623
-
22624
-
22625
-
22626
-
22627
-
22628
- const componentDefaultModelProp = 'modelValue';
22629
- /**
22630
- * 已废弃
22631
- * @deprecated
22632
- */
22633
- function getOldComponentName(name) {
22634
- return `vxe-${name.replace('$', '')}`;
22635
- }
22636
- function getDefaultComponent({
22637
- name
22638
- }) {
22639
- return getComponent(name) || (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(name);
22640
- }
22641
- /**
22642
- * 已废弃
22643
- * @deprecated
22644
- */
22645
- function getOldComponent({
22646
- name
22647
- }) {
22648
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(getOldComponentName(name));
22649
- }
22650
- function getNativeAttrs(renderOpts) {
22651
- let {
22652
- name,
22653
- attrs
22654
- } = renderOpts;
22655
- if (name === 'input') {
22656
- attrs = Object.assign({
22657
- type: 'text'
22658
- }, attrs);
22659
- }
22660
- return attrs;
22661
- }
22662
- function getComponentFormItemProps(renderOpts, params, value, defaultProps) {
22663
- return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign({}, defaultProps, renderOpts.props, {
22664
- [componentDefaultModelProp]: value
22665
- });
22666
- }
22667
- /**
22668
- * 原生事件处理
22669
- * @param renderOpts
22670
- * @param params
22671
- * @param modelFunc
22672
- * @param changeFunc
22673
- */
22674
- function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
22675
- const {
22676
- events
22677
- } = renderOpts;
22678
- const modelEvent = getModelEvent(renderOpts.name);
22679
- const changeEvent = getChangeEvent(renderOpts.name);
22680
- const isSameEvent = changeEvent === modelEvent;
22681
- const ons = {};
22682
- if (events) {
22683
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
22684
- ons[getOnName(key)] = function (...args) {
22685
- func(params, ...args);
22686
- };
22687
- });
22688
- }
22689
- if (modelFunc) {
22690
- ons[getOnName(modelEvent)] = function (targetEvnt) {
22691
- modelFunc(targetEvnt);
22692
- if (isSameEvent && changeFunc) {
22693
- changeFunc(targetEvnt);
22694
- }
22695
- if (events && events[modelEvent]) {
22696
- events[modelEvent](params, targetEvnt);
22697
- }
22698
- };
22699
- }
22700
- if (!isSameEvent && changeFunc) {
22701
- ons[getOnName(changeEvent)] = function (...args) {
22702
- changeFunc(...args);
22703
- if (events && events[changeEvent]) {
22704
- events[changeEvent](params, ...args);
22705
- }
22706
- };
22707
- }
22708
- return ons;
22709
- }
22710
- /**
22711
- * 组件事件处理
22712
- * @param renderOpts
22713
- * @param params
22714
- * @param modelFunc
22715
- * @param changeFunc
22716
- */
22717
- function getComponentOns(renderOpts, params, eFns, eventOns) {
22718
- const {
22719
- events
22720
- } = renderOpts;
22721
- const {
22722
- model: modelFunc,
22723
- change: changeFunc
22724
- } = eFns || {};
22725
- const modelEvent = getModelEvent(renderOpts.name);
22726
- const changeEvent = getChangeEvent(renderOpts.name);
22727
- const ons = {};
22728
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
22729
- ons[getOnName(key)] = function (...args) {
22730
- if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
22731
- errLog('vxe.error.errFunc', [func]);
22732
- }
22733
- func(params, ...args);
22734
- };
22735
- });
22736
- if (modelFunc) {
22737
- ons[getOnName(modelEvent)] = function (targetEvnt) {
22738
- modelFunc(targetEvnt);
22739
- if (events && events[modelEvent]) {
22740
- events[modelEvent](params, targetEvnt);
22741
- }
22742
- };
22743
- }
22744
- if (changeFunc) {
22745
- ons[getOnName(changeEvent)] = function (...args) {
22746
- changeFunc(...args);
22747
- if (events && events[changeEvent]) {
22748
- events[changeEvent](params, ...args);
22749
- }
22750
- };
22751
- }
22752
- return eventOns ? Object.assign(ons, eventOns) : ons;
22753
- }
22754
- function getItemOns(renderOpts, params) {
22755
- const {
22756
- $form,
22757
- data,
22758
- field
22759
- } = params;
22760
- return getComponentOns(renderOpts, params, {
22761
- model(value) {
22762
- // 处理 model 值双向绑定
22763
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, value);
21838
+ function getItemOns(renderOpts, params) {
21839
+ const {
21840
+ $form,
21841
+ data,
21842
+ field
21843
+ } = params;
21844
+ return getComponentOns(renderOpts, params, {
21845
+ model(value) {
21846
+ // 处理 model 值双向绑定
21847
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, value);
22764
21848
  },
22765
21849
  change(params) {
22766
21850
  // 处理 change 事件相关逻辑
@@ -22977,319 +22061,1314 @@ renderer.mixin({
22977
22061
  formItemAutoFocus: 'textarea',
22978
22062
  renderFormItemContent: nativeItemRender
22979
22063
  },
22980
- select: {
22981
- formItemAutoFocus: 'input',
22064
+ select: {
22065
+ formItemAutoFocus: 'input',
22066
+ renderFormItemContent(renderOpts, params) {
22067
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('select', {
22068
+ class: 'vxe-default-select',
22069
+ ...getNativeAttrs(renderOpts),
22070
+ ...getNativeItemOns(renderOpts, params)
22071
+ }, renderOpts.optionGroups ? renderNativeOptgroup(renderOpts, params, renderNativeFormOptions) : renderNativeFormOptions(renderOpts.options, renderOpts, params))];
22072
+ }
22073
+ },
22074
+ VxeInput: {
22075
+ formItemAutoFocus: 'input',
22076
+ renderFormItemContent: defaultItemRender
22077
+ },
22078
+ VxeNumberInput: {
22079
+ formItemAutoFocus: 'input',
22080
+ renderFormItemContent: defaultItemRender
22081
+ },
22082
+ VxePasswordInput: {
22083
+ formItemAutoFocus: 'input',
22084
+ renderFormItemContent: defaultItemRender
22085
+ },
22086
+ VxeTextarea: {
22087
+ formItemAutoFocus: 'textarea',
22088
+ renderFormItemContent: defaultItemRender
22089
+ },
22090
+ VxeDatePicker: {
22091
+ formItemAutoFocus: 'input',
22092
+ renderFormItemContent: defaultItemRender
22093
+ },
22094
+ VxeDateRangePicker: {
22095
+ formItemAutoFocus: 'input',
22096
+ renderFormItemContent(renderOpts, params) {
22097
+ const {
22098
+ startField,
22099
+ endField
22100
+ } = renderOpts;
22101
+ const {
22102
+ $form,
22103
+ data,
22104
+ field
22105
+ } = params;
22106
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22107
+ const seProps = {};
22108
+ const seOs = {};
22109
+ if (startField && endField) {
22110
+ seProps.startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, startField);
22111
+ seProps.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, endField);
22112
+ seOs['onUpdate:startValue'] = value => {
22113
+ if (startField) {
22114
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, startField, value);
22115
+ }
22116
+ };
22117
+ seOs['onUpdate:endValue'] = value => {
22118
+ if (endField) {
22119
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, endField, value);
22120
+ }
22121
+ };
22122
+ }
22123
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22124
+ ...getComponentFormItemProps(renderOpts, params, itemValue, seProps),
22125
+ ...getComponentOns(renderOpts, params, {
22126
+ model(value) {
22127
+ // 处理 model 值双向绑定
22128
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, value);
22129
+ },
22130
+ change() {
22131
+ // 处理 change 事件相关逻辑
22132
+ $form.updateStatus(params);
22133
+ }
22134
+ }, seOs)
22135
+ })];
22136
+ }
22137
+ },
22138
+ VxeButton: {
22139
+ renderFormItemContent: defaultFormItemRender
22140
+ },
22141
+ VxeButtonGroup: {
22142
+ renderFormItemContent(renderOpts, params) {
22143
+ const {
22144
+ options
22145
+ } = renderOpts;
22146
+ const {
22147
+ data,
22148
+ field
22149
+ } = params;
22150
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22151
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22152
+ options,
22153
+ ...getComponentFormItemProps(renderOpts, params, itemValue),
22154
+ ...getItemOns(renderOpts, params)
22155
+ })];
22156
+ }
22157
+ },
22158
+ VxeSelect: {
22159
+ formItemAutoFocus: 'input',
22160
+ renderFormItemContent(renderOpts, params) {
22161
+ const {
22162
+ data,
22163
+ field
22164
+ } = params;
22165
+ const {
22166
+ options,
22167
+ optionProps,
22168
+ optionGroups,
22169
+ optionGroupProps
22170
+ } = renderOpts;
22171
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22172
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22173
+ ...getComponentFormItemProps(renderOpts, params, itemValue, {
22174
+ options,
22175
+ optionProps,
22176
+ optionGroups,
22177
+ optionGroupProps
22178
+ }),
22179
+ ...getItemOns(renderOpts, params)
22180
+ })];
22181
+ }
22182
+ },
22183
+ VxeTreeSelect: {
22184
+ formItemAutoFocus: 'input',
22185
+ renderFormItemContent(renderOpts, params) {
22186
+ const {
22187
+ data,
22188
+ field
22189
+ } = params;
22190
+ const {
22191
+ options,
22192
+ optionProps
22193
+ } = renderOpts;
22194
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22195
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22196
+ ...getComponentFormItemProps(renderOpts, params, itemValue, {
22197
+ options,
22198
+ optionProps
22199
+ }),
22200
+ ...getItemOns(renderOpts, params)
22201
+ })];
22202
+ }
22203
+ },
22204
+ VxeTableSelect: {
22205
+ formItemAutoFocus: 'input',
22206
+ renderFormItemContent(renderOpts, params) {
22207
+ const {
22208
+ data,
22209
+ field
22210
+ } = params;
22211
+ const {
22212
+ options,
22213
+ optionProps
22214
+ } = renderOpts;
22215
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22216
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22217
+ ...getComponentFormItemProps(renderOpts, params, itemValue, {
22218
+ options,
22219
+ optionProps
22220
+ }),
22221
+ ...getItemOns(renderOpts, params)
22222
+ })];
22223
+ }
22224
+ },
22225
+ VxeColorPicker: {
22226
+ formItemAutoFocus: 'input',
22227
+ renderFormItemContent(renderOpts, params) {
22228
+ const {
22229
+ data,
22230
+ field
22231
+ } = params;
22232
+ const {
22233
+ options
22234
+ } = renderOpts;
22235
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22236
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22237
+ ...getComponentFormItemProps(renderOpts, params, itemValue, {
22238
+ colors: options
22239
+ }),
22240
+ ...getItemOns(renderOpts, params)
22241
+ })];
22242
+ }
22243
+ },
22244
+ VxeIconPicker: {
22245
+ formItemAutoFocus: 'input',
22246
+ renderFormItemContent(renderOpts, params) {
22247
+ const {
22248
+ data,
22249
+ field
22250
+ } = params;
22251
+ const {
22252
+ options
22253
+ } = renderOpts;
22254
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22255
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22256
+ ...getComponentFormItemProps(renderOpts, params, itemValue, {
22257
+ icons: options
22258
+ }),
22259
+ ...getItemOns(renderOpts, params)
22260
+ })];
22261
+ }
22262
+ },
22263
+ VxeRadio: {
22264
+ renderFormItemContent: defaultFormItemRender
22265
+ },
22266
+ VxeRadioGroup: {
22267
+ renderFormItemContent: formItemRadioAndCheckboxRender
22268
+ },
22269
+ VxeCheckbox: {
22270
+ renderFormItemContent: defaultFormItemRender
22271
+ },
22272
+ VxeCheckboxGroup: {
22273
+ renderFormItemContent: formItemRadioAndCheckboxRender
22274
+ },
22275
+ VxeSwitch: {
22276
+ renderFormItemContent: defaultItemRender
22277
+ },
22278
+ VxeRate: {
22279
+ renderFormItemContent: defaultItemRender
22280
+ },
22281
+ VxeSlider: {
22282
+ renderFormItemContent: defaultItemRender
22283
+ },
22284
+ VxeImage: {
22285
+ renderFormItemContent(renderOpts, params) {
22286
+ const {
22287
+ data,
22288
+ field
22289
+ } = params;
22290
+ const {
22291
+ props
22292
+ } = renderOpts;
22293
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22294
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22295
+ ...props,
22296
+ src: itemValue,
22297
+ ...getItemOns(renderOpts, params)
22298
+ })];
22299
+ }
22300
+ },
22301
+ VxeImageGroup: {
22982
22302
  renderFormItemContent(renderOpts, params) {
22983
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('select', {
22984
- class: 'vxe-default-select',
22985
- ...getNativeAttrs(renderOpts),
22986
- ...getNativeItemOns(renderOpts, params)
22987
- }, renderOpts.optionGroups ? renderNativeOptgroup(renderOpts, params, renderNativeFormOptions) : renderNativeFormOptions(renderOpts.options, renderOpts, params))];
22303
+ const {
22304
+ data,
22305
+ field
22306
+ } = params;
22307
+ const {
22308
+ props
22309
+ } = renderOpts;
22310
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22311
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
22312
+ ...props,
22313
+ urlList: itemValue,
22314
+ ...getItemOns(renderOpts, params)
22315
+ })];
22988
22316
  }
22989
22317
  },
22990
- VxeInput: {
22991
- formItemAutoFocus: 'input',
22992
- renderFormItemContent: defaultItemRender
22993
- },
22994
- VxeNumberInput: {
22995
- formItemAutoFocus: 'input',
22318
+ VxeUpload: {
22996
22319
  renderFormItemContent: defaultItemRender
22997
22320
  },
22998
- VxePasswordInput: {
22321
+ // 以下已废弃
22322
+ $input: {
22999
22323
  formItemAutoFocus: 'input',
23000
- renderFormItemContent: defaultItemRender
22324
+ renderFormItemContent: oldItemRender
23001
22325
  },
23002
- VxeTextarea: {
22326
+ $textarea: {
23003
22327
  formItemAutoFocus: 'textarea',
23004
- renderFormItemContent: defaultItemRender
22328
+ renderFormItemContent: oldItemRender
23005
22329
  },
23006
- VxeDatePicker: {
22330
+ $button: {
22331
+ renderFormItemContent: oldButtonItemRender
22332
+ },
22333
+ $buttons: {
22334
+ renderFormItemContent: oldButtonsItemRender
22335
+ },
22336
+ $select: {
23007
22337
  formItemAutoFocus: 'input',
23008
- renderFormItemContent: defaultItemRender
22338
+ renderFormItemContent(renderOpts, params) {
22339
+ const {
22340
+ data,
22341
+ field
22342
+ } = params;
22343
+ const {
22344
+ options,
22345
+ optionProps,
22346
+ optionGroups,
22347
+ optionGroupProps
22348
+ } = renderOpts;
22349
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22350
+ return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getOldComponent(renderOpts), {
22351
+ ...getComponentFormItemProps(renderOpts, params, itemValue, {
22352
+ options,
22353
+ optionProps,
22354
+ optionGroups,
22355
+ optionGroupProps
22356
+ }),
22357
+ ...getItemOns(renderOpts, params)
22358
+ })];
22359
+ }
22360
+ },
22361
+ $radio: {
22362
+ renderFormItemContent: oldFormItemRadioAndCheckboxRender
22363
+ },
22364
+ $checkbox: {
22365
+ renderFormItemContent: oldFormItemRadioAndCheckboxRender
22366
+ },
22367
+ $switch: {
22368
+ renderFormItemContent: oldItemRender
22369
+ }
22370
+ // 以上已废弃
22371
+ });
22372
+ ;// CONCATENATED MODULE: ./packages/form/src/form.ts
22373
+
22374
+
22375
+
22376
+
22377
+
22378
+
22379
+
22380
+
22381
+
22382
+
22383
+
22384
+
22385
+
22386
+
22387
+ class Rule {
22388
+ constructor(rule) {
22389
+ Object.assign(this, {
22390
+ $options: rule,
22391
+ required: rule.required,
22392
+ min: rule.min,
22393
+ max: rule.min,
22394
+ type: rule.type,
22395
+ pattern: rule.pattern,
22396
+ validator: rule.validator,
22397
+ trigger: rule.trigger,
22398
+ maxWidth: rule.maxWidth
22399
+ });
22400
+ }
22401
+ get content() {
22402
+ return getFuncText(this.$options.content || this.$options.message);
22403
+ }
22404
+ get message() {
22405
+ return this.content;
22406
+ }
22407
+ }
22408
+ // 如果存在 pattern,判断正则
22409
+ function validREValue(pattern, val) {
22410
+ if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
22411
+ return false;
22412
+ }
22413
+ return true;
22414
+ }
22415
+ // 如果存在 max,判断最大值
22416
+ function validMaxValue(max, num) {
22417
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(max) && num > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(max)) {
22418
+ return false;
22419
+ }
22420
+ return true;
22421
+ }
22422
+ // 如果存在 min,判断最小值
22423
+ function validMinValue(min, num) {
22424
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(min) && num < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(min)) {
22425
+ return false;
22426
+ }
22427
+ return true;
22428
+ }
22429
+ function validRuleValue(rule, val, required) {
22430
+ const {
22431
+ type,
22432
+ min,
22433
+ max,
22434
+ pattern
22435
+ } = rule;
22436
+ const isArrType = type === 'array';
22437
+ const isNumType = type === 'number';
22438
+ const isStrType = type === 'string';
22439
+ const strVal = `${val}`;
22440
+ if (!validREValue(pattern, strVal)) {
22441
+ return false;
22442
+ }
22443
+ if (isArrType) {
22444
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val)) {
22445
+ return false;
22446
+ }
22447
+ if (required) {
22448
+ if (!val.length) {
22449
+ return false;
22450
+ }
22451
+ }
22452
+ if (!validMinValue(min, val.length)) {
22453
+ return false;
22454
+ }
22455
+ if (!validMaxValue(max, val.length)) {
22456
+ return false;
22457
+ }
22458
+ } else if (isNumType) {
22459
+ const numVal = Number(val);
22460
+ if (isNaN(numVal)) {
22461
+ return false;
22462
+ }
22463
+ if (!validMinValue(min, numVal)) {
22464
+ return false;
22465
+ }
22466
+ if (!validMaxValue(max, numVal)) {
22467
+ return false;
22468
+ }
22469
+ } else {
22470
+ if (isStrType) {
22471
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val)) {
22472
+ return false;
22473
+ }
22474
+ }
22475
+ if (required) {
22476
+ if (!strVal) {
22477
+ return false;
22478
+ }
22479
+ }
22480
+ if (!validMinValue(min, strVal.length)) {
22481
+ return false;
22482
+ }
22483
+ if (!validMaxValue(max, strVal.length)) {
22484
+ return false;
22485
+ }
22486
+ }
22487
+ return true;
22488
+ }
22489
+ function checkRuleStatus(rule, val) {
22490
+ const {
22491
+ required
22492
+ } = rule;
22493
+ const isEmptyVal = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val) ? !val.length : eqEmptyValue(val);
22494
+ if (required) {
22495
+ if (isEmptyVal) {
22496
+ return false;
22497
+ }
22498
+ if (!validRuleValue(rule, val, required)) {
22499
+ return false;
22500
+ }
22501
+ } else {
22502
+ if (!isEmptyVal) {
22503
+ if (!validRuleValue(rule, val, required)) {
22504
+ return false;
22505
+ }
22506
+ }
22507
+ }
22508
+ return true;
22509
+ }
22510
+ function createInternalData() {
22511
+ return {
22512
+ meTimeout: undefined,
22513
+ stTimeout: undefined,
22514
+ tooltipStore: {
22515
+ item: null,
22516
+ visible: false
22517
+ },
22518
+ itemFormatCache: {}
22519
+ };
22520
+ }
22521
+ /* harmony default export */ var src_form = (defineVxeComponent({
22522
+ name: 'VxeForm',
22523
+ props: {
22524
+ collapseStatus: {
22525
+ type: Boolean,
22526
+ default: true
22527
+ },
22528
+ loading: Boolean,
22529
+ data: Object,
22530
+ size: {
22531
+ type: String,
22532
+ default: () => getConfig().form.size || getConfig().size
22533
+ },
22534
+ span: {
22535
+ type: [String, Number],
22536
+ default: () => getConfig().form.span
22537
+ },
22538
+ align: {
22539
+ type: String,
22540
+ default: () => getConfig().form.align
22541
+ },
22542
+ verticalAlign: {
22543
+ type: String,
22544
+ default: () => getConfig().form.verticalAlign
22545
+ },
22546
+ border: {
22547
+ type: Boolean,
22548
+ default: () => getConfig().form.border
22549
+ },
22550
+ titleBackground: {
22551
+ type: Boolean,
22552
+ default: () => getConfig().form.titleBackground
22553
+ },
22554
+ titleBold: {
22555
+ type: Boolean,
22556
+ default: () => getConfig().form.titleBold
22557
+ },
22558
+ titleAlign: {
22559
+ type: String,
22560
+ default: () => getConfig().form.titleAlign
22561
+ },
22562
+ titleWidth: {
22563
+ type: [String, Number],
22564
+ default: () => getConfig().form.titleWidth
22565
+ },
22566
+ titleColon: {
22567
+ type: Boolean,
22568
+ default: () => getConfig().form.titleColon
22569
+ },
22570
+ titleAsterisk: {
22571
+ type: Boolean,
22572
+ default: () => getConfig().form.titleAsterisk
22573
+ },
22574
+ titleOverflow: {
22575
+ type: [Boolean, String],
22576
+ default: () => getConfig().form.titleOverflow
22577
+ },
22578
+ vertical: {
22579
+ type: Boolean,
22580
+ default: () => getConfig().form.vertical
22581
+ },
22582
+ padding: {
22583
+ type: Boolean,
22584
+ default: () => getConfig().form.padding
22585
+ },
22586
+ className: [String, Function],
22587
+ readonly: Boolean,
22588
+ disabled: Boolean,
22589
+ items: Array,
22590
+ rules: Object,
22591
+ preventSubmit: {
22592
+ type: Boolean,
22593
+ default: () => getConfig().form.preventSubmit
22594
+ },
22595
+ validConfig: Object,
22596
+ tooltipConfig: Object,
22597
+ collapseConfig: Object,
22598
+ customLayout: {
22599
+ type: Boolean,
22600
+ default: () => getConfig().form.customLayout
22601
+ },
22602
+ params: Object
23009
22603
  },
23010
- VxeDateRangePicker: {
23011
- formItemAutoFocus: 'input',
23012
- renderFormItemContent(renderOpts, params) {
22604
+ emits: ['update:collapseStatus', 'collapse', 'toggle-collapse', 'submit', 'submit-invalid', 'reset'],
22605
+ setup(props, context) {
22606
+ const {
22607
+ slots,
22608
+ emit
22609
+ } = context;
22610
+ const $xeGrid = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGrid', null);
22611
+ const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
22612
+ const {
22613
+ computeSize
22614
+ } = useSize(props);
22615
+ const reactData = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)({
22616
+ collapseAll: props.collapseStatus,
22617
+ staticItems: [],
22618
+ formItems: [],
22619
+ itemWidth: 0
22620
+ });
22621
+ const internalData = createInternalData();
22622
+ const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
22623
+ const refTooltip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
22624
+ let formMethods = {};
22625
+ const computeValidOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
22626
+ return Object.assign({}, getConfig().form.validConfig, props.validConfig);
22627
+ });
22628
+ const computeTooltipOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
22629
+ return Object.assign({}, getConfig().tooltip, getConfig().form.tooltipConfig, props.tooltipConfig);
22630
+ });
22631
+ const computeCollapseOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
22632
+ return Object.assign({}, getConfig().form.collapseConfig, props.collapseConfig);
22633
+ });
22634
+ const computeAutoItemWidthList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
23013
22635
  const {
23014
- startField,
23015
- endField
23016
- } = renderOpts;
22636
+ titleWidth: allTitleWidth,
22637
+ vertical: allVertical
22638
+ } = props;
23017
22639
  const {
23018
- $form,
23019
- data,
23020
- field
23021
- } = params;
23022
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23023
- const seProps = {};
23024
- const seOs = {};
23025
- if (startField && endField) {
23026
- seProps.startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, startField);
23027
- seProps.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, endField);
23028
- seOs['onUpdate:startValue'] = value => {
23029
- if (startField) {
23030
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, startField, value);
22640
+ formItems
22641
+ } = reactData;
22642
+ const itemList = [];
22643
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(formItems, item => {
22644
+ const {
22645
+ titleWidth,
22646
+ vertical
22647
+ } = item;
22648
+ if (titleWidth === 'auto') {
22649
+ itemList.push(item);
22650
+ } else {
22651
+ const itemVertical = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(vertical) ? allVertical : vertical;
22652
+ const itemTitleWidth = itemVertical ? null : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(titleWidth) ? allTitleWidth : titleWidth;
22653
+ if (itemTitleWidth === 'auto' && (!item.children || !item.children.length)) {
22654
+ itemList.push(item);
23031
22655
  }
23032
- };
23033
- seOs['onUpdate:endValue'] = value => {
23034
- if (endField) {
23035
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, endField, value);
22656
+ }
22657
+ }, {
22658
+ children: 'children'
22659
+ });
22660
+ return itemList;
22661
+ });
22662
+ const refMaps = {
22663
+ refElem
22664
+ };
22665
+ const computeMaps = {
22666
+ computeSize,
22667
+ computeValidOpts,
22668
+ computeTooltipOpts,
22669
+ computeCollapseOpts,
22670
+ computeAutoItemWidthList
22671
+ };
22672
+ const $xeForm = {
22673
+ xID,
22674
+ props,
22675
+ context,
22676
+ reactData,
22677
+ internalData,
22678
+ xeGrid: $xeGrid,
22679
+ getRefMaps: () => refMaps,
22680
+ getComputeMaps: () => computeMaps
22681
+ };
22682
+ const callSlot = (slotFunc, params) => {
22683
+ if (slotFunc) {
22684
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
22685
+ slotFunc = slots[slotFunc] || null;
22686
+ }
22687
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(slotFunc)) {
22688
+ return vn_getSlotVNs(slotFunc(params));
22689
+ }
22690
+ }
22691
+ return [];
22692
+ };
22693
+ const loadItem = list => {
22694
+ if (list.length) {
22695
+ list.forEach(item => {
22696
+ if (item.slots) {
22697
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(item.slots, func => {
22698
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
22699
+ if (!slots[func]) {
22700
+ errLog('vxe.error.notSlot', [func]);
22701
+ }
22702
+ }
22703
+ });
22704
+ }
22705
+ });
22706
+ }
22707
+ reactData.staticItems = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(list, item => createItem($xeForm, item), {
22708
+ children: 'children'
22709
+ });
22710
+ internalData.itemFormatCache = {};
22711
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
22712
+ return recalculate();
22713
+ });
22714
+ };
22715
+ const getItems = () => {
22716
+ const itemList = [];
22717
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(reactData.formItems, item => {
22718
+ itemList.push(item);
22719
+ }, {
22720
+ children: 'children'
22721
+ });
22722
+ return itemList;
22723
+ };
22724
+ const getItemByField = field => {
22725
+ const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(reactData.formItems, item => item.field === field, {
22726
+ children: 'children'
22727
+ });
22728
+ return rest ? rest.item : null;
22729
+ };
22730
+ const getCollapseStatus = () => {
22731
+ return reactData.collapseAll;
22732
+ };
22733
+ const toggleCollapse = () => {
22734
+ const status = !getCollapseStatus();
22735
+ reactData.collapseAll = status;
22736
+ emit('update:collapseStatus', status);
22737
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22738
+ };
22739
+ const toggleCollapseEvent = evnt => {
22740
+ toggleCollapse();
22741
+ const status = getCollapseStatus();
22742
+ formMethods.dispatchEvent('toggle-collapse', {
22743
+ status,
22744
+ collapse: status,
22745
+ data: props.data
22746
+ }, evnt);
22747
+ formMethods.dispatchEvent('collapse', {
22748
+ status,
22749
+ collapse: status,
22750
+ data: props.data
22751
+ }, evnt);
22752
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
22753
+ recalculate();
22754
+ if ($xeGrid) {
22755
+ $xeGrid.recalculate();
22756
+ }
22757
+ });
22758
+ };
22759
+ const clearValidate = fieldOrItem => {
22760
+ if (fieldOrItem) {
22761
+ let fields = fieldOrItem;
22762
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrItem)) {
22763
+ fields = [fieldOrItem];
22764
+ }
22765
+ fields.forEach(field => {
22766
+ if (field) {
22767
+ const item = handleFieldOrItem($xeForm, field);
22768
+ if (item) {
22769
+ item.showError = false;
22770
+ }
22771
+ }
22772
+ });
22773
+ } else {
22774
+ getItems().forEach(item => {
22775
+ item.showError = false;
22776
+ });
22777
+ }
22778
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
22779
+ };
22780
+ const getResetValue = (item, data, itemValue) => {
22781
+ const {
22782
+ field,
22783
+ resetValue
22784
+ } = item;
22785
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resetValue)) {
22786
+ return resetValue({
22787
+ field,
22788
+ item,
22789
+ data,
22790
+ $form: $xeForm,
22791
+ $grid: $xeGrid
22792
+ });
22793
+ } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(resetValue)) {
22794
+ // 默认
22795
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(itemValue)) {
22796
+ return [];
22797
+ }
22798
+ }
22799
+ return resetValue;
22800
+ };
22801
+ const reset = () => {
22802
+ const {
22803
+ data
22804
+ } = props;
22805
+ const itemList = getItems();
22806
+ if (data) {
22807
+ itemList.forEach(item => {
22808
+ const {
22809
+ field,
22810
+ itemRender
22811
+ } = item;
22812
+ if (isEnableConf(itemRender)) {
22813
+ const {
22814
+ name,
22815
+ startField,
22816
+ endField
22817
+ } = itemRender;
22818
+ const compConf = renderer.get(name);
22819
+ const fiResetMethod = compConf ? compConf.formItemResetMethod || compConf.itemResetMethod : null;
22820
+ if (compConf && fiResetMethod) {
22821
+ fiResetMethod({
22822
+ data,
22823
+ field,
22824
+ property: field,
22825
+ item,
22826
+ $form: $xeForm,
22827
+ $grid: $xeGrid
22828
+ });
22829
+ } else if (field) {
22830
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
22831
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, getResetValue(item, data, itemValue));
22832
+ }
22833
+ if (startField && endField) {
22834
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, startField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, startField)));
22835
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, endField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, endField)));
22836
+ }
23036
22837
  }
23037
- };
22838
+ });
23038
22839
  }
23039
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23040
- ...getComponentFormItemProps(renderOpts, params, itemValue, seProps),
23041
- ...getComponentOns(renderOpts, params, {
23042
- model(value) {
23043
- // 处理 model 值双向绑定
23044
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, value);
23045
- },
23046
- change() {
23047
- // 处理 change 事件相关逻辑
23048
- $form.updateStatus(params);
22840
+ internalData.itemFormatCache = {};
22841
+ clearValidate();
22842
+ return recalculate();
22843
+ };
22844
+ const resetEvent = evnt => {
22845
+ evnt.preventDefault();
22846
+ reset();
22847
+ formMethods.dispatchEvent('reset', {
22848
+ data: props.data
22849
+ }, evnt);
22850
+ };
22851
+ const handleFocus = fields => {
22852
+ const el = refElem.value;
22853
+ if (el) {
22854
+ for (let i = 0; i < fields.length; i++) {
22855
+ const field = fields[i];
22856
+ const item = getItemByField(field);
22857
+ if (item && isEnableConf(item.itemRender)) {
22858
+ const {
22859
+ itemRender
22860
+ } = item;
22861
+ const compConf = renderer.get(itemRender.name);
22862
+ // 定位到第一个
22863
+ if (!i) {
22864
+ scrollToView(el.querySelector(`.${item.id}`));
22865
+ }
22866
+ let inputElem = null;
22867
+ const autoFocus = itemRender.autoFocus || itemRender.autofocus || (compConf ? compConf.formItemAutoFocus : null);
22868
+ // 如果指定了聚焦 class
22869
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(autoFocus)) {
22870
+ inputElem = autoFocus({
22871
+ $form: $xeForm,
22872
+ $grid: $xeGrid,
22873
+ item,
22874
+ data: props.data,
22875
+ field
22876
+ });
22877
+ } else {
22878
+ if (autoFocus === true) {
22879
+ // 自动匹配模式,会自动匹配第一个可输入元素
22880
+ inputElem = el.querySelector(`.${item.id} input,textarea`);
22881
+ } else if (autoFocus) {
22882
+ inputElem = el.querySelector(`.${item.id} ${autoFocus}`);
22883
+ }
22884
+ }
22885
+ if (inputElem) {
22886
+ inputElem.focus();
22887
+ break;
22888
+ }
23049
22889
  }
23050
- }, seOs)
23051
- })];
23052
- }
23053
- },
23054
- VxeButton: {
23055
- renderFormItemContent: defaultFormItemRender
23056
- },
23057
- VxeButtonGroup: {
23058
- renderFormItemContent(renderOpts, params) {
23059
- const {
23060
- options
23061
- } = renderOpts;
23062
- const {
23063
- data,
23064
- field
23065
- } = params;
23066
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23067
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23068
- options,
23069
- ...getComponentFormItemProps(renderOpts, params, itemValue),
23070
- ...getItemOns(renderOpts, params)
23071
- })];
23072
- }
23073
- },
23074
- VxeSelect: {
23075
- formItemAutoFocus: 'input',
23076
- renderFormItemContent(renderOpts, params) {
23077
- const {
23078
- data,
23079
- field
23080
- } = params;
23081
- const {
23082
- options,
23083
- optionProps,
23084
- optionGroups,
23085
- optionGroupProps
23086
- } = renderOpts;
23087
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23088
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23089
- ...getComponentFormItemProps(renderOpts, params, itemValue, {
23090
- options,
23091
- optionProps,
23092
- optionGroups,
23093
- optionGroupProps
23094
- }),
23095
- ...getItemOns(renderOpts, params)
23096
- })];
23097
- }
23098
- },
23099
- VxeTreeSelect: {
23100
- formItemAutoFocus: 'input',
23101
- renderFormItemContent(renderOpts, params) {
22890
+ }
22891
+ }
22892
+ };
22893
+ /**
22894
+ * 校验数据
22895
+ * 按表格行、列顺序依次校验(同步或异步)
22896
+ * 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
22897
+ * 如果校验失败则,触发回调或者 Promise<(ErrMap 校验不通过列的信息)>
22898
+ * 如果是传回调方式这返回一个 (ErrMap 校验不通过列的信息)
22899
+ *
22900
+ * rule 配置:
22901
+ * required=Boolean 是否必填
22902
+ * min=Number 最小长度
22903
+ * max=Number 最大长度
22904
+ * validator=Function({ itemValue, rule, rules, data, property }) 自定义校验,接收一个 Promise
22905
+ * trigger=change 触发方式
22906
+ */
22907
+ const validItemRules = (validType, fields, val) => {
23102
22908
  const {
23103
22909
  data,
23104
- field
23105
- } = params;
23106
- const {
23107
- options,
23108
- optionProps
23109
- } = renderOpts;
23110
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23111
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23112
- ...getComponentFormItemProps(renderOpts, params, itemValue, {
23113
- options,
23114
- optionProps
23115
- }),
23116
- ...getItemOns(renderOpts, params)
23117
- })];
23118
- }
23119
- },
23120
- VxeTableSelect: {
23121
- formItemAutoFocus: 'input',
23122
- renderFormItemContent(renderOpts, params) {
22910
+ rules: formRules
22911
+ } = props;
22912
+ const errorMaps = {};
22913
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fields)) {
22914
+ fields = [fields];
22915
+ }
22916
+ return Promise.all(fields.map(property => {
22917
+ const errorRules = [];
22918
+ const syncVailds = [];
22919
+ if (property && formRules) {
22920
+ const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(formRules, property);
22921
+ if (rules) {
22922
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(val) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, property) : val;
22923
+ rules.forEach(rule => {
22924
+ const {
22925
+ trigger,
22926
+ validator
22927
+ } = rule;
22928
+ if (validType === 'all' || !trigger || validType === trigger) {
22929
+ if (validator) {
22930
+ const validParams = {
22931
+ itemValue,
22932
+ rule,
22933
+ rules,
22934
+ data,
22935
+ field: property,
22936
+ property,
22937
+ $form: $xeForm
22938
+ };
22939
+ let customValid;
22940
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
22941
+ const gvItem = validators.get(validator);
22942
+ if (gvItem) {
22943
+ const validatorMethod = gvItem.formItemValidatorMethod || gvItem.itemValidatorMethod;
22944
+ if (validatorMethod) {
22945
+ customValid = validatorMethod(validParams);
22946
+ } else {
22947
+ warnLog('vxe.error.notValidators', [validator]);
22948
+ }
22949
+ } else {
22950
+ errLog('vxe.error.notValidators', [validator]);
22951
+ }
22952
+ } else {
22953
+ customValid = validator(validParams);
22954
+ }
22955
+ if (customValid) {
22956
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
22957
+ errorRules.push(new Rule({
22958
+ type: 'custom',
22959
+ trigger,
22960
+ content: customValid.message,
22961
+ rule: new Rule(rule)
22962
+ }));
22963
+ } else if (customValid.catch) {
22964
+ // 如果为异步校验(注:异步校验是并发无序的)
22965
+ syncVailds.push(customValid.catch(e => {
22966
+ errorRules.push(new Rule({
22967
+ type: 'custom',
22968
+ trigger,
22969
+ content: e ? e.message : rule.content || rule.message,
22970
+ rule: new Rule(rule)
22971
+ }));
22972
+ }));
22973
+ }
22974
+ }
22975
+ } else {
22976
+ if (!checkRuleStatus(rule, itemValue)) {
22977
+ errorRules.push(new Rule(rule));
22978
+ }
22979
+ }
22980
+ }
22981
+ });
22982
+ }
22983
+ }
22984
+ return Promise.all(syncVailds).then(() => {
22985
+ if (errorRules.length) {
22986
+ errorMaps[property] = errorRules.map(rule => {
22987
+ return {
22988
+ $form: $xeForm,
22989
+ rule,
22990
+ data,
22991
+ field: property,
22992
+ property
22993
+ };
22994
+ });
22995
+ }
22996
+ });
22997
+ })).then(() => {
22998
+ if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEmpty(errorMaps)) {
22999
+ return Promise.reject(errorMaps);
23000
+ }
23001
+ });
23002
+ };
23003
+ const beginValidate = (itemList, type, callback) => {
23123
23004
  const {
23124
23005
  data,
23125
- field
23126
- } = params;
23127
- const {
23128
- options,
23129
- optionProps
23130
- } = renderOpts;
23131
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23132
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23133
- ...getComponentFormItemProps(renderOpts, params, itemValue, {
23134
- options,
23135
- optionProps
23136
- }),
23137
- ...getItemOns(renderOpts, params)
23138
- })];
23139
- }
23140
- },
23141
- VxeColorPicker: {
23142
- formItemAutoFocus: 'input',
23143
- renderFormItemContent(renderOpts, params) {
23006
+ rules: formRules
23007
+ } = props;
23008
+ const validOpts = computeValidOpts.value;
23009
+ const validRest = {};
23010
+ const validFields = [];
23011
+ const itemValids = [];
23012
+ clearTimeout(internalData.meTimeout);
23013
+ if (data && formRules) {
23014
+ itemList.forEach(item => {
23015
+ const {
23016
+ field
23017
+ } = item;
23018
+ if (field && !isHiddenItem($xeForm, item) && isActiveItem($xeForm, item)) {
23019
+ itemValids.push(validItemRules(type || 'all', field).then(() => {
23020
+ item.errRule = null;
23021
+ }).catch(errorMaps => {
23022
+ const rest = errorMaps[field];
23023
+ if (!validRest[field]) {
23024
+ validRest[field] = [];
23025
+ }
23026
+ validRest[field].push(rest);
23027
+ validFields.push(field);
23028
+ item.errRule = rest[0].rule;
23029
+ return Promise.reject(rest);
23030
+ }));
23031
+ }
23032
+ });
23033
+ return Promise.all(itemValids).then(() => {
23034
+ if (callback) {
23035
+ callback();
23036
+ }
23037
+ }).catch(() => {
23038
+ return new Promise(resolve => {
23039
+ internalData.meTimeout = setTimeout(() => {
23040
+ itemList.forEach(item => {
23041
+ if (item.errRule) {
23042
+ item.showError = true;
23043
+ }
23044
+ });
23045
+ }, 20);
23046
+ if (validOpts.autoPos !== false) {
23047
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
23048
+ handleFocus(validFields);
23049
+ });
23050
+ }
23051
+ if (callback) {
23052
+ callback(validRest);
23053
+ resolve();
23054
+ } else {
23055
+ resolve(validRest);
23056
+ }
23057
+ });
23058
+ });
23059
+ }
23060
+ if (callback) {
23061
+ callback();
23062
+ }
23063
+ return Promise.resolve();
23064
+ };
23065
+ const validate = callback => {
23144
23066
  const {
23145
- data,
23146
- field
23147
- } = params;
23067
+ readonly
23068
+ } = props;
23069
+ clearValidate();
23070
+ if (readonly) {
23071
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
23072
+ }
23073
+ return beginValidate(getItems(), '', callback).then(params => {
23074
+ recalculate();
23075
+ return params;
23076
+ });
23077
+ };
23078
+ const validateField = (fieldOrItem, callback) => {
23148
23079
  const {
23149
- options
23150
- } = renderOpts;
23151
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23152
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23153
- ...getComponentFormItemProps(renderOpts, params, itemValue, {
23154
- colors: options
23155
- }),
23156
- ...getItemOns(renderOpts, params)
23157
- })];
23158
- }
23159
- },
23160
- VxeIconPicker: {
23161
- formItemAutoFocus: 'input',
23162
- renderFormItemContent(renderOpts, params) {
23080
+ readonly
23081
+ } = props;
23082
+ if (readonly) {
23083
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
23084
+ }
23085
+ let fields = [];
23086
+ if (fieldOrItem) {
23087
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrItem)) {
23088
+ fields = fieldOrItem;
23089
+ } else {
23090
+ fields = [fieldOrItem];
23091
+ }
23092
+ }
23093
+ return beginValidate(fields.map(field => handleFieldOrItem($xeForm, field)), '', callback).then(params => {
23094
+ recalculate();
23095
+ return params;
23096
+ });
23097
+ };
23098
+ const submitEvent = evnt => {
23163
23099
  const {
23164
- data,
23165
- field
23166
- } = params;
23100
+ readonly
23101
+ } = props;
23102
+ evnt.preventDefault();
23103
+ if (!props.preventSubmit) {
23104
+ clearValidate();
23105
+ if (readonly) {
23106
+ formMethods.dispatchEvent('submit', {
23107
+ data: props.data
23108
+ }, evnt);
23109
+ recalculate();
23110
+ return;
23111
+ }
23112
+ beginValidate(getItems()).then(errMap => {
23113
+ if (errMap) {
23114
+ formMethods.dispatchEvent('submit-invalid', {
23115
+ data: props.data,
23116
+ errMap
23117
+ }, evnt);
23118
+ } else {
23119
+ formMethods.dispatchEvent('submit', {
23120
+ data: props.data
23121
+ }, evnt);
23122
+ }
23123
+ recalculate();
23124
+ });
23125
+ }
23126
+ };
23127
+ const closeTooltip = () => {
23167
23128
  const {
23168
- options
23169
- } = renderOpts;
23170
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23171
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23172
- ...getComponentFormItemProps(renderOpts, params, itemValue, {
23173
- icons: options
23174
- }),
23175
- ...getItemOns(renderOpts, params)
23176
- })];
23177
- }
23178
- },
23179
- VxeRadio: {
23180
- renderFormItemContent: defaultFormItemRender
23181
- },
23182
- VxeRadioGroup: {
23183
- renderFormItemContent: formItemRadioAndCheckboxRender
23184
- },
23185
- VxeCheckbox: {
23186
- renderFormItemContent: defaultFormItemRender
23187
- },
23188
- VxeCheckboxGroup: {
23189
- renderFormItemContent: formItemRadioAndCheckboxRender
23190
- },
23191
- VxeSwitch: {
23192
- renderFormItemContent: defaultItemRender
23193
- },
23194
- VxeRate: {
23195
- renderFormItemContent: defaultItemRender
23196
- },
23197
- VxeSlider: {
23198
- renderFormItemContent: defaultItemRender
23199
- },
23200
- VxeImage: {
23201
- renderFormItemContent(renderOpts, params) {
23129
+ tooltipStore
23130
+ } = internalData;
23131
+ const $tooltip = refTooltip.value;
23132
+ if (tooltipStore.visible) {
23133
+ Object.assign(tooltipStore, {
23134
+ item: null,
23135
+ visible: false
23136
+ });
23137
+ if ($tooltip) {
23138
+ $tooltip.close();
23139
+ }
23140
+ }
23141
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
23142
+ };
23143
+ const triggerTitleTipEvent = (evnt, params) => {
23202
23144
  const {
23203
- data,
23204
- field
23145
+ item
23205
23146
  } = params;
23206
23147
  const {
23207
- props
23208
- } = renderOpts;
23209
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23210
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23211
- ...props,
23212
- src: itemValue,
23213
- ...getItemOns(renderOpts, params)
23214
- })];
23215
- }
23216
- },
23217
- VxeImageGroup: {
23218
- renderFormItemContent(renderOpts, params) {
23148
+ tooltipStore
23149
+ } = internalData;
23150
+ const $tooltip = refTooltip.value;
23151
+ const overflowElem = evnt.currentTarget.children[0];
23152
+ const content = (overflowElem.textContent || '').trim();
23153
+ const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
23154
+ clearTimeout(internalData.stTimeout);
23155
+ if (tooltipStore.item !== item) {
23156
+ closeTooltip();
23157
+ }
23158
+ if (content && isCellOverflow) {
23159
+ Object.assign(tooltipStore, {
23160
+ item,
23161
+ visible: true
23162
+ });
23163
+ if ($tooltip) {
23164
+ $tooltip.open(overflowElem, content);
23165
+ }
23166
+ }
23167
+ };
23168
+ const handleTitleTipLeaveEvent = () => {
23169
+ const tooltipOpts = computeTooltipOpts.value;
23170
+ let $tooltip = refTooltip.value;
23171
+ if ($tooltip) {
23172
+ $tooltip.setActived(false);
23173
+ }
23174
+ if (tooltipOpts.enterable) {
23175
+ internalData.stTimeout = setTimeout(() => {
23176
+ $tooltip = refTooltip.value;
23177
+ if ($tooltip && !$tooltip.isActived()) {
23178
+ closeTooltip();
23179
+ }
23180
+ }, tooltipOpts.leaveDelay);
23181
+ } else {
23182
+ closeTooltip();
23183
+ }
23184
+ };
23185
+ const triggerItemEvent = (evnt, field, itemValue) => {
23186
+ if (field) {
23187
+ return validItemRules(evnt ? ['blur'].includes(evnt.type) ? 'blur' : 'change' : 'all', field, itemValue).then(() => {
23188
+ clearValidate(field);
23189
+ }).catch(errorMaps => {
23190
+ const rest = errorMaps[field];
23191
+ const item = getItemByField(field);
23192
+ if (rest && item) {
23193
+ item.showError = true;
23194
+ item.errRule = rest[0].rule;
23195
+ }
23196
+ });
23197
+ }
23198
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
23199
+ };
23200
+ /**
23201
+ * 更新项状态
23202
+ * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
23203
+ * 如果单元格配置了校验规则,则会进行校验
23204
+ */
23205
+ const updateStatus = (scope, itemValue) => {
23219
23206
  const {
23220
- data,
23221
23207
  field
23222
- } = params;
23223
- const {
23224
- props
23225
- } = renderOpts;
23226
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23227
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
23228
- ...props,
23229
- urlList: itemValue,
23230
- ...getItemOns(renderOpts, params)
23231
- })];
23232
- }
23233
- },
23234
- VxeUpload: {
23235
- renderFormItemContent: defaultItemRender
23236
- },
23237
- // 以下已废弃
23238
- $input: {
23239
- formItemAutoFocus: 'input',
23240
- renderFormItemContent: oldItemRender
23241
- },
23242
- $textarea: {
23243
- formItemAutoFocus: 'textarea',
23244
- renderFormItemContent: oldItemRender
23245
- },
23246
- $button: {
23247
- renderFormItemContent: oldButtonItemRender
23248
- },
23249
- $buttons: {
23250
- renderFormItemContent: oldButtonsItemRender
23251
- },
23252
- $select: {
23253
- formItemAutoFocus: 'input',
23254
- renderFormItemContent(renderOpts, params) {
23208
+ } = scope;
23209
+ return triggerItemEvent(new Event('change'), field, itemValue);
23210
+ };
23211
+ const recalculate = () => {
23212
+ const autoItemWidthList = computeAutoItemWidthList.value;
23213
+ const el = refElem.value;
23214
+ if (el && autoItemWidthList.length) {
23215
+ const itemElList = el.querySelectorAll(autoItemWidthList.map(item => `.vxe-form--item-title[itemid="${item.id}"]`).join(','));
23216
+ let maxItemWidth = 0;
23217
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(itemElList, itemEl => {
23218
+ itemEl.style.width = '';
23219
+ maxItemWidth = Math.max(maxItemWidth, Math.ceil(itemEl.clientWidth + 2));
23220
+ });
23221
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(itemElList, itemEl => {
23222
+ itemEl.style.width = `${maxItemWidth}px`;
23223
+ });
23224
+ }
23225
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
23226
+ };
23227
+ const handleGlobalResizeEvent = () => {
23228
+ recalculate();
23229
+ };
23230
+ formMethods = {
23231
+ dispatchEvent(type, params, evnt) {
23232
+ emit(type, createEvent(evnt, {
23233
+ $form: $xeForm,
23234
+ $grid: $xeGrid
23235
+ }, params));
23236
+ },
23237
+ reset,
23238
+ validate,
23239
+ validateField,
23240
+ clearValidate,
23241
+ updateStatus,
23242
+ toggleCollapse,
23243
+ getItems,
23244
+ getItemByField,
23245
+ closeTooltip,
23246
+ recalculate
23247
+ };
23248
+ const formPrivateMethods = {
23249
+ callSlot,
23250
+ triggerItemEvent,
23251
+ toggleCollapseEvent,
23252
+ triggerTitleTipEvent,
23253
+ handleTitleTipLeaveEvent
23254
+ };
23255
+ Object.assign($xeForm, formMethods, formPrivateMethods);
23256
+ const renderVN = () => {
23255
23257
  const {
23258
+ loading,
23259
+ border,
23260
+ className,
23256
23261
  data,
23257
- field
23258
- } = params;
23262
+ customLayout
23263
+ } = props;
23259
23264
  const {
23260
- options,
23261
- optionProps,
23262
- optionGroups,
23263
- optionGroupProps
23264
- } = renderOpts;
23265
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
23266
- return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getOldComponent(renderOpts), {
23267
- ...getComponentFormItemProps(renderOpts, params, itemValue, {
23268
- options,
23269
- optionProps,
23270
- optionGroups,
23271
- optionGroupProps
23272
- }),
23273
- ...getItemOns(renderOpts, params)
23274
- })];
23265
+ formItems
23266
+ } = reactData;
23267
+ const vSize = computeSize.value;
23268
+ const tooltipOpts = computeTooltipOpts.value;
23269
+ const defaultSlot = slots.default;
23270
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('form', {
23271
+ ref: refElem,
23272
+ class: ['vxe-form', className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(className) ? className({
23273
+ items: formItems,
23274
+ data,
23275
+ $form: $xeForm
23276
+ }) : className : '', {
23277
+ [`size--${vSize}`]: vSize,
23278
+ 'is--border': border,
23279
+ 'custom--layout': customLayout,
23280
+ 'is--loading': loading
23281
+ }],
23282
+ onSubmit: submitEvent,
23283
+ onReset: resetEvent
23284
+ }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
23285
+ class: 'vxe-form--wrapper vxe-form--item-row'
23286
+ }, customLayout ? defaultSlot ? defaultSlot({}) : [] : formItems.map((item, index) => {
23287
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(form_config_item, {
23288
+ key: index,
23289
+ itemConfig: item
23290
+ });
23291
+ })), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
23292
+ class: 'vxe-form-slots',
23293
+ ref: 'hideItem'
23294
+ }, customLayout ? [] : defaultSlot ? defaultSlot({}) : []),
23295
+ /**
23296
+ * 加载中
23297
+ */
23298
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(src_loading, {
23299
+ class: 'vxe-form--loading',
23300
+ modelValue: loading
23301
+ }),
23302
+ /**
23303
+ * 工具提示
23304
+ */
23305
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(tooltip, {
23306
+ ref: refTooltip,
23307
+ ...tooltipOpts
23308
+ })]);
23309
+ };
23310
+ const staticItemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
23311
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems.length, () => {
23312
+ staticItemFlag.value++;
23313
+ });
23314
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems, () => {
23315
+ staticItemFlag.value++;
23316
+ });
23317
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(staticItemFlag, () => {
23318
+ reactData.formItems = reactData.staticItems;
23319
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
23320
+ recalculate();
23321
+ });
23322
+ });
23323
+ const itemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
23324
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items ? props.items.length : -1, () => {
23325
+ itemFlag.value++;
23326
+ });
23327
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items, () => {
23328
+ itemFlag.value++;
23329
+ });
23330
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(itemFlag, () => {
23331
+ loadItem(props.items || []);
23332
+ });
23333
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.collapseStatus, value => {
23334
+ reactData.collapseAll = !!value;
23335
+ });
23336
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.readonly, () => {
23337
+ clearValidate();
23338
+ });
23339
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.disabled, () => {
23340
+ clearValidate();
23341
+ });
23342
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
23343
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
23344
+ if (props.customLayout && props.items) {
23345
+ errLog('vxe.error.errConflicts', ['custom-layout', 'items']);
23346
+ }
23347
+ });
23348
+ globalEvents.on($xeForm, 'resize', handleGlobalResizeEvent);
23349
+ });
23350
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onUnmounted)(() => {
23351
+ globalEvents.off($xeForm, 'resize');
23352
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
23353
+ });
23354
+ if (props.items) {
23355
+ loadItem(props.items);
23275
23356
  }
23357
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('xeFormItemInfo', null);
23358
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeForm', $xeForm);
23359
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormGroup', null);
23360
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormItem', null);
23361
+ $xeForm.renderVN = renderVN;
23362
+ return $xeForm;
23276
23363
  },
23277
- $radio: {
23278
- renderFormItemContent: oldFormItemRadioAndCheckboxRender
23279
- },
23280
- $checkbox: {
23281
- renderFormItemContent: oldFormItemRadioAndCheckboxRender
23282
- },
23283
- $switch: {
23284
- renderFormItemContent: oldItemRender
23364
+ render() {
23365
+ return this.renderVN();
23285
23366
  }
23286
- // 以上已废弃
23287
- });
23367
+ }));
23288
23368
  ;// CONCATENATED MODULE: ./packages/form/index.ts
23289
23369
 
23290
23370
 
23291
23371
 
23292
-
23293
23372
  const VxeForm = Object.assign(src_form, {
23294
23373
  install(app) {
23295
23374
  app.component(src_form.name, src_form);
@@ -23438,6 +23517,7 @@ const formItemProps = {
23438
23517
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
23439
23518
  ref: refElem,
23440
23519
  key: item.id,
23520
+ itemid: item.id,
23441
23521
  class: getItemClass($xeForm, item),
23442
23522
  style: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(itemStyle) ? itemStyle(params) : itemStyle
23443
23523
  }, [renderTitle($xeForm, item), showContent === false ? renderEmptyElement($xeFormitem) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
@@ -23535,6 +23615,7 @@ const formItemProps = {
23535
23615
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
23536
23616
  ref: refElem,
23537
23617
  key: item.id,
23618
+ itemid: item.id,
23538
23619
  class: getItemClass($xeForm, item, true),
23539
23620
  style: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(itemStyle) ? itemStyle(params) : itemStyle
23540
23621
  }, [renderTitle($xeForm, item, true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {