vxe-pc-ui 4.6.1 → 4.6.3

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 (64) hide show
  1. package/es/date-panel/src/date-panel.js +16 -3
  2. package/es/date-picker/src/date-picker.js +7 -4
  3. package/es/date-range-picker/src/date-range-picker.js +7 -6
  4. package/es/form/src/form-item.js +1 -0
  5. package/es/form/src/form.js +15 -6
  6. package/es/form/src/itemInfo.js +18 -0
  7. package/es/form/src/render.js +45 -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/log.js +1 -1
  13. package/helper/vetur/attributes.json +1 -1
  14. package/helper/vetur/tags.json +1 -1
  15. package/lib/date-panel/src/date-panel.js +15 -3
  16. package/lib/date-panel/src/date-panel.min.js +1 -1
  17. package/lib/date-picker/src/date-picker.js +8 -4
  18. package/lib/date-picker/src/date-picker.min.js +1 -1
  19. package/lib/date-range-picker/src/date-range-picker.js +7 -6
  20. package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
  21. package/lib/form/src/form-item.js +1 -0
  22. package/lib/form/src/form-item.min.js +1 -1
  23. package/lib/form/src/form.js +19 -6
  24. package/lib/form/src/form.min.js +1 -1
  25. package/lib/form/src/itemInfo.js +19 -0
  26. package/lib/form/src/itemInfo.min.js +1 -1
  27. package/lib/form/src/render.js +45 -3
  28. package/lib/form/src/render.min.js +1 -1
  29. package/lib/icon/style/style.css +1 -1
  30. package/lib/icon/style/style.min.css +1 -1
  31. package/lib/index.umd.js +116 -24
  32. package/lib/index.umd.min.js +1 -1
  33. package/lib/style.css +1 -1
  34. package/lib/style.min.css +1 -1
  35. package/lib/ui/index.js +1 -1
  36. package/lib/ui/index.min.js +1 -1
  37. package/lib/ui/src/log.js +1 -1
  38. package/lib/ui/src/log.min.js +1 -1
  39. package/package.json +1 -1
  40. package/packages/date-panel/src/date-panel.ts +14 -3
  41. package/packages/date-picker/src/date-picker.ts +8 -5
  42. package/packages/date-range-picker/src/date-range-picker.ts +7 -6
  43. package/packages/form/src/form-item.ts +1 -0
  44. package/packages/form/src/form.ts +15 -6
  45. package/packages/form/src/itemInfo.ts +18 -0
  46. package/packages/form/src/render.ts +44 -5
  47. package/types/components/date-panel.d.ts +3 -1
  48. package/types/components/date-picker.d.ts +2 -0
  49. package/types/components/date-range-picker.d.ts +2 -0
  50. package/types/components/form-item.d.ts +13 -0
  51. package/types/components/form.d.ts +8 -0
  52. package/types/ui/formats.d.ts +14 -0
  53. /package/es/icon/{iconfont.1746801282055.ttf → iconfont.1747005800508.ttf} +0 -0
  54. /package/es/icon/{iconfont.1746801282055.woff → iconfont.1747005800508.woff} +0 -0
  55. /package/es/icon/{iconfont.1746801282055.woff2 → iconfont.1747005800508.woff2} +0 -0
  56. /package/es/{iconfont.1746801282055.ttf → iconfont.1747005800508.ttf} +0 -0
  57. /package/es/{iconfont.1746801282055.woff → iconfont.1747005800508.woff} +0 -0
  58. /package/es/{iconfont.1746801282055.woff2 → iconfont.1747005800508.woff2} +0 -0
  59. /package/lib/icon/style/{iconfont.1746801282055.ttf → iconfont.1747005800508.ttf} +0 -0
  60. /package/lib/icon/style/{iconfont.1746801282055.woff → iconfont.1747005800508.woff} +0 -0
  61. /package/lib/icon/style/{iconfont.1746801282055.woff2 → iconfont.1747005800508.woff2} +0 -0
  62. /package/lib/{iconfont.1746801282055.ttf → iconfont.1747005800508.ttf} +0 -0
  63. /package/lib/{iconfont.1746801282055.woff → iconfont.1747005800508.woff} +0 -0
  64. /package/lib/{iconfont.1746801282055.woff2 → iconfont.1747005800508.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -4213,14 +4213,14 @@ function checkDynamic() {
4213
4213
  }
4214
4214
  ;// CONCATENATED MODULE: ./packages/ui/src/log.ts
4215
4215
 
4216
- const log_version = `ui v${"4.6.1"}`;
4216
+ const log_version = `ui v${"4.6.3"}`;
4217
4217
  const warnLog = log.create('warn', log_version);
4218
4218
  const errLog = log.create('error', log_version);
4219
4219
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
4220
4220
 
4221
4221
 
4222
4222
 
4223
- const ui_version = "4.6.1";
4223
+ const ui_version = "4.6.3";
4224
4224
  index_esm_VxeUI.uiVersion = ui_version;
4225
4225
  index_esm_VxeUI.dynamicApp = dynamicApp;
4226
4226
  function config(options) {
@@ -14635,6 +14635,7 @@ const Countdown = VxeCountdown;
14635
14635
  type: [String, Number, Date],
14636
14636
  default: () => getConfig().datePanel.endDate
14637
14637
  },
14638
+ defaultDate: [String, Number, Date],
14638
14639
  minDate: [String, Number, Date],
14639
14640
  maxDate: [String, Number, Date],
14640
14641
  startDay: {
@@ -15708,9 +15709,11 @@ const Countdown = VxeCountdown;
15708
15709
  };
15709
15710
  const dateOpenPanel = () => {
15710
15711
  const {
15711
- type
15712
+ type,
15713
+ defaultDate
15712
15714
  } = props;
15713
15715
  const isDateTimeType = computeIsDateTimeType.value;
15716
+ const dateValueFormat = computeDateValueFormat.value;
15714
15717
  const dateValue = computeDateValue.value;
15715
15718
  if (['year', 'quarter', 'month', 'week'].indexOf(type) > -1) {
15716
15719
  reactData.datePanelType = type;
@@ -15722,7 +15725,16 @@ const Countdown = VxeCountdown;
15722
15725
  dateMonthHandle(dateValue, 0);
15723
15726
  dateParseValue(dateValue);
15724
15727
  } else {
15725
- dateNowHandle();
15728
+ if (defaultDate) {
15729
+ const defDate = parseDate(defaultDate, dateValueFormat);
15730
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isValidDate(defDate)) {
15731
+ dateMonthHandle(defDate, 0);
15732
+ } else {
15733
+ dateNowHandle();
15734
+ }
15735
+ } else {
15736
+ dateNowHandle();
15737
+ }
15726
15738
  }
15727
15739
  if (isDateTimeType) {
15728
15740
  reactData.datetimePanelValue = reactData.datePanelValue || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().getWhatDay(Date.now(), 0, 'first');
@@ -15741,7 +15753,7 @@ const Countdown = VxeCountdown;
15741
15753
  };
15742
15754
  const datePanelMethods = {
15743
15755
  dispatchEvent,
15744
- getValue() {
15756
+ getModelValue() {
15745
15757
  return reactData.inputValue;
15746
15758
  },
15747
15759
  setPanelDate(date) {
@@ -16339,6 +16351,7 @@ const DatePanel = VxeDatePanel;
16339
16351
  type: [String, Number, Date],
16340
16352
  default: () => getConfig().datePicker.endDate
16341
16353
  },
16354
+ defaultDate: [String, Number, Date],
16342
16355
  minDate: [String, Number, Date],
16343
16356
  maxDate: [String, Number, Date],
16344
16357
  startDay: {
@@ -16719,7 +16732,8 @@ const DatePanel = VxeDatePanel;
16719
16732
  };
16720
16733
  const panelChangeEvent = params => {
16721
16734
  const {
16722
- multiple
16735
+ multiple,
16736
+ autoClose
16723
16737
  } = props;
16724
16738
  const {
16725
16739
  value,
@@ -16728,7 +16742,9 @@ const DatePanel = VxeDatePanel;
16728
16742
  const isDateTimeType = computeIsDateTimeType.value;
16729
16743
  handleChange(value, $event);
16730
16744
  if (!multiple && !isDateTimeType) {
16731
- hidePanel();
16745
+ if (autoClose) {
16746
+ hidePanel();
16747
+ }
16732
16748
  }
16733
16749
  };
16734
16750
  // 全局事件
@@ -17106,6 +17122,7 @@ const DatePanel = VxeDatePanel;
17106
17122
  startDate: props.startDate,
17107
17123
  endDate: props.endDate,
17108
17124
  minDate: props.minDate,
17125
+ defaultDate: props.defaultDate,
17109
17126
  maxDate: props.maxDate,
17110
17127
  startDay: props.startDay,
17111
17128
  labelFormat: props.labelFormat,
@@ -17113,8 +17130,7 @@ const DatePanel = VxeDatePanel;
17113
17130
  festivalMethod: props.festivalMethod,
17114
17131
  disabledMethod: props.disabledMethod,
17115
17132
  selectDay: props.selectDay,
17116
- onChange: panelChangeEvent,
17117
- onDateToday: hidePanel
17133
+ onChange: panelChangeEvent
17118
17134
  })]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
17119
17135
  class: 'vxe-date-picker--layout-footer-wrapper'
17120
17136
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
@@ -17338,6 +17354,7 @@ const DatePicker = VxeDatePicker;
17338
17354
  },
