vxe-pc-ui 4.14.25 → 4.14.27

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 (74) hide show
  1. package/dist/all.esm.js +293 -206
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/form/src/form-config-item.js +10 -6
  5. package/es/form/src/form.js +55 -15
  6. package/es/form/style.css +2 -2
  7. package/es/form/style.min.css +1 -1
  8. package/es/radio/style.css +2 -2
  9. package/es/radio/style.min.css +1 -1
  10. package/es/style.css +1 -1
  11. package/es/style.min.css +1 -1
  12. package/es/textarea/src/textarea.js +70 -25
  13. package/es/textarea/style.css +11 -4
  14. package/es/textarea/style.min.css +1 -1
  15. package/es/ui/index.js +1 -1
  16. package/es/ui/src/log.js +1 -1
  17. package/es/vxe-form/style.css +2 -2
  18. package/es/vxe-form/style.min.css +1 -1
  19. package/es/vxe-radio/style.css +2 -2
  20. package/es/vxe-radio/style.min.css +1 -1
  21. package/es/vxe-textarea/style.css +11 -4
  22. package/es/vxe-textarea/style.min.css +1 -1
  23. package/lib/form/src/form-config-item.js +11 -4
  24. package/lib/form/src/form-config-item.min.js +1 -1
  25. package/lib/form/src/form.js +69 -17
  26. package/lib/form/src/form.min.js +1 -1
  27. package/lib/form/style/style.css +2 -2
  28. package/lib/form/style/style.min.css +1 -1
  29. package/lib/index.umd.js +337 -223
  30. package/lib/index.umd.min.js +1 -1
  31. package/lib/radio/style/style.css +2 -2
  32. package/lib/radio/style/style.min.css +1 -1
  33. package/lib/style.css +1 -1
  34. package/lib/style.min.css +1 -1
  35. package/lib/textarea/src/textarea.js +81 -26
  36. package/lib/textarea/src/textarea.min.js +1 -1
  37. package/lib/textarea/style/style.css +11 -4
  38. package/lib/textarea/style/style.min.css +1 -1
  39. package/lib/ui/index.js +1 -1
  40. package/lib/ui/index.min.js +1 -1
  41. package/lib/ui/src/log.js +1 -1
  42. package/lib/ui/src/log.min.js +1 -1
  43. package/lib/vxe-form/style/style.css +2 -2
  44. package/lib/vxe-form/style/style.min.css +1 -1
  45. package/lib/vxe-radio/style/style.css +2 -2
  46. package/lib/vxe-radio/style/style.min.css +1 -1
  47. package/lib/vxe-textarea/style/style.css +11 -4
  48. package/lib/vxe-textarea/style/style.min.css +1 -1
  49. package/package.json +1 -1
  50. package/packages/form/src/form-config-item.ts +12 -4
  51. package/packages/form/src/form.ts +58 -15
  52. package/packages/form/src/util.ts +1 -1
  53. package/packages/textarea/src/textarea.ts +73 -28
  54. package/styles/components/form.scss +2 -2
  55. package/styles/components/radio.scss +2 -2
  56. package/styles/components/textarea.scss +11 -4
  57. package/types/components/column.d.ts +1 -0
  58. package/types/components/form.d.ts +22 -3
  59. package/types/components/notice-bar.d.ts +4 -0
  60. package/types/components/table-plugins/extend-cell-area.d.ts +11 -0
  61. package/types/components/table.d.ts +4 -0
  62. package/types/components/textarea.d.ts +22 -1
  63. /package/es/icon/{iconfont.1780114491819.ttf → iconfont.1780477619002.ttf} +0 -0
  64. /package/es/icon/{iconfont.1780114491819.woff → iconfont.1780477619002.woff} +0 -0
  65. /package/es/icon/{iconfont.1780114491819.woff2 → iconfont.1780477619002.woff2} +0 -0
  66. /package/es/{iconfont.1780114491819.ttf → iconfont.1780477619002.ttf} +0 -0
  67. /package/es/{iconfont.1780114491819.woff → iconfont.1780477619002.woff} +0 -0
  68. /package/es/{iconfont.1780114491819.woff2 → iconfont.1780477619002.woff2} +0 -0
  69. /package/lib/icon/style/{iconfont.1780114491819.ttf → iconfont.1780477619002.ttf} +0 -0
  70. /package/lib/icon/style/{iconfont.1780114491819.woff → iconfont.1780477619002.woff} +0 -0
  71. /package/lib/icon/style/{iconfont.1780114491819.woff2 → iconfont.1780477619002.woff2} +0 -0
  72. /package/lib/{iconfont.1780114491819.ttf → iconfont.1780477619002.ttf} +0 -0
  73. /package/lib/{iconfont.1780114491819.woff → iconfont.1780477619002.woff} +0 -0
  74. /package/lib/{iconfont.1780114491819.woff2 → iconfont.1780477619002.woff2} +0 -0
