innoboxrr-vue-datatable 1.2.24 → 1.2.26
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
package/src/DataTable.vue
CHANGED
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
:data-table="dataTable"
|
|
87
87
|
:extra-params="extraParams"
|
|
88
88
|
:show-table-header="showTableHeader"
|
|
89
|
+
:data-table-components="dataTableComponents"
|
|
89
90
|
@sortColumn="sortColumn"
|
|
90
91
|
@actionButtonClicked="actionButtonClicked"
|
|
91
92
|
@actionClicked="actionClicked" />
|
|
@@ -189,6 +190,7 @@
|
|
|
189
190
|
meta: [],
|
|
190
191
|
links: []
|
|
191
192
|
},
|
|
193
|
+
dataTableComponents: this.model.dataTableComponents(),
|
|
192
194
|
sort: this.model.dataTableSort(),
|
|
193
195
|
orderBy: 'id',
|
|
194
196
|
internalSort: false,
|
|
@@ -29,11 +29,19 @@
|
|
|
29
29
|
v-for="head in dataTable.head"
|
|
30
30
|
:key="head.id"
|
|
31
31
|
class="px-6 py-4">
|
|
32
|
+
<template v-if="head.component">
|
|
33
|
+
<component
|
|
34
|
+
:is="getComponent(head.component)"
|
|
35
|
+
v-bind="setData(head, body)"
|
|
36
|
+
@callback="head.callback && typeof head.callback === 'function' ? head.callback($event, body) : null" />
|
|
37
|
+
</template>
|
|
32
38
|
<span
|
|
33
|
-
v-if="head.html"
|
|
39
|
+
v-else-if="head.html"
|
|
34
40
|
class="dark:text-white"
|
|
35
41
|
v-html="setData(head, body)"></span>
|
|
36
|
-
<span
|
|
42
|
+
<span
|
|
43
|
+
v-else
|
|
44
|
+
class="dark:text-white">{{ setData(head, body) }}</span>
|
|
37
45
|
</td>
|
|
38
46
|
<td v-if="actions" class="uk-text-right">
|
|
39
47
|
<button
|
|
@@ -89,6 +97,7 @@
|
|
|
89
97
|
|
|
90
98
|
<script>
|
|
91
99
|
|
|
100
|
+
import { shallowRef } from 'vue';
|
|
92
101
|
import NavDropdownComponent from './NavDropdownComponent.vue'
|
|
93
102
|
import IconRouteComponent from './IconRouteComponent.vue'
|
|
94
103
|
import IconLinkComponent from './IconLinkComponent.vue'
|
|
@@ -117,9 +126,26 @@
|
|
|
117
126
|
showTableHeader: {
|
|
118
127
|
type: Boolean,
|
|
119
128
|
default: true,
|
|
129
|
+
},
|
|
130
|
+
dataTableComponents: {
|
|
131
|
+
type: Object,
|
|
132
|
+
default: () => ({})
|
|
120
133
|
}
|
|
121
134
|
},
|
|
122
135
|
emits: ['sortColumn', 'actionButtonClicked', 'actionClicked'],
|
|
136
|
+
setup(props) {
|
|
137
|
+
// Registrar componentes dinámicos
|
|
138
|
+
const components = shallowRef(props.dataTableComponents);
|
|
139
|
+
|
|
140
|
+
// Resolver el componente dinámico desde el mapeo
|
|
141
|
+
const getComponent = (componentName) => {
|
|
142
|
+
return components.value[componentName] || null;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
getComponent,
|
|
147
|
+
};
|
|
148
|
+
},
|
|
123
149
|
methods: {
|
|
124
150
|
sortColumn(data) {
|
|
125
151
|
this.$emit('sortColumn', data);
|