17339
17355
  minDate: [String, Number, Date],
17340
17356
  maxDate: [String, Number, Date],
17357
+ defaultDate: [String, Number, Date],
17341
17358
  startDay: {
17342
17359
  type: [String, Number],
17343
17360
  default: () => getConfig().dateRangePicker.startDay
@@ -17767,8 +17784,8 @@ const DatePicker = VxeDatePicker;
17767
17784
  const $startDatePanel = refStartDatePanel.value;
17768
17785
  const $endDatePanel = refEndDatePanel.value;
17769
17786
  if ($startDatePanel && $endDatePanel) {
17770
- const startValue = $startDatePanel.getValue();
17771
- const endValue = $endDatePanel.getValue();
17787
+ const startValue = $startDatePanel.getModelValue();
17788
+ const endValue = $endDatePanel.getModelValue();
17772
17789
  if (!startValue || !endValue) {
17773
17790
  handleChange('', '', {
17774
17791
  type: 'check'
@@ -17848,8 +17865,8 @@ const DatePicker = VxeDatePicker;
17848
17865
  const $startDatePanel = refStartDatePanel.value;
17849
17866
  const $endDatePanel = refEndDatePanel.value;
17850
17867
  if ($startDatePanel && $endDatePanel) {
17851
- const startValue = $startDatePanel.getValue();
17852
- const endValue = $endDatePanel.getValue();
17868
+ const startValue = $startDatePanel.getModelValue();
17869
+ const endValue = $endDatePanel.getModelValue();
17853
17870
  if (startValue && endValue) {
17854
17871
  $startDatePanel.confirmByEvent(evnt);
17855
17872
  $endDatePanel.confirmByEvent(evnt);
@@ -17877,7 +17894,7 @@ const DatePicker = VxeDatePicker;
17877
17894
  const $startDatePanel = refStartDatePanel.value;
17878
17895
  const $endDatePanel = refEndDatePanel.value;
17879
17896
  if ($startDatePanel && $endDatePanel) {
17880
- const startValue = $startDatePanel.getValue();
17897
+ const startValue = $startDatePanel.getModelValue();
17881
17898
  if (!endValue && startValue) {
17882
17899
  $endDatePanel.setPanelDate(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringDate(startValue));
17883
17900
  }
@@ -17902,7 +17919,7 @@ const DatePicker = VxeDatePicker;
17902
17919
  const $startDatePanel = refStartDatePanel.value;
17903
17920
  const $endDatePanel = refEndDatePanel.value;
17904
17921
  if ($startDatePanel && $endDatePanel) {
17905
- const endValue = $endDatePanel.getValue();
17922
+ const endValue = $endDatePanel.getModelValue();
17906
17923
  if (!startValue && endValue) {
17907
17924
  $startDatePanel.setPanelDate(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toStringDate(endValue));
17908
17925
  }
@@ -19320,8 +19337,26 @@ const Empty = VxeEmpty;
19320
19337
  /* harmony default export */ var packages_empty = (VxeEmpty);
19321
19338
  ;// CONCATENATED MODULE: ./packages/form/src/itemInfo.ts
19322
19339
 
19340
+
19341
+
19323
19342
  class ItemInfo {
19324
19343
  constructor($xeForm, item) {
19344
+ const {
19345
+ formatter
19346
+ } = item;
19347
+ if (formatter) {
19348
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
19349
+ const gFormatOpts = formats.get(formatter);
19350
+ if (!gFormatOpts || !gFormatOpts.formItemFormatMethod) {
19351
+ errLog('vxe.error.notFormats', [formatter]);
19352
+ }
19353
+ } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
19354
+ const gFormatOpts = formats.get(formatter[0]);
19355
+ if (!gFormatOpts || !gFormatOpts.formItemFormatMethod) {
19356
+ errLog('vxe.error.notFormats', [formatter[0]]);
19357
+ }
19358
+ }
19359
+ }
19325
19360
  Object.assign(this, {
19326
19361
  id: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('item_'),
19327
19362
  title: item.title,
@@ -19354,6 +19389,7 @@ class ItemInfo {
19354
19389
  titleStyle: item.titleStyle,
19355
19390
  itemRender: item.itemRender,
19356
19391
  rules: item.rules,
19392
+ formatter,
19357
19393
  // 渲染属性
19358
19394
  showError: false,
19359
19395
  errRule: null,
@@ -19782,11 +19818,15 @@ function renderTitle($xeForm, item, isGroup) {
19782
19818
  const renderItemContent = ($xeForm, item) => {
19783
19819
  const formProps = $xeForm.props;
19784
19820
  const formReactData = $xeForm.reactData;
19821
+ const formInternalData = $xeForm.internalData;
19785
19822
  const $xeGrid = $xeForm.xeGrid;
19786
19823
  const {
19787
19824
  computeCollapseOpts,
19788
19825
  computeValidOpts
19789
19826
  } = $xeForm.getComputeMaps();
19827
+ const {
19828
+ itemFormatCache
19829
+ } = formInternalData;
19790
19830
  const {
19791
19831
  data,
19792
19832
  readonly,
@@ -19800,13 +19840,15 @@ const renderItemContent = ($xeForm, item) => {
19800
19840
  field,
19801
19841
  itemRender,
19802
19842
  collapseNode,
19803
- errRule
19843
+ errRule,
19844
+ formatter
19804
19845
  } = item;
19805
19846
  const defaultSlot = slots ? slots.default : null;
19806
19847
  const validSlot = slots ? slots.valid : null;
19807
19848
  const collapseOpts = computeCollapseOpts.value;
19808
19849
  const validOpts = computeValidOpts.value;
19809
19850
  const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
19851
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
19810
19852
  const params = {
19811
19853
  data,
19812
19854
  disabled,
@@ -19814,6 +19856,7 @@ const renderItemContent = ($xeForm, item) => {
19814
19856
  field,
19815
19857
  property: field,
19816
19858
  item,
19859
+ itemValue,
19817
19860
  $form: $xeForm,
19818
19861
  $grid: $xeGrid
19819
19862
  };
@@ -19824,8 +19867,43 @@ const renderItemContent = ($xeForm, item) => {
19824
19867
  } else if (rftContent) {
19825
19868
  contentVNs = getSlotVNs(rftContent(itemRender, params));
19826
19869
  } else if (field) {
19827
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
19828
- contentVNs = [eqEmptyValue(itemValue) ? '' : `${itemValue}`];
19870
+ let itemLabel = itemValue;
19871
+ if (formatter) {
19872
+ let formatData;
19873
+ if (field) {
19874
+ const itemRest = itemFormatCache[field];
19875
+ if (itemRest) {
19876
+ formatData = itemRest.formatData;
19877
+ if (formatData) {
19878
+ if (formatData.value === itemValue) {
19879
+ return formatData.label;
19880
+ }
19881
+ } else {
19882
+ formatData = itemRest.formatData = {};
19883
+ }
19884
+ } else {
19885
+ itemFormatCache[field] = {
19886
+ field
19887
+ };
19888
+ }
19889
+ }
19890
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
19891
+ const gFormatOpts = formats.get(formatter);
19892
+ const fiFormatMethod = gFormatOpts ? gFormatOpts.formItemFormatMethod : null;
19893
+ itemLabel = fiFormatMethod ? fiFormatMethod(params) : '';
19894
+ } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
19895
+ const gFormatOpts = formats.get(formatter[0]);
19896
+ const fiFormatMethod = gFormatOpts ? gFormatOpts.formItemFormatMethod : null;
19897
+ itemLabel = fiFormatMethod ? fiFormatMethod(params, ...formatter.slice(1)) : '';
19898
+ } else {
19899
+ itemLabel = formatter(params);
19900
+ }
19901
+ if (formatData) {
19902
+ formatData.value = itemValue;
19903
+ formatData.label = itemLabel;
19904
+ }
19905
+ }
19906
+ contentVNs = [eqEmptyValue(itemLabel) ? '' : `${itemLabel}`];
19829
19907
  }
19830
19908
  if (collapseNode) {
19831
19909
  contentVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
@@ -20095,7 +20173,8 @@ const validErrorRuleValue = (rule, val) => {
20095
20173
  tooltipStore: {
20096
20174
  item: null,
20097
20175
  visible: false
20098
- }
20176
+ },
20177
+ itemFormatCache: {}
20099
20178
  });
20100
20179
  const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
20101
20180
  const refTooltip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
@@ -20123,6 +20202,7 @@ const validErrorRuleValue = (rule, val) => {
20123
20202
  props,
20124
20203
  context,
20125
20204
  reactData,
20205
+ internalData,
20126
20206
  xeGrid: $xeGrid,
20127
20207
  getRefMaps: () => refMaps,
20128
20208
  getComputeMaps: () => computeMaps
@@ -20155,6 +20235,7 @@ const validErrorRuleValue = (rule, val) => {
20155
20235
  reactData.staticItems = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(list, item => createItem($xeForm, item), {
20156
20236
  children: 'children'
20157
20237
  });
20238
+ internalData.itemFormatCache = {};
20158
20239
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
20159
20240
  };
20160
20241
  const getItems = () => {
@@ -20221,12 +20302,11 @@ const validErrorRuleValue = (rule, val) => {
20221
20302
  }
20222
20303
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
20223
20304
  };
20224
- const getResetValue = (item, data) => {
20305
+ const getResetValue = (item, data, itemValue) => {
20225
20306
  const {
20226
20307
  field,
20227
20308
  resetValue
20228
20309
  } = item;
20229
- const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
20230
20310
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resetValue)) {
20231
20311
  return resetValue({
20232
20312
  field,
@@ -20235,7 +20315,7 @@ const validErrorRuleValue = (rule, val) => {
20235
20315
  $form: $xeForm,
20236
20316
  $grid: $xeGrid
20237
20317
  });
20238
- } else if (resetValue === null) {
20318
+ } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(resetValue)) {
20239
20319
  // 默认
20240
20320
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(itemValue)) {
20241
20321
  return [];
@@ -20255,7 +20335,12 @@ const validErrorRuleValue = (rule, val) => {
20255
20335
  itemRender
20256
20336
  } = item;
20257
20337
  if (isEnableConf(itemRender)) {
20258
- const compConf = renderer.get(itemRender.name);
20338
+ const {
20339
+ name,
20340
+ startField,
20341
+ endField
20342
+ } = itemRender;
20343
+ const compConf = renderer.get(name);
20259
20344
  const fiResetMethod = compConf ? compConf.formItemResetMethod || compConf.itemResetMethod : null;
20260
20345
  if (compConf && fiResetMethod) {
20261
20346
  fiResetMethod({
@@ -20267,11 +20352,17 @@ const validErrorRuleValue = (rule, val) => {
20267
20352
  $grid: $xeGrid
20268
20353
  });
20269
20354
  } else if (field) {
20270
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, getResetValue(item, data));
20355
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
20356
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, getResetValue(item, data, itemValue));
20357
+ }
20358
+ if (startField && endField) {
20359
+ 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)));
20360
+ 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)));
20271
20361
  }
20272
20362
  }
20273
20363
  });
20274
20364
  }
20365
+ internalData.itemFormatCache = {};
20275
20366
  return clearValidate();
20276
20367
  };
20277
20368
  const resetEvent = evnt => {
@@ -23009,6 +23100,7 @@ const formItemProps = {
23009
23100
  type: Boolean,
23010
23101
  default: null
23011
23102
  },
23103
+ formatter: [String, Function],
23012
23104
  className: [String, Function],
23013
23105
  contentClassName: [String, Function],
23014
23106
  contentStyle: [Object, Function],