vxe-pc-ui 4.6.1 → 4.6.2

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 (49) hide show
  1. package/es/form/src/form-item.js +1 -0
  2. package/es/form/src/form.js +5 -1
  3. package/es/form/src/itemInfo.js +18 -0
  4. package/es/form/src/render.js +45 -5
  5. package/es/icon/style.css +1 -1
  6. package/es/style.css +1 -1
  7. package/es/style.min.css +1 -1
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/log.js +1 -1
  10. package/helper/vetur/attributes.json +1 -1
  11. package/helper/vetur/tags.json +1 -1
  12. package/lib/form/src/form-item.js +1 -0
  13. package/lib/form/src/form-item.min.js +1 -1
  14. package/lib/form/src/form.js +5 -1
  15. package/lib/form/src/form.min.js +1 -1
  16. package/lib/form/src/itemInfo.js +19 -0
  17. package/lib/form/src/itemInfo.min.js +1 -1
  18. package/lib/form/src/render.js +45 -3
  19. package/lib/form/src/render.min.js +1 -1
  20. package/lib/icon/style/style.css +1 -1
  21. package/lib/icon/style/style.min.css +1 -1
  22. package/lib/index.umd.js +72 -6
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/style.css +1 -1
  25. package/lib/style.min.css +1 -1
  26. package/lib/ui/index.js +1 -1
  27. package/lib/ui/index.min.js +1 -1
  28. package/lib/ui/src/log.js +1 -1
  29. package/lib/ui/src/log.min.js +1 -1
  30. package/package.json +1 -1
  31. package/packages/form/src/form-item.ts +1 -0
  32. package/packages/form/src/form.ts +5 -1
  33. package/packages/form/src/itemInfo.ts +18 -0
  34. package/packages/form/src/render.ts +44 -5
  35. package/types/components/form-item.d.ts +13 -0
  36. package/types/components/form.d.ts +8 -0
  37. package/types/ui/formats.d.ts +14 -0
  38. /package/es/icon/{iconfont.1746801282055.ttf → iconfont.1746880516307.ttf} +0 -0
  39. /package/es/icon/{iconfont.1746801282055.woff → iconfont.1746880516307.woff} +0 -0
  40. /package/es/icon/{iconfont.1746801282055.woff2 → iconfont.1746880516307.woff2} +0 -0
  41. /package/es/{iconfont.1746801282055.ttf → iconfont.1746880516307.ttf} +0 -0
  42. /package/es/{iconfont.1746801282055.woff → iconfont.1746880516307.woff} +0 -0
  43. /package/es/{iconfont.1746801282055.woff2 → iconfont.1746880516307.woff2} +0 -0
  44. /package/lib/icon/style/{iconfont.1746801282055.ttf → iconfont.1746880516307.ttf} +0 -0
  45. /package/lib/icon/style/{iconfont.1746801282055.woff → iconfont.1746880516307.woff} +0 -0
  46. /package/lib/icon/style/{iconfont.1746801282055.woff2 → iconfont.1746880516307.woff2} +0 -0
  47. /package/lib/{iconfont.1746801282055.ttf → iconfont.1746880516307.ttf} +0 -0
  48. /package/lib/{iconfont.1746801282055.woff → iconfont.1746880516307.woff} +0 -0
  49. /package/lib/{iconfont.1746801282055.woff2 → iconfont.1746880516307.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.2"}`;
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.2";
4224
4224
  index_esm_VxeUI.uiVersion = ui_version;
4225
4225
  index_esm_VxeUI.dynamicApp = dynamicApp;
4226
4226
  function config(options) {
@@ -19320,8 +19320,26 @@ const Empty = VxeEmpty;
19320
19320
  /* harmony default export */ var packages_empty = (VxeEmpty);
19321
19321
  ;// CONCATENATED MODULE: ./packages/form/src/itemInfo.ts
19322
19322
 
19323
+
19324
+
19323
19325
  class ItemInfo {
19324
19326
  constructor($xeForm, item) {
19327
+ const {
19328
+ formatter
19329
+ } = item;
19330
+ if (formatter) {
19331
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
19332
+ const gFormatOpts = formats.get(formatter);
19333
+ if (!gFormatOpts || !gFormatOpts.formItemFormatMethod) {
19334
+ errLog('vxe.error.notFormats', [formatter]);
19335
+ }
19336
+ } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
19337
+ const gFormatOpts = formats.get(formatter[0]);
19338
+ if (!gFormatOpts || !gFormatOpts.formItemFormatMethod) {
19339
+ errLog('vxe.error.notFormats', [formatter[0]]);
19340
+ }
19341
+ }
19342
+ }
19325
19343
  Object.assign(this, {
19326
19344
  id: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('item_'),
19327
19345
  title: item.title,
@@ -19354,6 +19372,7 @@ class ItemInfo {
19354
19372
  titleStyle: item.titleStyle,
19355
19373
  itemRender: item.itemRender,
19356
19374
  rules: item.rules,
19375
+ formatter,
19357
19376
  // 渲染属性
19358
19377
  showError: false,
19359
19378
  errRule: null,
@@ -19782,11 +19801,15 @@ function renderTitle($xeForm, item, isGroup) {
19782
19801
  const renderItemContent = ($xeForm, item) => {
19783
19802
  const formProps = $xeForm.props;
19784
19803
  const formReactData = $xeForm.reactData;
19804
+ const formInternalData = $xeForm.internalData;
19785
19805
  const $xeGrid = $xeForm.xeGrid;
19786
19806
  const {
19787
19807
  computeCollapseOpts,
19788
19808
  computeValidOpts
19789
19809
  } = $xeForm.getComputeMaps();
19810
+ const {
19811
+ itemFormatCache
19812
+ } = formInternalData;
19790
19813
  const {
19791
19814
  data,
19792
19815
  readonly,
@@ -19800,13 +19823,15 @@ const renderItemContent = ($xeForm, item) => {
19800
19823
  field,
19801
19824
  itemRender,
19802
19825
  collapseNode,
19803
- errRule
19826
+ errRule,
19827
+ formatter
19804
19828
  } = item;
19805
19829
  const defaultSlot = slots ? slots.default : null;
19806
19830
  const validSlot = slots ? slots.valid : null;
19807
19831
  const collapseOpts = computeCollapseOpts.value;
19808
19832
  const validOpts = computeValidOpts.value;
19809
19833
  const compConf = isEnableConf(itemRender) ? renderer.get(itemRender.name) : null;
19834
+ const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
19810
19835
  const params = {
19811
19836
  data,
19812
19837
  disabled,
@@ -19814,6 +19839,7 @@ const renderItemContent = ($xeForm, item) => {
19814
19839
  field,
19815
19840
  property: field,
19816
19841
  item,
19842
+ itemValue,
19817
19843
  $form: $xeForm,
19818
19844
  $grid: $xeGrid
19819
19845
  };
@@ -19824,8 +19850,43 @@ const renderItemContent = ($xeForm, item) => {
19824
19850
  } else if (rftContent) {
19825
19851
  contentVNs = getSlotVNs(rftContent(itemRender, params));
19826
19852
  } 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}`];
19853
+ let itemLabel = itemValue;
19854
+ if (formatter) {
19855
+ let formatData;
19856
+ if (field) {
19857
+ const itemRest = itemFormatCache[field];
19858
+ if (itemRest) {
19859
+ formatData = itemRest.formatData;
19860
+ if (formatData) {
19861
+ if (formatData.value === itemValue) {
19862
+ return formatData.label;
19863
+ }
19864
+ } else {
19865
+ formatData = itemRest.formatData = {};
19866
+ }
19867
+ } else {
19868
+ itemFormatCache[field] = {
19869
+ field
19870
+ };
19871
+ }
19872
+ }
19873
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
19874
+ const gFormatOpts = formats.get(formatter);
19875
+ const fiFormatMethod = gFormatOpts ? gFormatOpts.formItemFormatMethod : null;
19876
+ itemLabel = fiFormatMethod ? fiFormatMethod(params) : '';
19877
+ } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
19878
+ const gFormatOpts = formats.get(formatter[0]);
19879
+ const fiFormatMethod = gFormatOpts ? gFormatOpts.formItemFormatMethod : null;
19880
+ itemLabel = fiFormatMethod ? fiFormatMethod(params, ...formatter.slice(1)) : '';
19881
+ } else {
19882
+ itemLabel = formatter(params);
19883
+ }
19884
+ if (formatData) {
19885
+ formatData.value = itemValue;
19886
+ formatData.label = itemLabel;
19887
+ }
19888
+ }
19889
+ contentVNs = [eqEmptyValue(itemLabel) ? '' : `${itemLabel}`];
19829
19890
  }
19830
19891
  if (collapseNode) {
19831
19892
  contentVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
@@ -20095,7 +20156,8 @@ const validErrorRuleValue = (rule, val) => {
20095
20156
  tooltipStore: {
20096
20157
  item: null,
20097
20158
  visible: false
20098
- }
20159
+ },
20160
+ itemFormatCache: {}
20099
20161
  });
20100
20162
  const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
20101
20163
  const refTooltip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
@@ -20123,6 +20185,7 @@ const validErrorRuleValue = (rule, val) => {
20123
20185
  props,
20124
20186
  context,
20125
20187
  reactData,
20188
+ internalData,
20126
20189
  xeGrid: $xeGrid,
20127
20190
  getRefMaps: () => refMaps,
20128
20191
  getComputeMaps: () => computeMaps
@@ -20155,6 +20218,7 @@ const validErrorRuleValue = (rule, val) => {
20155
20218
  reactData.staticItems = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(list, item => createItem($xeForm, item), {
20156
20219
  children: 'children'
20157
20220
  });
20221
+ internalData.itemFormatCache = {};
20158
20222
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
20159
20223
  };
20160
20224
  const getItems = () => {
@@ -20272,6 +20336,7 @@ const validErrorRuleValue = (rule, val) => {
20272
20336
  }
20273
20337
  });
20274
20338
  }
20339
+ internalData.itemFormatCache = {};
20275
20340
  return clearValidate();
20276
20341
  };
20277
20342
  const resetEvent = evnt => {
@@ -23009,6 +23074,7 @@ const formItemProps = {
23009
23074
  type: Boolean,
23010
23075
  default: null
23011
23076
  },
23077
+ formatter: [String, Function],
23012
23078
  className: [String, Function],
23013
23079
  contentClassName: [String, Function],
23014
23080
  contentStyle: [Object, Function],