package/dist/all.esm.js CHANGED
@@ -80,11 +80,11 @@ function checkDynamic() {
80
80
  }
81
81
  }
82
82
 
83
- const version$1 = `ui v${"4.14.25"}`;
83
+ const version$1 = `ui v${"4.14.27"}`;
84
84
  const warnLog = log.create('warn', version$1);
85
85
  const errLog = log.create('error', version$1);
86
86
 
87
- const version = "4.14.25";
87
+ const version = "4.14.27";
88
88
  VxeUI.uiVersion = version;
89
89
  VxeUI.dynamicApp = dynamicApp;
90
90
  function config(options) {
@@ -3778,7 +3778,7 @@ function createInternalData$d() {
3778
3778
  targetEl: null
3779
3779
  };
3780
3780
  }
3781
- function createReactData$8() {
3781
+ function createReactData$9() {
3782
3782
  return {
3783
3783
  showBtn: false,
3784
3784
  backtopZindex: 0
@@ -3858,7 +3858,7 @@ var VxeBacktopComponent = defineVxeComponent({
3858
3858
  const refElem = ref();
3859
3859
  const { computeSize } = useSize(props);
3860
3860
  const internalData = createInternalData$d();
3861
- const reactData = reactive(createReactData$8());
3861
+ const reactData = reactive(createReactData$9());
3862
3862
  const refMaps = {
3863
3863
  refElem
3864
3864
  };
@@ -4035,7 +4035,7 @@ var VxeBacktopComponent = defineVxeComponent({
4035
4035
  });
4036
4036
  onBeforeUnmount(() => {
4037
4037
  removeScrollEvent();
4038
- XEUtils.assign(reactData, createReactData$8());
4038
+ XEUtils.assign(reactData, createReactData$9());
4039
4039
  XEUtils.assign(internalData, createInternalData$d());
4040
4040
  });
4041
4041
  $xeBacktop.renderVN = renderVN;
@@ -13299,7 +13299,7 @@ function createInternalData$a() {
13299
13299
  // leaveTime: null
13300
13300
  };
13301
13301
  }
13302
- function createReactData$7() {
13302
+ function createReactData$8() {
13303
13303
  return {
13304
13304
  visible: false,
13305
13305
  activeOption: null,
@@ -13355,7 +13355,7 @@ var VxeContextMenuComponent = defineVxeComponent({
13355
13355
  const refElem = ref();
13356
13356
  const { computeSize } = useSize(props);
13357
13357
  const internalData = createInternalData$a();
13358
- const reactData = reactive(createReactData$7());
13358
+ const reactData = reactive(createReactData$8());
13359
13359
  const refMaps = {
13360
13360
  refElem
13361
13361
  };
@@ -13910,7 +13910,7 @@ var VxeContextMenuComponent = defineVxeComponent({
13910
13910
  globalEvents.off($xeContextMenu, 'keydown');
13911
13911
  globalEvents.off($xeContextMenu, 'mousedown');
13912
13912
  globalEvents.off($xeContextMenu, 'blur');
13913
- XEUtils.assign(reactData, createReactData$7());
13913
+ XEUtils.assign(reactData, createReactData$8());
13914
13914
  XEUtils.assign(internalData, createInternalData$a());
13915
13915
  });
13916
13916
  $xeContextMenu.renderVN = renderVN;
@@ -19675,26 +19675,182 @@ function renderItemContent($xeForm, item) {
19675
19675
  }, contentVNs);
19676
19676
  }
19677
19677
 
19678
+ const formItemProps = {
19679
+ title: String,
19680
+ field: String,
19681
+ span: {
19682
+ type: [String, Number],
19683
+ default: null
19684
+ },
19685
+ align: {
19686
+ type: String,
19687
+ default: null
19688
+ },
19689
+ verticalAlign: {
19690
+ type: String,
19691
+ default: null
19692
+ },
19693
+ titleBackground: {
19694
+ type: Boolean,
19695
+ default: null
19696
+ },
19697
+ titleBold: {
19698
+ type: Boolean,
19699
+ default: null
19700
+ },
19701
+ titleAlign: {
19702
+ type: String,
19703
+ default: null
19704
+ },
19705
+ titleWidth: {
19706
+ type: [String, Number],
19707
+ default: null
19708
+ },
19709
+ titleColon: {
19710
+ type: Boolean,
19711
+ default: null
19712
+ },
19713
+ titleAsterisk: {
19714
+ type: Boolean,
19715
+ default: null
19716
+ },
19717
+ showTitle: {
19718
+ type: Boolean,
19719
+ default: true
19720
+ },
19721
+ vertical: {
19722
+ type: Boolean,
19723
+ default: null
19724
+ },
19725
+ padding: {
19726
+ type: Boolean,
19727
+ default: null
19728
+ },
19729
+ formatter: [String, Function],
19730
+ className: [String, Function],
19731
+ contentClassName: [String, Function],
19732
+ contentStyle: [Object, Function],
19733
+ titleClassName: [String, Function],
19734
+ titleStyle: [Object, Function],
19735
+ titleOverflow: {
19736
+ type: [Boolean, String],
19737
+ default: null
19738
+ },
19739
+ titlePrefix: Object,
19740
+ titleSuffix: Object,
19741
+ resetValue: { default: null },
19742
+ visibleMethod: Function,
19743
+ visible: {
19744
+ type: Boolean,
19745
+ default: null
19746
+ },
19747
+ showContent: {
19748
+ type: Boolean,
19749
+ default: null
19750
+ },
19751
+ folding: Boolean,
19752
+ collapseNode: Boolean,
19753
+ itemRender: Object,
19754
+ rules: Array,
19755
+ params: Object
19756
+ };
19757
+ var VxeFormItemComponent = defineVxeComponent({
19758
+ name: 'VxeFormItem',
19759
+ props: formItemProps,
19760
+ setup(props, { slots }) {
19761
+ const xID = XEUtils.uniqueId();
19762
+ const refElem = ref();
19763
+ const $xeForm = inject('$xeForm', {});
19764
+ const $xeFormGroup = inject('$xeFormGroup', null);
19765
+ const formItem = reactive(createItem($xeForm, props));
19766
+ formItem.slots = slots;
19767
+ const formItemInfo = { itemConfig: formItem };
19768
+ provide('xeFormItemInfo', formItemInfo);
19769
+ const renderItem = ($xeForm, item) => {
19770
+ const formProps = $xeForm.props;
19771
+ const $xeGrid = $xeForm.xeGrid;
19772
+ const { data, readonly, disabled } = formProps;
19773
+ const { visible, field, itemRender, contentStyle, showContent } = item;
19774
+ const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
19775
+ const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
19776
+ const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
19777
+ const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeGrid };
19778
+ if (visible === false) {
19779
+ return renderEmptyElement($xeFormItem);
19780
+ }
19781
+ return h('div', {
19782
+ ref: refElem,
19783
+ key: item.id,
19784
+ itemid: item.id,
19785
+ class: getItemClass($xeForm, item),
19786
+ style: XEUtils.isFunction(itemStyle) ? itemStyle(params) : itemStyle
19787
+ }, [
19788
+ renderTitle($xeForm, item),
19789
+ showContent === false
19790
+ ? renderEmptyElement($xeFormItem)
19791
+ : h('div', {
19792
+ class: getItemContentClass($xeForm, item),
19793
+ style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
19794
+ }, [
19795
+ renderItemContent($xeForm, item),
19796
+ renderItemErrorIcon($xeForm, item)
19797
+ ])
19798
+ ]);
19799
+ };
19800
+ const renderVN = () => {
19801
+ const customLayout = $xeForm ? $xeForm.props.customLayout : false;
19802
+ const item = formItem;
19803
+ return customLayout
19804
+ ? renderItem($xeForm, item)
19805
+ : h('div', {
19806
+ ref: refElem
19807
+ });
19808
+ };
19809
+ const $xeFormItem = {
19810
+ xID,
19811
+ formItem,
19812
+ renderVN
19813
+ };
19814
+ watchItem(props, formItem);
19815
+ onMounted(() => {
19816
+ const elem = refElem.value;
19817
+ assembleItem($xeForm, elem, formItem, $xeFormGroup);
19818
+ });
19819
+ onUnmounted(() => {
19820
+ destroyItem($xeForm, formItem);
19821
+ });
19822
+ provide('$xeFormItem', $xeFormItem);
19823
+ provide('$xeFormGroup', null);
19824
+ return $xeFormItem;
19825
+ },
19826
+ render() {
19827
+ return this.renderVN();
19828
+ }
19829
+ });
19830
+
19678
19831
  const VxeFormConfigItem = defineVxeComponent({
19679
19832
  name: 'VxeFormConfigItem',
19680
- props: {
19681
- itemConfig: Object
19682
- },
19833
+ props: Object.assign({ itemConfig: Object }, formItemProps),
19683
19834
  setup(props) {
19684
19835
  const $xeForm = inject('$xeForm', {});
19685
19836
  const xeformiteminfo = { itemConfig: props.itemConfig };
19686
19837
  provide('xeFormItemInfo', xeformiteminfo);
19838
+ const computeItemVisible = computed(() => {
19839
+ const { visible } = props.itemConfig;
19840
+ return visible;
19841
+ });
19687
19842
  const renderItem = ($xeForm, item) => {
19688
19843
  const formProps = $xeForm.props;
19689
19844
  const $xeGrid = $xeForm.xeGrid;
19690
19845
  const { data, readonly, disabled } = formProps;
19691
- const { visible, field, itemRender, contentStyle, children, showContent } = item;
19846
+ const { field, itemRender, contentStyle, children, showContent } = item;
19847
+ const itemVisible = computeItemVisible.value;
19692
19848
  const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
19693
19849
  const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
19694
19850
  const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
19695
19851
  const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeGrid };
19696
19852
  const hasGroup = children && children.length > 0;
19697
- if (visible === false) {
19853
+ if (itemVisible === false) {
19698
19854
  return renderEmptyElement($xeForm);
19699
19855
  }
19700
19856
  return h('div', {
@@ -20353,6 +20509,14 @@ function checkRuleStatus(rule, data, val) {
20353
20509
  }
20354
20510
  return true;
20355
20511
  }
20512
+ function createReactData$7() {
20513
+ return {
20514
+ collapseAll: false,
20515
+ staticItems: [],
20516
+ formItems: [],
20517
+ itemWidth: 0
20518
+ };
20519
+ }
20356
20520
  function createInternalData$9() {
20357
20521
  return {
20358
20522
  meTimeout: undefined,
@@ -20361,7 +20525,9 @@ function createInternalData$9() {
20361
20525
  item: null,
20362
20526
  visible: false
20363
20527
  },
20364
- itemFormatCache: {}
20528
+ itemFormatCache: {},
20529
+ fullItemIdData: {},
20530
+ fullItemFieldData: {}
20365
20531
  };
20366
20532
  }
20367
20533
  var VxeFormComponent = defineVxeComponent({
@@ -20460,12 +20626,7 @@ var VxeFormComponent = defineVxeComponent({
20460
20626
  const $xeGrid = inject('$xeGrid', null);
20461
20627
  const xID = XEUtils.uniqueId();
20462
20628
  const { computeSize } = useSize(props);
20463
- const reactData = reactive({
20464
- collapseAll: props.collapseStatus,
20465
- staticItems: [],
20466
- formItems: [],
20467
- itemWidth: 0
20468
- });
20629
+ const reactData = reactive(createReactData$7());
20469
20630
  const internalData = createInternalData$9();
20470
20631
  const refElem = ref();
20471
20632
  const refTooltip = ref();
@@ -20529,7 +20690,7 @@ var VxeFormComponent = defineVxeComponent({
20529
20690
  }
20530
20691
  return [];
20531
20692
  };
20532
- const loadItem = (list) => {
20693
+ const loadItems = (list) => {
20533
20694
  if (list.length) {
20534
20695
  list.forEach((item) => {
20535
20696
  if (item.slots) {
@@ -20557,8 +20718,9 @@ var VxeFormComponent = defineVxeComponent({
20557
20718
  return itemList;
20558
20719
  };
20559
20720
  const getItemByField = (field) => {
20560
- const rest = XEUtils.findTree(reactData.formItems, item => item.field === field, { children: 'children' });
20561
- return rest ? rest.item : null;
20721
+ const { fullItemFieldData } = internalData;
20722
+ const itemRest = fullItemFieldData[field];
20723
+ return itemRest ? itemRest.item : null;
20562
20724
  };
20563
20725
  const getCollapseStatus = () => {
20564
20726
  return reactData.collapseAll;
@@ -20622,6 +20784,23 @@ var VxeFormComponent = defineVxeComponent({
20622
20784
  }
20623
20785
  return resetValue;
20624
20786
  };
20787
+ const cacheItem = () => {
20788
+ const { formItems } = reactData;
20789
+ const itemIdData = {};
20790
+ const itemFieldData = {};
20791
+ XEUtils.eachTree(formItems, (item, index, items) => {
20792
+ const { id, field } = item;
20793
+ const itemRest = { item, items, index };
20794
+ if (id) {
20795
+ itemIdData[id] = itemRest;
20796
+ }
20797
+ if (field) {
20798
+ itemFieldData[field] = itemRest;
20799
+ }
20800
+ }, { children: 'children' });
20801
+ internalData.fullItemFieldData = itemFieldData;
20802
+ internalData.fullItemIdData = itemIdData;
20803
+ };
20625
20804
  const reset = () => {
20626
20805
  const { data } = props;
20627
20806
  const itemList = getItems();
@@ -21002,10 +21181,25 @@ var VxeFormComponent = defineVxeComponent({
21002
21181
  const handleGlobalResizeEvent = () => {
21003
21182
  recalculate();
21004
21183
  };
21184
+ const handleItemVisible = (visible) => {
21185
+ return function (fieldOrItems) {
21186
+ const objs = XEUtils.isArray(fieldOrItems) ? fieldOrItems : [fieldOrItems];
21187
+ objs.forEach(obj => {
21188
+ const item = handleFieldOrItem($xeForm, obj);
21189
+ if (item) {
21190
+ item.visible = visible;
21191
+ }
21192
+ });
21193
+ return nextTick();
21194
+ };
21195
+ };
21005
21196
  formMethods = {
21006
21197
  dispatchEvent(type, params, evnt) {
21007
21198
  emit(type, createEvent(evnt, { $form: $xeForm, $grid: $xeGrid }, params));
21008
21199
  },
21200
+ loadItems,
21201
+ showItem: handleItemVisible(true),
21202
+ hideItem: handleItemVisible(false),
21009
21203
  reset,
21010
21204
  validate,
21011
21205
  validateField,
@@ -21054,12 +21248,12 @@ var VxeFormComponent = defineVxeComponent({
21054
21248
  : formItems.map((item, index) => {
21055
21249
  return h(VxeFormConfigItem, {
21056
21250
  key: index,
21057
- itemConfig: item
21251
+ itemConfig: item,
21252
+ visible: item.visible
21058
21253
  });
21059
21254
  })),
21060
21255
  h('div', {
21061
- class: 'vxe-form-slots',
21062
- ref: 'hideItem'
21256
+ class: 'vxe-form-slots'
21063
21257
  }, customLayout ? [] : (defaultSlot ? defaultSlot({}) : [])),
21064
21258
  /**
21065
21259
  * 加载中
@@ -21096,6 +21290,7 @@ var VxeFormComponent = defineVxeComponent({
21096
21290
  watch(staticItemFlag, () => {
21097
21291
  reactData.formItems = reactData.staticItems;
21098
21292
  recalcFlag.value++;
21293
+ cacheItem();
21099
21294
  });
21100
21295
  const itemFlag = ref(0);
21101
21296
  watch(() => props.items ? props.items.length : -1, () => {
@@ -21105,7 +21300,7 @@ var VxeFormComponent = defineVxeComponent({
21105
21300
  itemFlag.value++;
21106
21301
  });
21107
21302
  watch(itemFlag, () => {
21108
- loadItem(props.items || []);
21303
+ loadItems(props.items || []);
21109
21304
  });
21110
21305
  watch(() => props.collapseStatus, (value) => {
21111
21306
  reactData.collapseAll = !!value;
@@ -21128,8 +21323,9 @@ var VxeFormComponent = defineVxeComponent({
21128
21323
  globalEvents.off($xeForm, 'resize');
21129
21324
  XEUtils.assign(internalData, createInternalData$9());
21130
21325
  });
21326
+ reactData.collapseAll = !!props.collapseStatus;
21131
21327
  if (props.items) {
21132
- loadItem(props.items);
21328
+ loadItems(props.items);
21133
21329
  }
21134
21330
  provide('xeFormItemInfo', null);
21135
21331
  provide('$xeForm', $xeForm);
@@ -21152,159 +21348,6 @@ dynamicApp.use(VxeForm);
21152
21348
  VxeUI.component(VxeFormComponent);
21153
21349
  const Form = VxeForm;
21154
21350
 
21155
- const formItemProps = {
21156
- title: String,
21157
- field: String,
21158
- span: {
21159
- type: [String, Number],
21160
- default: null
21161
- },
21162
- align: {
21163
- type: String,
21164
- default: null
21165
- },
21166
- verticalAlign: {
21167
- type: String,
21168
- default: null
21169
- },
21170
- titleBackground: {
21171
- type: Boolean,
21172
- default: null
21173
- },
21174
- titleBold: {
21175
- type: Boolean,
21176
- default: null
21177
- },
21178
- titleAlign: {
21179
- type: String,
21180
- default: null
21181
- },
21182
- titleWidth: {
21183
- type: [String, Number],
21184
- default: null
21185
- },
21186
- titleColon: {
21187
- type: Boolean,
21188
- default: null
21189
- },
21190
- titleAsterisk: {
21191
- type: Boolean,
21192
- default: null
21193
- },
21194
- showTitle: {
21195
- type: Boolean,
21196
- default: true
21197
- },
21198
- vertical: {
21199
- type: Boolean,
21200
- default: null
21201
- },
21202
- padding: {
21203
- type: Boolean,
21204
- default: null
21205
- },
21206
- formatter: [String, Function],
21207
- className: [String, Function],
21208
- contentClassName: [String, Function],
21209
- contentStyle: [Object, Function],
21210
- titleClassName: [String, Function],
21211
- titleStyle: [Object, Function],
21212
- titleOverflow: {
21213
- type: [Boolean, String],
21214
- default: null
21215
- },
21216
- titlePrefix: Object,
21217
- titleSuffix: Object,
21218
- resetValue: { default: null },
21219
- visibleMethod: Function,
21220
- visible: {
21221
- type: Boolean,
21222
- default: null
21223
- },
21224
- showContent: {
21225
- type: Boolean,
21226
- default: null
21227
- },
21228
- folding: Boolean,
21229
- collapseNode: Boolean,
21230
- itemRender: Object,
21231
- rules: Array,
21232
- params: Object
21233
- };
21234
- var VxeFormItemComponent = defineVxeComponent({
21235
- name: 'VxeFormItem',
21236
- props: formItemProps,
21237
- setup(props, { slots }) {
21238
- const xID = XEUtils.uniqueId();
21239
- const refElem = ref();
21240
- const $xeForm = inject('$xeForm', {});
21241
- const $xeFormGroup = inject('$xeFormGroup', null);
21242
- const formItem = reactive(createItem($xeForm, props));
21243
- formItem.slots = slots;
21244
- const formItemInfo = { itemConfig: formItem };
21245
- provide('xeFormItemInfo', formItemInfo);
21246
- const renderItem = ($xeForm, item) => {
21247
- const formProps = $xeForm.props;
21248
- const $xeGrid = $xeForm.xeGrid;
21249
- const { data, readonly, disabled } = formProps;
21250
- const { visible, field, itemRender, contentStyle, showContent } = item;
21251
- const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
21252
- const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
21253
- const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
21254
- const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeGrid };
21255
- if (visible === false) {
21256
- return renderEmptyElement($xeFormItem);
21257
- }
21258
- return h('div', {
21259
- ref: refElem,
21260
- key: item.id,
21261
- itemid: item.id,
21262
- class: getItemClass($xeForm, item),
21263
- style: XEUtils.isFunction(itemStyle) ? itemStyle(params) : itemStyle
21264
- }, [
21265
- renderTitle($xeForm, item),
21266
- showContent === false
21267
- ? renderEmptyElement($xeFormItem)
21268
- : h('div', {
21269
- class: getItemContentClass($xeForm, item),
21270
- style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
21271
- }, [
21272
- renderItemContent($xeForm, item),
21273
- renderItemErrorIcon($xeForm, item)
21274
- ])
21275
- ]);
21276
- };
21277
- const renderVN = () => {
21278
- const customLayout = $xeForm ? $xeForm.props.customLayout : false;
21279
- const item = formItem;
21280
- return customLayout
21281
- ? renderItem($xeForm, item)
21282
- : h('div', {
21283
- ref: refElem
21284
- });
21285
- };
21286
- const $xeFormItem = {
21287
- xID,
21288
- formItem,
21289
- renderVN
21290
- };
21291
- watchItem(props, formItem);
21292
- onMounted(() => {
21293
- const elem = refElem.value;
21294
- assembleItem($xeForm, elem, formItem, $xeFormGroup);
21295
- });
21296
- onUnmounted(() => {
21297
- destroyItem($xeForm, formItem);
21298
- });
21299
- provide('$xeFormItem', $xeFormItem);
21300
- provide('$xeFormGroup', null);
21301
- return $xeFormItem;
21302
- },
21303
- render() {
21304
- return this.renderVN();
21305
- }
21306
- });
21307
-
21308
21351
  var VxeFormGroupComponent = defineVxeComponent({
21309
21352
  name: 'VxeFormGroup',
21310
21353
  props: formItemProps,
@@ -35231,7 +35274,18 @@ var VxeTextareaComponent = defineVxeComponent({
35231
35274
  },
35232
35275
  showWordCount: Boolean,
35233
35276
  countMethod: Function,
35234
- autosize: [Boolean, Object],
35277
+ /**
35278
+ * 已废弃,被 auto-size 替换
35279
+ * @deprecated
35280
+ */
35281
+ autosize: {
35282
+ type: [Boolean, Object],
35283
+ default: null
35284
+ },
35285
+ autoSize: {
35286
+ type: [Boolean, Object],
35287
+ default: null
35288
+ },
35235
35289
  form: String,
35236
35290
  resize: {
35237
35291
  type: String,
@@ -35266,6 +35320,7 @@ var VxeTextareaComponent = defineVxeComponent({
35266
35320
  });
35267
35321
  const refElem = ref();
35268
35322
  const refTextarea = ref();
35323
+ const refContent = ref();
35269
35324
  const refMaps = {
35270
35325
  refElem,
35271
35326
  refTextarea
@@ -35326,19 +35381,26 @@ var VxeTextareaComponent = defineVxeComponent({
35326
35381
  return inpMaxLength && inputCount > XEUtils.toNumber(inpMaxLength);
35327
35382
  });
35328
35383
  const computeSizeOpts = computed(() => {
35329
- return Object.assign({ minRows: 1, maxRows: 10 }, getConfig$3().textarea.autosize, props.autosize);
35384
+ const { autosize, autoSize } = props;
35385
+ if (autosize || getConfig$3().textarea.autosize) {
35386
+ return Object.assign({ minRows: 1, maxRows: 10 }, getConfig$3().textarea.autosize, autosize);
35387
+ }
35388
+ return Object.assign({ minRows: 1, maxRows: 10 }, getConfig$3().textarea.autoSize, autoSize);
35330
35389
  });
35331
35390
  const updateAutoTxt = () => {
35332
- const { size, autosize } = props;
35391
+ const { size, autosize, autoSize } = props;
35333
35392
  const { inputValue } = reactData;
35334
- if (autosize) {
35393
+ if (autosize || autoSize) {
35394
+ const formReadonly = computeFormReadonly.value;
35335
35395
  if (!autoTxtElem) {
35336
35396
  autoTxtElem = document.createElement('div');
35337
35397
  }
35338
35398
  if (!autoTxtElem.parentNode) {
35339
35399
  document.body.appendChild(autoTxtElem);
35340
35400
  }
35341
- const textElem = refTextarea.value;
35401
+ const taElem = refTextarea.value;
35402
+ const ctElem = refContent.value;
35403
+ const textElem = formReadonly ? ctElem : taElem;
35342
35404
  if (!textElem) {
35343
35405
  return;
35344
35406
  }
@@ -35350,11 +35412,15 @@ var VxeTextareaComponent = defineVxeComponent({
35350
35412
  }
35351
35413
  };
35352
35414
  const handleResize = () => {
35353
- if (props.autosize) {
35415
+ const { autosize, autoSize } = props;
35416
+ if (autosize || autoSize) {
35354
35417
  nextTick(() => {
35355
35418
  const sizeOpts = computeSizeOpts.value;
35419
+ const formReadonly = computeFormReadonly.value;
35356
35420
  const { minRows, maxRows } = sizeOpts;
35357
- const textElem = refTextarea.value;
35421
+ const taElem = refTextarea.value;
35422
+ const ctElem = refContent.value;
35423
+ const textElem = formReadonly ? ctElem : taElem;
35358
35424
  if (!textElem) {
35359
35425
  return;
35360
35426
  }
@@ -35442,23 +35508,8 @@ var VxeTextareaComponent = defineVxeComponent({
35442
35508
  }
35443
35509
  };
35444
35510
  Object.assign($xeTextarea, textareaMethods);
35445
- watch(() => props.modelValue, (val) => {
35446
- reactData.inputValue = val;
35447
- updateAutoTxt();
35448
- });
35449
- watch(computeSizeOpts, () => {
35450
- updateAutoTxt();
35451
- handleResize();
35452
- });
35453
- nextTick(() => {
35454
- const { autosize } = props;
35455
- if (autosize) {
35456
- updateAutoTxt();
35457
- handleResize();
35458
- }
35459
- });
35460
35511
  const renderVN = () => {
35461
- const { className, resize, autosize, showWordCount, countMethod, rows, cols } = props;
35512
+ const { className, resize, autosize, autoSize, showWordCount, countMethod, rows, cols } = props;
35462
35513
  const { inputValue } = reactData;
35463
35514
  const vSize = computeSize.value;
35464
35515
  const isDisabled = computeIsDisabled.value;
@@ -35472,13 +35523,18 @@ var VxeTextareaComponent = defineVxeComponent({
35472
35523
  return h('div', {
35473
35524
  ref: refElem,
35474
35525
  class: ['vxe-textarea--readonly', className]
35475
- }, inputValue);
35526
+ }, [
35527
+ h('div', {
35528
+ ref: refContent,
35529
+ class: 'vxe-textarea--content'
35530
+ }, inputValue)
35531
+ ]);
35476
35532
  }
35477
35533
  return h('div', {
35478
35534
  ref: refElem,
35479
35535
  class: ['vxe-textarea', className, {
35480
35536
  [`size--${vSize}`]: vSize,
35481
- 'is--autosize': autosize,
35537
+ 'is--autosize': autosize || autoSize,
35482
35538
  'is--count': showWordCount,
35483
35539
  'is--disabled': isDisabled,
35484
35540
  'is--rows': !XEUtils.eqNull(rows),
@@ -35519,6 +35575,37 @@ var VxeTextareaComponent = defineVxeComponent({
35519
35575
  : null
35520
35576
  ]);
35521
35577
  };
35578
+ watch(() => props.modelValue, (val) => {
35579
+ reactData.inputValue = val;
35580
+ updateAutoTxt();
35581
+ });
35582
+ const reFlag = ref(0);
35583
+ watch(computeFormReadonly, () => {
35584
+ reFlag.value++;
35585
+ });
35586
+ watch(computeSizeOpts, () => {
35587
+ reFlag.value++;
35588
+ });
35589
+ watch(() => props.autoSize, () => {
35590
+ reFlag.value++;
35591
+ });
35592
+ watch(() => props.autosize, () => {
35593
+ reFlag.value++;
35594
+ });
35595
+ watch(reFlag, () => {
35596
+ updateAutoTxt();
35597
+ handleResize();
35598
+ });
35599
+ nextTick(() => {
35600
+ const { autosize, autoSize } = props;
35601
+ if (autosize) {
35602
+ warnLog('vxe.error.delProp', ['autosize', 'auto-size']);
35603
+ }
35604
+ if (autosize || autoSize) {
35605
+ updateAutoTxt();
35606
+ handleResize();
35607
+ }
35608
+ });
35522
35609
  $xeTextarea.renderVN = renderVN;
35523
35610
  return $xeTextarea;
35524
35611
  },