resolver-egretimp-plus 0.0.157 → 0.0.159

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.157",
3
+ "version": "0.0.159",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -9,6 +9,10 @@ const props = defineProps({
9
9
  formatter: {
10
10
  type: Function,
11
11
  default: null
12
+ },
13
+ titleFormatter: {
14
+ type: Function,
15
+ default: null
12
16
  }
13
17
  })
14
18
 
@@ -30,6 +34,7 @@ const amountFormat = computed(() => {
30
34
 
31
35
  const calcProps = computed(() => {
32
36
  let desc = normalVal.value || props.config?.desc
37
+ let title = lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn
33
38
  try {
34
39
  if (desc?.toString) {
35
40
  desc = desc.toString()
@@ -41,13 +46,16 @@ const calcProps = computed(() => {
41
46
  desc = formatAmount(desc, amountFormat.value)
42
47
  }
43
48
  if (props.formatter && typeof props.formatter === "function") {
44
- desc = props.formatter(desc, props.config)
49
+ desc = props.formatter(desc, props.config, props)
50
+ }
51
+ if (props.titleFormatter && typeof props.titleFormatter === "function") {
52
+ title = props.titleFormatter(title, props.config, props)
45
53
  }
46
54
  } catch (error) {
47
55
  console.log('CmiCell, error==:', error)
48
56
  }
49
57
  return {
50
- title: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
58
+ title,
51
59
  desc,
52
60
  content: props.config?.content,
53
61
  to: props.config?.toHref,
@@ -129,8 +129,12 @@ const pmPageMetaList = computed(() => {
129
129
  })
130
130
 
131
131
  const getTableColumnProps = (config) => {
132
+ let label = lang?.value?.indexOf('zh') > -1 ? config.metaNameZh : config.metaNameEn
133
+ if (typeof config.titleFormatter === "function") {
134
+ label = config.titleFormatter(label, config, props)
135
+ }
132
136
  return {
133
- label: lang?.value?.indexOf('zh') > -1 ? config.metaNameZh : config.metaNameEn,
137
+ label,
134
138
  prop: config.metaCode,
135
139
  width: config.columnWidth,
136
140
  ellipsis: config.ellipsis === '1',
@@ -202,7 +206,7 @@ function normalTableRowValue(row) {
202
206
  ret[config.metaCode] = formatAmount(ret[config.metaCode], config.amountFormat)
203
207
  }
204
208
  if (typeof config?.formatter === "function") {
205
- ret[config.metaCode] = config.formatter(ret[config.metaCode], config)
209
+ ret[config.metaCode] = config.formatter(ret[config.metaCode], config, props)
206
210
  }
207
211
  })
208
212
  return ret
@@ -822,10 +822,33 @@ function getFormItemMargins(config) {
822
822
  return marginObj
823
823
  }
824
824
 
825
+ function normalLabelTipContent(content = '') {
826
+ if (content) {
827
+ const retList = []
828
+ const lines = content.split('\n')
829
+ lines.forEach((str, idx) => {
830
+ retList.push(str)
831
+ if (idx !== lines.length - 1) {
832
+ retList.push(
833
+ <br></br>
834
+ )
835
+ }
836
+ })
837
+ return retList
838
+ }
839
+ return ''
840
+ }
825
841
  function createFormLable(config, lang = 'zh') {
826
842
  const ElTooltip = resolveComponent('el-tooltip')
827
843
  const elIcon = resolveComponent('el-icon')
828
844
  const required = config.requiredFlag === '1'
845
+ const slots = {}
846
+ slots.default = () => {
847
+ return <span class="label-tip"><elIcon><QuestionFilled /></elIcon></span>
848
+ }
849
+ slots.content = () => {
850
+ return normalLabelTipContent(lang.indexOf('zh') > -1 ? config.hintContentZh : config.hintContentEn)
851
+ }
829
852
  return (
830
853
  <div title={lang.indexOf('zh') > -1 ? config.metaNameZh : config.metaNameEn} class="custom-label">
831
854
  <span class="custom-label-content" style={config.labelStyle}>
@@ -835,7 +858,7 @@ function createFormLable(config, lang = 'zh') {
835
858
  {
836
859
  config.hintFlag == '1' ? (
837
860
  <ElTooltip popper-class="poppper-class" effect="dark" content={lang.indexOf('zh') > -1 ? config.hintContentZh : config.hintContentEn} placement="top">
838
- <span class="label-tip"><elIcon><QuestionFilled /></elIcon></span>
861
+ { slots }
839
862
  </ElTooltip>
840
863
  ) : null
841
864
  }