vi-grid-builder 0.0.2 → 0.0.4
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/ViGridBuilderPlugin.js +4 -0
- package/package.json +2 -2
- package/src/ViGridBuilder.vue +4 -0
- package/src/ViGridField.vue +31 -22
package/ViGridBuilderPlugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vi-grid-builder",
|
|
3
3
|
"main": "ViGridBuilderPlugin",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"vi-pagination": "^0.0.
|
|
12
|
+
"vi-pagination": "^0.0.5",
|
|
13
13
|
"vue": "^3.3.4"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
package/src/ViGridBuilder.vue
CHANGED
package/src/ViGridField.vue
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
<div class="vi-grid-field">
|
|
3
|
+
<component
|
|
4
|
+
v-if="fieldComponent"
|
|
5
|
+
v-bind:is="fieldComponent"
|
|
6
|
+
:field="field"
|
|
7
|
+
:value="filedValueFormatted"
|
|
8
|
+
:original-value="fieldValue"
|
|
9
|
+
:row="rowValue"
|
|
10
|
+
/>
|
|
11
|
+
<slot v-else name="custom-field"
|
|
12
|
+
:field="field"
|
|
13
|
+
:value="fieldValue"
|
|
14
|
+
:original-value="fieldValue"
|
|
15
|
+
:row="rowValue">
|
|
16
|
+
</slot>
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
</div>
|
|
16
19
|
</template>
|
|
17
20
|
|
|
18
21
|
<script>
|
|
19
22
|
const snakeToCamel = str =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
str.toLowerCase().replace(/([-_][a-z])/g, group =>
|
|
24
|
+
group
|
|
25
|
+
.toUpperCase()
|
|
26
|
+
.replace('-', '')
|
|
27
|
+
.replace('_', '')
|
|
28
|
+
);
|
|
26
29
|
const uppercaseFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
27
30
|
|
|
28
31
|
import ViGridBadge from "./fields/ViGridBadge.vue";
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
|
|
35
38
|
export default {
|
|
36
39
|
name: "ViGridField",
|
|
37
|
-
components:{
|
|
40
|
+
components: {
|
|
38
41
|
ViGridBadge,
|
|
39
42
|
ViGridImage,
|
|
40
43
|
ViGridText,
|
|
@@ -49,9 +52,15 @@
|
|
|
49
52
|
},
|
|
50
53
|
fieldValue: {},
|
|
51
54
|
rowValue: {},
|
|
55
|
+
noDataLabel: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: '/'
|
|
58
|
+
}
|
|
52
59
|
},
|
|
53
60
|
computed: {
|
|
54
|
-
|
|
61
|
+
filedValueFormatted() {
|
|
62
|
+
return this.fieldValue ?? this.noDataLabel
|
|
63
|
+
},
|
|
55
64
|
fieldComponent() {
|
|
56
65
|
let component = uppercaseFirstLetter(snakeToCamel(this.field.type))
|
|
57
66
|
|
|
@@ -66,5 +75,5 @@
|
|
|
66
75
|
</script>
|
|
67
76
|
|
|
68
77
|
<style lang="scss">
|
|
69
|
-
|
|
78
|
+
@import "ViGridField";
|
|
70
79
|
</style>
|