@iamproperty/components 2.7.8 → 2.7.9
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/dist/components.common.js +26 -14
- package/dist/components.common.js.map +1 -1
- package/dist/components.umd.js +26 -14
- package/dist/components.umd.js.map +1 -1
- package/dist/components.umd.min.js +1 -1
- package/dist/components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/Table/Table.vue +22 -9
package/package.json
CHANGED
|
@@ -20,6 +20,21 @@
|
|
|
20
20
|
import { ucfirst, unsnake } from '../../helpers/strings'
|
|
21
21
|
import table from '../../../assets/js/modules/table.js'
|
|
22
22
|
|
|
23
|
+
let numericValue = function(value) {
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
console.log(value);
|
|
27
|
+
|
|
28
|
+
value = value.replace('£','')
|
|
29
|
+
value = value.replace('%','')
|
|
30
|
+
|
|
31
|
+
if (Number.isNaN(Number.parseFloat(value))) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return Number.parseFloat(value)
|
|
36
|
+
}
|
|
37
|
+
|
|
23
38
|
export default {
|
|
24
39
|
name: 'Table',
|
|
25
40
|
props: {
|
|
@@ -65,14 +80,8 @@ export default {
|
|
|
65
80
|
numericValue () {
|
|
66
81
|
return (value) => {
|
|
67
82
|
|
|
68
|
-
value = value
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (Number.isNaN(Number.parseFloat(value))) {
|
|
72
|
-
return 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return Number.parseFloat(value)
|
|
83
|
+
value = numericValue(value);
|
|
84
|
+
return value;
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
87
|
},
|
|
@@ -103,7 +112,11 @@ export default {
|
|
|
103
112
|
|
|
104
113
|
let tbodyHTML = '';
|
|
105
114
|
this.items.forEach((row, index) => {
|
|
106
|
-
|
|
115
|
+
|
|
116
|
+
let rowID = row['rowid'] ? row['rowid'] : '';
|
|
117
|
+
row = Object.fromEntries(Object.entries(row).filter(([key]) => key !== 'rowid'));
|
|
118
|
+
|
|
119
|
+
tbodyHTML += `<tr data-row-id="${rowID}">${ Object.keys(row).map(col => `<td data-label="${ucfirst(unsnake(col))}" data-numeric="${numericValue(row[col])}">${row[col]}</td>` ).join("") }</tr>`;
|
|
107
120
|
});
|
|
108
121
|
tbody.innerHTML = tbodyHTML;
|
|
109
122
|
|