vxe-pc-ui 4.14.26 → 4.14.28

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 (92) hide show
  1. package/dist/all.esm.js +318 -200
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/date-panel/src/date-panel.js +11 -10
  5. package/es/date-panel/style.css +4 -0
  6. package/es/date-panel/style.min.css +1 -1
  7. package/es/date-range-picker/src/date-range-picker.js +15 -0
  8. package/es/form/src/form-config-item.js +10 -6
  9. package/es/form/src/form.js +55 -15
  10. package/es/form/style.css +2 -2
  11. package/es/form/style.min.css +1 -1
  12. package/es/radio/style.css +2 -2
  13. package/es/radio/style.min.css +1 -1
  14. package/es/select/src/select.js +4 -1
  15. package/es/style.css +1 -1
  16. package/es/style.min.css +1 -1
  17. package/es/table-select/src/table-select.js +4 -1
  18. package/es/tree-select/src/tree-select.js +4 -1
  19. package/es/ui/index.js +1 -1
  20. package/es/ui/src/log.js +1 -1
  21. package/es/upload/src/upload.js +56 -6
  22. package/es/vxe-date-panel/style.css +4 -0
  23. package/es/vxe-date-panel/style.min.css +1 -1
  24. package/es/vxe-form/style.css +2 -2
  25. package/es/vxe-form/style.min.css +1 -1
  26. package/es/vxe-radio/style.css +2 -2
  27. package/es/vxe-radio/style.min.css +1 -1
  28. package/lib/date-panel/src/date-panel.js +46 -10
  29. package/lib/date-panel/src/date-panel.min.js +1 -1
  30. package/lib/date-panel/style/style.css +4 -0
  31. package/lib/date-panel/style/style.min.css +1 -1
  32. package/lib/date-range-picker/src/date-range-picker.js +17 -0
  33. package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
  34. package/lib/form/src/form-config-item.js +11 -4
  35. package/lib/form/src/form-config-item.min.js +1 -1
  36. package/lib/form/src/form.js +69 -17
  37. package/lib/form/src/form.min.js +1 -1
  38. package/lib/form/style/style.css +2 -2
  39. package/lib/form/style/style.min.css +1 -1
  40. package/lib/index.umd.js +403 -220
  41. package/lib/index.umd.min.js +1 -1
  42. package/lib/radio/style/style.css +2 -2
  43. package/lib/radio/style/style.min.css +1 -1
  44. package/lib/select/src/select.js +4 -1
  45. package/lib/select/src/select.min.js +1 -1
  46. package/lib/style.css +1 -1
  47. package/lib/style.min.css +1 -1
  48. package/lib/table-select/src/table-select.js +4 -1
  49. package/lib/table-select/src/table-select.min.js +1 -1
  50. package/lib/tree-select/src/tree-select.js +4 -1
  51. package/lib/tree-select/src/tree-select.min.js +1 -1
  52. package/lib/ui/index.js +1 -1
  53. package/lib/ui/index.min.js +1 -1
  54. package/lib/ui/src/log.js +1 -1
  55. package/lib/ui/src/log.min.js +1 -1
  56. package/lib/upload/src/upload.js +72 -10
  57. package/lib/upload/src/upload.min.js +1 -1
  58. package/lib/vxe-date-panel/style/style.css +4 -0
  59. package/lib/vxe-date-panel/style/style.min.css +1 -1
  60. package/lib/vxe-form/style/style.css +2 -2
  61. package/lib/vxe-form/style/style.min.css +1 -1
  62. package/lib/vxe-radio/style/style.css +2 -2
  63. package/lib/vxe-radio/style/style.min.css +1 -1
  64. package/package.json +1 -1
  65. package/packages/date-panel/src/date-panel.ts +11 -10
  66. package/packages/date-range-picker/src/date-range-picker.ts +17 -1
  67. package/packages/form/src/form-config-item.ts +12 -4
  68. package/packages/form/src/form.ts +58 -15
  69. package/packages/form/src/util.ts +1 -1
  70. package/packages/select/src/select.ts +4 -1
  71. package/packages/table-select/src/table-select.ts +4 -1
  72. package/packages/tree-select/src/tree-select.ts +4 -1
  73. package/packages/upload/src/upload.ts +66 -6
  74. package/styles/components/date-panel.scss +4 -0
  75. package/styles/components/form.scss +2 -2
  76. package/styles/components/radio.scss +2 -2
  77. package/types/components/date-panel.d.ts +7 -0
  78. package/types/components/form.d.ts +22 -3
  79. package/types/components/notice-bar.d.ts +4 -0
  80. package/types/components/upload.d.ts +37 -2
  81. /package/es/icon/{iconfont.1780292459831.ttf → iconfont.1780570418794.ttf} +0 -0
  82. /package/es/icon/{iconfont.1780292459831.woff → iconfont.1780570418794.woff} +0 -0
  83. /package/es/icon/{iconfont.1780292459831.woff2 → iconfont.1780570418794.woff2} +0 -0
  84. /package/es/{iconfont.1780292459831.ttf → iconfont.1780570418794.ttf} +0 -0
  85. /package/es/{iconfont.1780292459831.woff → iconfont.1780570418794.woff} +0 -0
  86. /package/es/{iconfont.1780292459831.woff2 → iconfont.1780570418794.woff2} +0 -0
  87. /package/lib/icon/style/{iconfont.1780292459831.ttf → iconfont.1780570418794.ttf} +0 -0
  88. /package/lib/icon/style/{iconfont.1780292459831.woff → iconfont.1780570418794.woff} +0 -0
  89. /package/lib/icon/style/{iconfont.1780292459831.woff2 → iconfont.1780570418794.woff2} +0 -0
  90. /package/lib/{iconfont.1780292459831.ttf → iconfont.1780570418794.ttf} +0 -0
  91. /package/lib/{iconfont.1780292459831.woff → iconfont.1780570418794.woff} +0 -0
  92. /package/lib/{iconfont.1780292459831.woff2 → iconfont.1780570418794.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.26"}`;
83
+ const version$1 = `ui v${"4.14.28"}`;
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.26";
87
+ const version = "4.14.28";
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;
@@ -14423,6 +14423,7 @@ var VxeDatePanelComponent = defineVxeComponent({
14423
14423
  default: 'date'
14424
14424
  },
14425
14425
  className: String,
14426
+ cellClassName: [String, Function],
14426
14427
  size: {
14427
14428
  type: String,
14428
14429
  default: () => getConfig$3().datePanel.size || getConfig$3().size
@@ -15638,7 +15639,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15638
15639
  return labelVNs;
15639
15640
  };
15640
15641
  const renderDateDayTable = () => {
15641
- const { multiple } = props;
15642
+ const { type, multiple, cellClassName } = props;
15642
15643
  const { datePanelType, datePanelValue } = reactData;
15643
15644
  const dateValue = computeDateValue.value;
15644
15645
  const dateHeaders = computeDateHeaders.value;
@@ -15683,7 +15684,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15683
15684
  }, rows.map((item) => {
15684
15685
  const isSelected = multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat);
15685
15686
  return h('div', {
15686
- class: ['vxe-date-panel--view-item', {
15687
+ class: ['vxe-date-panel--view-item', cellClassName ? (XEUtils.isFunction(cellClassName) ? `${cellClassName({ $datePanel: $xeDatePanel, type, viewType: datePanelType, date: item.date }) || ''}` : `${cellClassName || ''}`) : '', {
15687
15688
  'is--prev': item.isPrev,
15688
15689
  'is--current': item.isCurrent,
15689
15690
  'is--now': item.isNow,
@@ -15711,7 +15712,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15711
15712
  ];
15712
15713
  };
15713
15714
  const renderDateWeekTable = () => {
15714
- const { multiple } = props;
15715
+ const { type, multiple, cellClassName } = props;
15715
15716
  const { datePanelType, datePanelValue } = reactData;
15716
15717
  const dateValue = computeDateValue.value;
15717
15718
  const weekHeaders = computeWeekHeaders.value;
@@ -15758,7 +15759,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15758
15759
  }
15759
15760
  }, rows.map((item, rIndex) => {
15760
15761
  return h('div', {
15761
- class: ['vxe-date-panel--view-item', {
15762
+ class: ['vxe-date-panel--view-item', cellClassName ? (XEUtils.isFunction(cellClassName) ? `${cellClassName({ $datePanel: $xeDatePanel, type, viewType: datePanelType, date: item.date }) || ''}` : `${cellClassName || ''}`) : '', {
15762
15763
  'is--prev': item.isPrev,
15763
15764
  'is--current': item.isCurrent,
15764
15765
  'is--now': rIndex ? item.isNow : isNowWeek,
@@ -15786,7 +15787,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15786
15787
  ];
15787
15788
  };
15788
15789
  const renderDateMonthTable = () => {
15789
- const { multiple } = props;
15790
+ const { type, multiple, cellClassName } = props;
15790
15791
  const { datePanelType, datePanelValue } = reactData;
15791
15792
  const dateValue = computeDateValue.value;
15792
15793
  const monthDatas = computeMonthDatas.value;
@@ -15808,7 +15809,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15808
15809
  }, rows.map((item) => {
15809
15810
  const isSelected = multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat);
15810
15811
  return h('div', {
15811
- class: ['vxe-date-panel--view-item', {
15812
+ class: ['vxe-date-panel--view-item', cellClassName ? (XEUtils.isFunction(cellClassName) ? `${cellClassName({ $datePanel: $xeDatePanel, type, viewType: datePanelType, date: item.date }) || ''}` : `${cellClassName || ''}`) : '', {
15812
15813
  'is--prev': item.isPrev,
15813
15814
  'is--current': item.isCurrent,
15814
15815
  'is--now': item.isNow,
@@ -15836,7 +15837,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15836
15837
  ];
15837
15838
  };
15838
15839
  const renderDateQuarterTable = () => {
15839
- const { multiple } = props;
15840
+ const { type, multiple, cellClassName } = props;
15840
15841
  const { datePanelType, datePanelValue } = reactData;
15841
15842
  const dateValue = computeDateValue.value;
15842
15843
  const quarterDatas = computeQuarterDatas.value;
@@ -15858,7 +15859,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15858
15859
  }, rows.map((item) => {
15859
15860
  const isSelected = multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat);
15860
15861
  return h('div', {
15861
- class: ['vxe-date-panel--view-item', {
15862
+ class: ['vxe-date-panel--view-item', cellClassName ? (XEUtils.isFunction(cellClassName) ? `${cellClassName({ $datePanel: $xeDatePanel, type, viewType: datePanelType, date: item.date }) || ''}` : `${cellClassName || ''}`) : '', {
15862
15863
  'is--prev': item.isPrev,
15863
15864
  'is--current': item.isCurrent,
15864
15865
  'is--now': item.isNow,
@@ -15886,7 +15887,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15886
15887
  ];
15887
15888
  };
15888
15889
  const renderDateYearTable = () => {
15889
- const { multiple } = props;
15890
+ const { type, multiple, cellClassName } = props;
15890
15891
  const { datePanelType, datePanelValue } = reactData;
15891
15892
  const dateValue = computeDateValue.value;
15892
15893
  const yearDatas = computeYearDatas.value;
@@ -15908,7 +15909,7 @@ var VxeDatePanelComponent = defineVxeComponent({
15908
15909
  }, rows.map((item) => {
15909
15910
  const isSelected = multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat);
15910
15911
  return h('div', {
15911
- class: ['vxe-date-panel--view-item', {
15912
+ class: ['vxe-date-panel--view-item', cellClassName ? (XEUtils.isFunction(cellClassName) ? `${cellClassName({ $datePanel: $xeDatePanel, type, viewType: datePanelType, date: item.date }) || ''}` : `${cellClassName || ''}`) : '', {
15912
15913
  'is--prev': item.isPrev,
15913
15914
  'is--current': item.isCurrent,
15914
15915
  'is--now': item.isNow,
@@ -17652,6 +17653,19 @@ var VxeDateRangePickerComponent = defineVxeComponent({
17652
17653
  }
17653
17654
  }
17654
17655
  };
17656
+ const panelCellClassName = ({ date }) => {
17657
+ const startValue = reactData.startValue;
17658
+ const endValue = reactData.endValue;
17659
+ if (startValue && endValue) {
17660
+ const currTime = date.getTime();
17661
+ const startTime = XEUtils.toStringDate(startValue).getTime();
17662
+ const endTime = XEUtils.toStringDate(endValue).getTime();
17663
+ if (currTime >= startTime && currTime <= endTime) {
17664
+ return 'is--range-selected';
17665
+ }
17666
+ }
17667
+ return '';
17668
+ };
17655
17669
  const handleSelectClose = () => {
17656
17670
  const { autoClose } = props;
17657
17671
  const { startValue, endValue } = reactData;
@@ -18117,6 +18131,7 @@ var VxeDateRangePickerComponent = defineVxeComponent({
18117
18131
  festivalMethod: props.festivalMethod,
18118
18132
  disabledMethod: props.disabledMethod,
18119
18133
  selectDay: props.selectDay,
18134
+ cellClassName: panelCellClassName,
18120
18135
  onChange: startPanelChangeEvent
18121
18136
  }),
18122
18137
  h(VxeDatePanelComponent, {
@@ -18137,6 +18152,7 @@ var VxeDateRangePickerComponent = defineVxeComponent({
18137
18152
  festivalMethod: props.festivalMethod,
18138
18153
  disabledMethod: props.disabledMethod,
18139
18154
  selectDay: props.selectDay,
18155
+ cellClassName: panelCellClassName,
18140
18156
  onChange: endPanelChangeEvent
18141
18157
  })
18142
18158
  ]),
@@ -19675,26 +19691,182 @@ function renderItemContent($xeForm, item) {
19675
19691
  }, contentVNs);
19676
19692
  }
19677
19693
 
19694
+ const formItemProps = {
19695
+ title: String,
19696
+ field: String,
19697
+ span: {
19698
+ type: [String, Number],
19699
+ default: null
19700
+ },
19701
+ align: {
19702
+ type: String,
19703
+ default: null
19704
+ },
19705
+ verticalAlign: {
19706
+ type: String,
19707
+ default: null
19708
+ },
19709
+ titleBackground: {
19710
+ type: Boolean,
19711
+ default: null
19712
+ },
19713
+ titleBold: {
19714
+ type: Boolean,
19715
+ default: null
19716
+ },
19717
+ titleAlign: {
19718
+ type: String,
19719
+ default: null
19720
+ },
19721
+ titleWidth: {
19722
+ type: [String, Number],
19723
+ default: null
19724
+ },
19725
+ titleColon: {
19726
+ type: Boolean,
19727
+ default: null
19728
+ },
19729
+ titleAsterisk: {
19730
+ type: Boolean,
19731
+ default: null
19732
+ },
19733
+ showTitle: {
19734
+ type: Boolean,
19735
+ default: true
19736
+ },
19737
+ vertical: {
19738
+ type: Boolean,
19739
+ default: null
19740
+ },
19741
+ padding: {
19742
+ type: Boolean,
19743
+ default: null
19744
+ },
19745
+ formatter: [String, Function],
19746
+ className: [String, Function],
19747
+ contentClassName: [String, Function],
19748
+ contentStyle: [Object, Function],
19749
+ titleClassName: [String, Function],
19750
+ titleStyle: [Object, Function],
19751
+ titleOverflow: {
19752
+ type: [Boolean, String],
19753
+ default: null
19754
+ },
19755
+ titlePrefix: Object,
19756
+ titleSuffix: Object,
19757
+ resetValue: { default: null },
19758
+ visibleMethod: Function,
19759
+ visible: {
19760
+ type: Boolean,
19761
+ default: null
19762
+ },
19763
+ showContent: {
19764
+ type: Boolean,
19765
+ default: null
19766
+ },
19767
+ folding: Boolean,
19768
+ collapseNode: Boolean,
19769
+ itemRender: Object,
19770
+ rules: Array,
19771
+ params: Object
19772
+ };
19773
+ var VxeFormItemComponent = defineVxeComponent({
19774
+ name: 'VxeFormItem',
19775
+ props: formItemProps,
19776
+ setup(props, { slots }) {
19777
+ const xID = XEUtils.uniqueId();
19778
+ const refElem = ref();
19779
+ const $xeForm = inject('$xeForm', {});
19780
+ const $xeFormGroup = inject('$xeFormGroup', null);
19781
+ const formItem = reactive(createItem($xeForm, props));
19782
+ formItem.slots = slots;
19783
+ const formItemInfo = { itemConfig: formItem };
19784
+ provide('xeFormItemInfo', formItemInfo);
19785
+ const renderItem = ($xeForm, item) => {
19786
+ const formProps = $xeForm.props;
19787
+ const $xeGrid = $xeForm.xeGrid;
19788
+ const { data, readonly, disabled } = formProps;
19789
+ const { visible, field, itemRender, contentStyle, showContent } = item;
19790
+ const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
19791
+ const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
19792
+ const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
19793
+ const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeGrid };
19794
+ if (visible === false) {
19795
+ return renderEmptyElement($xeFormItem);
19796
+ }
19797
+ return h('div', {
19798
+ ref: refElem,
19799
+ key: item.id,
19800
+ itemid: item.id,
19801
+ class: getItemClass($xeForm, item),
19802
+ style: XEUtils.isFunction(itemStyle) ? itemStyle(params) : itemStyle
19803
+ }, [
19804
+ renderTitle($xeForm, item),
19805
+ showContent === false
19806
+ ? renderEmptyElement($xeFormItem)
19807
+ : h('div', {
19808
+ class: getItemContentClass($xeForm, item),
19809
+ style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
19810
+ }, [
19811
+ renderItemContent($xeForm, item),
19812
+ renderItemErrorIcon($xeForm, item)
19813
+ ])
19814
+ ]);
19815
+ };
19816
+ const renderVN = () => {
19817
+ const customLayout = $xeForm ? $xeForm.props.customLayout : false;
19818
+ const item = formItem;
19819
+ return customLayout
19820
+ ? renderItem($xeForm, item)
19821
+ : h('div', {
19822
+ ref: refElem
19823
+ });
19824
+ };
19825
+ const $xeFormItem = {
19826
+ xID,
19827
+ formItem,
19828
+ renderVN
19829
+ };
19830
+ watchItem(props, formItem);
19831
+ onMounted(() => {
19832
+ const elem = refElem.value;
19833
+ assembleItem($xeForm, elem, formItem, $xeFormGroup);
19834
+ });
19835
+ onUnmounted(() => {
19836
+ destroyItem($xeForm, formItem);
19837
+ });
19838
+ provide('$xeFormItem', $xeFormItem);
19839
+ provide('$xeFormGroup', null);
19840
+ return $xeFormItem;
19841
+ },
19842
+ render() {
19843
+ return this.renderVN();
19844
+ }
19845
+ });
19846
+
19678
19847
  const VxeFormConfigItem = defineVxeComponent({
19679
19848
  name: 'VxeFormConfigItem',
19680
- props: {
19681
- itemConfig: Object
19682
- },
19849
+ props: Object.assign({ itemConfig: Object }, formItemProps),
19683
19850
  setup(props) {
19684
19851
  const $xeForm = inject('$xeForm', {});
19685
19852
  const xeformiteminfo = { itemConfig: props.itemConfig };
19686
19853
  provide('xeFormItemInfo', xeformiteminfo);
19854
+ const computeItemVisible = computed(() => {
19855
+ const { visible } = props.itemConfig;
19856
+ return visible;
19857
+ });
19687
19858
  const renderItem = ($xeForm, item) => {
19688
19859
  const formProps = $xeForm.props;
19689
19860
  const $xeGrid = $xeForm.xeGrid;
19690
19861
  const { data, readonly, disabled } = formProps;
19691
- const { visible, field, itemRender, contentStyle, children, showContent } = item;
19862
+ const { field, itemRender, contentStyle, children, showContent } = item;
19863
+ const itemVisible = computeItemVisible.value;
19692
19864
  const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
19693
19865
  const itemStyle = compConf ? (compConf.formItemStyle || compConf.itemStyle) : null;
19694
19866
  const itemContentStyle = compConf ? (compConf.formItemContentStyle || compConf.itemContentStyle) : null;
19695
19867
  const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeGrid };
19696
19868
  const hasGroup = children && children.length > 0;
19697
- if (visible === false) {
19869
+ if (itemVisible === false) {
19698
19870
  return renderEmptyElement($xeForm);
19699
19871
  }
19700
19872
  return h('div', {
@@ -20353,6 +20525,14 @@ function checkRuleStatus(rule, data, val) {
20353
20525
  }
20354
20526
  return true;
20355
20527
  }
20528
+ function createReactData$7() {
20529
+ return {
20530
+ collapseAll: false,
20531
+ staticItems: [],
20532
+ formItems: [],
20533
+ itemWidth: 0
20534
+ };
20535
+ }
20356
20536
  function createInternalData$9() {
20357
20537
  return {
20358
20538
  meTimeout: undefined,
@@ -20361,7 +20541,9 @@ function createInternalData$9() {
20361
20541
  item: null,
20362
20542
  visible: false
20363
20543
  },
20364
- itemFormatCache: {}
20544
+ itemFormatCache: {},
20545
+ fullItemIdData: {},
20546
+ fullItemFieldData: {}
20365
20547
  };
20366
20548
  }
20367
20549
  var VxeFormComponent = defineVxeComponent({
@@ -20460,12 +20642,7 @@ var VxeFormComponent = defineVxeComponent({
20460
20642
  const $xeGrid = inject('$xeGrid', null);
20461
20643
  const xID = XEUtils.uniqueId();
20462
20644
  const { computeSize } = useSize(props);
20463
- const reactData = reactive({
20464
- collapseAll: props.collapseStatus,
20465
- staticItems: [],
20466
- formItems: [],
20467
- itemWidth: 0
20468
- });
20645
+ const reactData = reactive(createReactData$7());
20469
20646
  const internalData = createInternalData$9();
20470
20647
  const refElem = ref();
20471
20648
  const refTooltip = ref();
@@ -20529,7 +20706,7 @@ var VxeFormComponent = defineVxeComponent({
20529
20706
  }
20530
20707
  return [];
20531
20708
  };
20532
- const loadItem = (list) => {
20709
+ const loadItems = (list) => {
20533
20710
  if (list.length) {
20534
20711
  list.forEach((item) => {
20535
20712
  if (item.slots) {
@@ -20557,8 +20734,9 @@ var VxeFormComponent = defineVxeComponent({
20557
20734
  return itemList;
20558
20735
  };
20559
20736
  const getItemByField = (field) => {
20560
- const rest = XEUtils.findTree(reactData.formItems, item => item.field === field, { children: 'children' });
20561
- return rest ? rest.item : null;
20737
+ const { fullItemFieldData } = internalData;
20738
+ const itemRest = fullItemFieldData[field];
20739
+ return itemRest ? itemRest.item : null;
20562
20740
  };
20563
20741
  const getCollapseStatus = () => {
20564
20742
  return reactData.collapseAll;
@@ -20622,6 +20800,23 @@ var VxeFormComponent = defineVxeComponent({
20622
20800
  }
20623
20801
  return resetValue;
20624
20802
  };
20803
+ const cacheItem = () => {
20804
+ const { formItems } = reactData;
20805
+ const itemIdData = {};
20806
+ const itemFieldData = {};
20807
+ XEUtils.eachTree(formItems, (item, index, items) => {
20808
+ const { id, field } = item;
20809
+ const itemRest = { item, items, index };
20810
+ if (id) {
20811
+ itemIdData[id] = itemRest;
20812
+ }
20813
+ if (field) {
20814
+ itemFieldData[field] = itemRest;
20815
+ }
20816
+ }, { children: 'children' });
20817
+ internalData.fullItemFieldData = itemFieldData;
20818
+ internalData.fullItemIdData = itemIdData;
20819
+ };
20625
20820
  const reset = () => {
20626
20821
  const { data } = props;
20627
20822
  const itemList = getItems();
@@ -21002,10 +21197,25 @@ var VxeFormComponent = defineVxeComponent({
21002
21197
  const handleGlobalResizeEvent = () => {
21003
21198
  recalculate();
21004
21199
  };
21200
+ const handleItemVisible = (visible) => {
21201
+ return function (fieldOrItems) {
21202
+ const objs = XEUtils.isArray(fieldOrItems) ? fieldOrItems : [fieldOrItems];
21203
+ objs.forEach(obj => {
21204
+ const item = handleFieldOrItem($xeForm, obj);
21205
+ if (item) {
21206
+ item.visible = visible;
21207
+ }
21208
+ });
21209
+ return nextTick();
21210
+ };
21211
+ };
21005
21212
  formMethods = {
21006
21213
  dispatchEvent(type, params, evnt) {
21007
21214
  emit(type, createEvent(evnt, { $form: $xeForm, $grid: $xeGrid }, params));
21008
21215
  },
21216
+ loadItems,
21217
+ showItem: handleItemVisible(true),
21218
+ hideItem: handleItemVisible(false),
21009
21219
  reset,
21010
21220
  validate,
21011
21221
  validateField,
@@ -21054,12 +21264,12 @@ var VxeFormComponent = defineVxeComponent({
21054
21264
  : formItems.map((item, index) => {
21055
21265
  return h(VxeFormConfigItem, {
21056
21266
  key: index,
21057
- itemConfig: item
21267
+ itemConfig: item,
21268
+ visible: item.visible
21058
21269
  });
21059
21270
  })),
21060
21271
  h('div', {
21061
- class: 'vxe-form-slots',
21062
- ref: 'hideItem'
21272
+ class: 'vxe-form-slots'
21063
21273
  }, customLayout ? [] : (defaultSlot ? defaultSlot({}) : [])),
21064
21274
  /**
21065
21275
  * 加载中
@@ -21096,6 +21306,7 @@ var VxeFormComponent = defineVxeComponent({
21096
21306
  watch(staticItemFlag, () => {
21097
21307
  reactData.formItems = reactData.staticItems;
21098
21308
  recalcFlag.value++;
21309
+ cacheItem();
21099
21310
  });
21100
21311
  const itemFlag = ref(0);
21101
21312
  watch(() => props.items ? props.items.length : -1, () => {
@@ -21105,7 +21316,7 @@ var VxeFormComponent = defineVxeComponent({
21105
21316
  itemFlag.value++;
21106
21317
  });
21107
21318
  watch(itemFlag, () => {
21108
- loadItem(props.items || []);
21319
+ loadItems(props.items || []);
21109
21320
  });
21110
21321
  watch(() => props.collapseStatus, (value) => {
21111
21322
  reactData.collapseAll = !!value;
@@ -21128,8 +21339,9 @@ var VxeFormComponent = defineVxeComponent({
21128
21339
  globalEvents.off($xeForm, 'resize');
21129
21340
  XEUtils.assign(internalData, createInternalData$9());
21130
21341
  });
21342
+ reactData.collapseAll = !!props.collapseStatus;
21131
21343
  if (props.items) {
21132
- loadItem(props.items);
21344
+ loadItems(props.items);
21133
21345
  }
21134
21346
  provide('xeFormItemInfo', null);
21135
21347
  provide('$xeForm', $xeForm);
@@ -21152,159 +21364,6 @@ dynamicApp.use(VxeForm);
21152
21364
  VxeUI.component(VxeFormComponent);
21153
21365
  const Form = VxeForm;
21154
21366
 
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
21367
  var VxeFormGroupComponent = defineVxeComponent({
21309
21368
  name: 'VxeFormGroup',
21310
21369
  props: formItemProps,
@@ -26464,7 +26523,10 @@ var VxeSelectComponent = defineVxeComponent({
26464
26523
  props: {
26465
26524
  modelValue: [String, Number, Boolean, Array],
26466
26525
  defaultConfig: Object,
26467
- clearable: Boolean,
26526
+ clearable: {
26527
+ type: Boolean,
26528
+ default: () => getConfig$3().select.clearable
26529
+ },
26468
26530
  placeholder: String,
26469
26531
  readonly: {
26470
26532
  type: Boolean,
@@ -33179,7 +33241,10 @@ var VxeTableSelectComponent = defineVxeComponent({
33179
33241
  name: 'VxeTableSelect',
33180
33242
  props: {
33181
33243
  modelValue: [String, Number, Array],
33182
- clearable: Boolean,
33244
+ clearable: {
33245
+ type: Boolean,
33246
+ default: getConfig$3().tableSelect.clearable
33247
+ },
33183
33248
  placeholder: {
33184
33249
  type: String,
33185
33250
  default: () => XEUtils.eqNull(getConfig$3().tableSelect.placeholder) ? getI18n$2('vxe.base.pleaseSelect') : getConfig$3().tableSelect.placeholder
@@ -38622,7 +38687,10 @@ var VxeTreeSelectComponent = defineVxeComponent({
38622
38687
  name: 'VxeTreeSelect',
38623
38688
  props: {
38624
38689
  modelValue: [String, Number, Array],
38625
- clearable: Boolean,
38690
+ clearable: {
38691
+ type: Boolean,
38692
+ default: getConfig$3().treeSelect.clearable
38693
+ },
38626
38694
  placeholder: {
38627
38695
  type: String,
38628
38696
  default: () => XEUtils.eqNull(getConfig$3().treeSelect.placeholder) ? getI18n$2('vxe.base.pleaseSelect') : getConfig$3().treeSelect.placeholder
@@ -40044,7 +40112,9 @@ var VxeUploadComponent = defineVxeComponent({
40044
40112
  const computeMoreOpts = computed(() => {
40045
40113
  return Object.assign({ showMoreButton: true }, props.moreConfig);
40046
40114
  });
40047
- const computeMaps = {};
40115
+ const computeMaps = {
40116
+ computeUrlProp
40117
+ };
40048
40118
  const $xeUpload = {
40049
40119
  xID,
40050
40120
  props,
@@ -40437,14 +40507,16 @@ var VxeUploadComponent = defineVxeComponent({
40437
40507
  handleChange(fileList);
40438
40508
  // 自动更新校验状态
40439
40509
  if ($xeForm && formItemInfo) {
40440
- $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, fileList);
40510
+ $xeForm.triggerItemEvent(evnt || { type: 'remove' }, formItemInfo.itemConfig.field, fileList);
40511
+ }
40512
+ if (evnt) {
40513
+ dispatchEvent('remove', { option: item }, evnt);
40441
40514
  }
40442
- dispatchEvent('remove', { option: item }, evnt);
40443
40515
  };
40444
40516
  const removeFileEvent = (evnt, item, index) => {
40445
40517
  const beforeRemoveFn = props.beforeRemoveMethod || getConfig$3().upload.beforeRemoveMethod;
40446
40518
  const removeFn = props.removeMethod || getConfig$3().upload.removeMethod;
40447
- Promise.resolve(beforeRemoveFn
40519
+ return Promise.resolve(beforeRemoveFn
40448
40520
  ? beforeRemoveFn({
40449
40521
  $upload: $xeUpload,
40450
40522
  option: item
@@ -40464,8 +40536,11 @@ var VxeUploadComponent = defineVxeComponent({
40464
40536
  }
40465
40537
  }
40466
40538
  else {
40467
- dispatchEvent('remove-fail', { option: item }, evnt);
40539
+ if (evnt) {
40540
+ dispatchEvent('remove-fail', { option: item }, evnt);
40541
+ }
40468
40542
  }
40543
+ return status;
40469
40544
  });
40470
40545
  };
40471
40546
  const handleDownloadEvent = (evnt, item) => {
@@ -40824,11 +40899,46 @@ var VxeUploadComponent = defineVxeComponent({
40824
40899
  const handleGlobalBlurEvent = () => {
40825
40900
  reactData.isActivated = false;
40826
40901
  };
40902
+ const handleClearFile = (evnt) => {
40903
+ const { fileList } = reactData;
40904
+ const urlProp = computeUrlProp.value;
40905
+ const rest = [];
40906
+ XEUtils.lastEach(fileList, (item, index) => {
40907
+ rest.push(removeFileEvent(evnt, item, index).then((status) => {
40908
+ return { url: item[urlProp], status };
40909
+ }));
40910
+ });
40911
+ return Promise.all(rest);
40912
+ };
40913
+ const handleRemoveFile = (evnt, urlOrItem) => {
40914
+ const { fileList } = reactData;
40915
+ const urlProp = computeUrlProp.value;
40916
+ const urls = (XEUtils.isArray(urlOrItem) ? urlOrItem : [urlOrItem]);
40917
+ const rest = [];
40918
+ urls.forEach((obj) => {
40919
+ if (obj) {
40920
+ const url = XEUtils.isString(obj) ? obj : obj[urlProp];
40921
+ const index = XEUtils.findIndexOf(fileList, fileItem => fileItem[urlProp] === url);
40922
+ if (index > -1) {
40923
+ rest.push(removeFileEvent(evnt, fileList[index], index).then(status => {
40924
+ return { url, status };
40925
+ }));
40926
+ }
40927
+ }
40928
+ });
40929
+ return Promise.all(rest);
40930
+ };
40827
40931
  const uploadMethods = {
40828
40932
  dispatchEvent,
40829
40933
  choose() {
40830
40934
  return handleChoose(null);
40831
40935
  },
40936
+ clear() {
40937
+ return handleClearFile(null);
40938
+ },
40939
+ clearByEvent(evnt) {
40940
+ return handleClearFile(evnt);
40941
+ },
40832
40942
  getPendingFiles() {
40833
40943
  const { fileList, fileCacheMaps } = reactData;
40834
40944
  const pendingFiles = [];
@@ -40891,9 +41001,17 @@ var VxeUploadComponent = defineVxeComponent({
40891
41001
  VxeUI.modal.close(internalData.moreId);
40892
41002
  }
40893
41003
  return nextTick();
41004
+ },
41005
+ remove(urlOrItem) {
41006
+ return handleRemoveFile(null, urlOrItem);
41007
+ },
41008
+ removeByEvent(evnt, urlOrItem) {
41009
+ return handleRemoveFile(evnt, urlOrItem);
40894
41010
  }
40895
41011
  };
40896
- const uploadPrivateMethods = {};
41012
+ const uploadPrivateMethods = {
41013
+ removeFileEvent
41014
+ };
40897
41015
  Object.assign($xeUpload, uploadMethods, uploadPrivateMethods);
40898
41016
  const renderFileItemList = (currList, isMoreView) => {
40899
41017
  const { showRemoveButton, showDownloadButton, showProgress, progressText, showPreview, showErrorStatus, dragSort, autoSubmit, showSubmitButton } = props;