@tripup-company/element-ui-extended 0.0.88 → 0.0.89

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": "@tripup-company/element-ui-extended",
3
- "version": "0.0.88",
3
+ "version": "0.0.89",
4
4
  "main": "./dist/element-ui-extended.umd.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve && tsc --emitDeclarationOnly",
@@ -4,19 +4,19 @@
4
4
  <template v-for="field in fields">
5
5
  <template v-if="field.callback">
6
6
  <el-table-column
7
- :key="field.prop"
8
- v-slot="context"
9
- :prop="field.prop"
10
- :label="field.label"
11
- :width="field.width ? field.width : null"
12
- :sortable="field.sortable ? field.sortable : null"
7
+ :key="field.prop"
8
+ v-slot="context"
9
+ :prop="field.prop"
10
+ :label="field.label"
11
+ :width="field.width ? field.width : null"
12
+ :sortable="field.sortable ? field.sortable : null"
13
13
  >
14
14
  <el-link v-if="field.href" :href="customHref(field, context)">
15
15
  {{ customLinkLabel(field, context) }}
16
16
  </el-link>
17
17
  <el-link
18
- v-else
19
- @click.prevent="
18
+ v-else
19
+ @click.prevent="
20
20
  field.callback(field.prop, context.$index, context.row)
21
21
  "
22
22
  >
@@ -24,16 +24,29 @@
24
24
  </el-link>
25
25
  </el-table-column>
26
26
  </template>
27
+ <template v-else-if="field.type && field.type === 'template'">
28
+ <el-table-column
29
+ :key="field.prop"
30
+ :prop="field.prop"
31
+ :label="field.label"
32
+ :width="field.width ? field.width : null"
33
+ :sortable="field.sortable ? field.sortable : null"
34
+ >
35
+ <template slot-scope="scope">
36
+ <span v-html="field.formatter(scope)"></span>
37
+ </template>
38
+ </el-table-column>
39
+ </template>
27
40
  <template v-else>
28
41
  <el-table-column
29
- :formatter="
42
+ :formatter="
30
43
  typeof field.formatter === 'function' ? field.formatter : null
31
44
  "
32
- :key="field.prop"
33
- :prop="field.prop"
34
- :label="field.label"
35
- :width="field.width ? field.width : null"
36
- :sortable="field.sortable ? field.sortable : null"
45
+ :key="field.prop"
46
+ :prop="field.prop"
47
+ :label="field.label"
48
+ :width="field.width ? field.width : null"
49
+ :sortable="field.sortable ? field.sortable : null"
37
50
  />
38
51
  </template>
39
52
  </template>
@@ -68,15 +81,15 @@ export default {
68
81
  },
69
82
  customHref(field, context) {
70
83
  return field.href
71
- ? typeof field.href === "function"
72
- ? field.href(field.prop, context.$index, context.row)
73
- : field.href
74
- : "#";
84
+ ? typeof field.href === "function"
85
+ ? field.href(field.prop, context.$index, context.row)
86
+ : field.href
87
+ : "#";
75
88
  },
76
89
  customLinkLabel(field, context) {
77
90
  return typeof field.formatter === "function"
78
- ? field.formatter(context.row)
79
- : context.row[field.prop];
91
+ ? field.formatter(context.row)
92
+ : context.row[field.prop];
80
93
  },
81
94
  },
82
95
  };