resolver-egretimp-plus 0.0.157 → 0.0.158

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.158",
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