innoboxrr-vue-datatable 2.2.0 → 3.0.0
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/README.md +130 -168
- package/index.js +13 -2
- package/package.json +6 -3
- package/src/DataTable.vue +249 -423
- package/src/components/DataTableComponent.vue +218 -176
- package/src/components/SelectPaginationComponent.vue +78 -93
- package/src/table.js +251 -0
- package/src/useDataTable.js +370 -0
- package/src/useTheme.js +20 -0
- package/src/components/DisabledLinkComponent.vue +0 -45
- package/src/components/IconLinkComponent.vue +0 -81
- package/src/components/IconRouteComponent.vue +0 -84
- package/src/components/NavDropdownComponent.vue +0 -55
- package/src/components/PaginationComponent.vue +0 -79
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
<a
|
|
4
|
-
class="block px-4 py-2 dark:hover:text-white dark:text-slate-400"
|
|
5
|
-
:href="link"
|
|
6
|
-
:target="target">
|
|
7
|
-
|
|
8
|
-
<Icon
|
|
9
|
-
class="fe-mr-sm"
|
|
10
|
-
:icon="resolved"
|
|
11
|
-
:width="size"
|
|
12
|
-
:height="size"
|
|
13
|
-
aria-hidden="true" />
|
|
14
|
-
|
|
15
|
-
<span :class="textClass">{{ text }}</span>
|
|
16
|
-
|
|
17
|
-
</a>
|
|
18
|
-
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup>
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Antes esto pintaba `<span class="uk-icon" uk-icon="icon: fa-plus">` y
|
|
25
|
-
* llamaba a `globalThis.UIkit.update()` al montar. Para que ese icono
|
|
26
|
-
* apareciera hacian falta tres dependencias que ningun package.json
|
|
27
|
-
* declaraba: uikit, fontawesome y uikit-custom-icons, que hacia de puente
|
|
28
|
-
* entre las dos.
|
|
29
|
-
*
|
|
30
|
-
* Ahora el nombre se resuelve contra el mapa de innoboxrr-form-core, que
|
|
31
|
-
* es el mismo que usa la rama React.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
import { computed, onScopeDispose, ref } from 'vue'
|
|
35
|
-
import { Icon } from '@iconify/vue'
|
|
36
|
-
import { iconFor, onIconChange } from 'innoboxrr-form-core'
|
|
37
|
-
|
|
38
|
-
const props = defineProps({
|
|
39
|
-
link: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: '#'
|
|
42
|
-
},
|
|
43
|
-
text: {
|
|
44
|
-
type: String,
|
|
45
|
-
required: true
|
|
46
|
-
},
|
|
47
|
-
icon: {
|
|
48
|
-
type: String,
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
ratio: {
|
|
52
|
-
type: Number,
|
|
53
|
-
required: false,
|
|
54
|
-
default: 1
|
|
55
|
-
},
|
|
56
|
-
textClass: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: ""
|
|
59
|
-
},
|
|
60
|
-
target: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: "_self"
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
// Un cambio de mapa en caliente repinta lo ya montado.
|
|
67
|
-
const version = ref(0)
|
|
68
|
-
|
|
69
|
-
onScopeDispose(onIconChange(() => version.value++))
|
|
70
|
-
|
|
71
|
-
const resolved = computed(() => {
|
|
72
|
-
version.value
|
|
73
|
-
|
|
74
|
-
return iconFor(props.icon)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
// `ratio` era el multiplicador de UIkit sobre 16px. Se conserva para no
|
|
78
|
-
// romper a quien ya lo pasa.
|
|
79
|
-
const size = computed(() => props.ratio * 16)
|
|
80
|
-
|
|
81
|
-
</script>
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
<router-link
|
|
4
|
-
:to="pathObject"
|
|
5
|
-
class="block px-4 py-2 dark:hover:text-white dark:text-slate-400">
|
|
6
|
-
|
|
7
|
-
<Icon
|
|
8
|
-
class="fe-mr-sm"
|
|
9
|
-
:icon="resolved"
|
|
10
|
-
:width="size"
|
|
11
|
-
:height="size"
|
|
12
|
-
aria-hidden="true" />
|
|
13
|
-
|
|
14
|
-
<span :class="textClass">{{ text }}</span>
|
|
15
|
-
|
|
16
|
-
</router-link>
|
|
17
|
-
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script setup>
|
|
21
|
-
|
|
22
|
-
import { computed, onScopeDispose, ref } from 'vue'
|
|
23
|
-
import { Icon } from '@iconify/vue'
|
|
24
|
-
import { iconFor, onIconChange } from 'innoboxrr-form-core'
|
|
25
|
-
|
|
26
|
-
const props = defineProps({
|
|
27
|
-
name: {
|
|
28
|
-
type: String,
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
// Vue 3 exige factoria en los defaults de objeto: un literal comparte
|
|
32
|
-
// la misma instancia entre todas las filas de la tabla.
|
|
33
|
-
params: {
|
|
34
|
-
type: Object,
|
|
35
|
-
default: () => ({})
|
|
36
|
-
},
|
|
37
|
-
query: {
|
|
38
|
-
type: Object,
|
|
39
|
-
default: () => ({})
|
|
40
|
-
},
|
|
41
|
-
text: {
|
|
42
|
-
type: String,
|
|
43
|
-
required: true
|
|
44
|
-
},
|
|
45
|
-
icon: {
|
|
46
|
-
type: String,
|
|
47
|
-
required: true
|
|
48
|
-
},
|
|
49
|
-
ratio: {
|
|
50
|
-
type: Number,
|
|
51
|
-
required: false,
|
|
52
|
-
default: 1
|
|
53
|
-
},
|
|
54
|
-
textClass: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: ""
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
// Estaba en data(), asi que se calculaba una sola vez al crear el
|
|
61
|
-
// componente: al reutilizar la fila para otro registro el enlace seguia
|
|
62
|
-
// apuntando al anterior.
|
|
63
|
-
const pathObject = computed(() => ({
|
|
64
|
-
name: props.name,
|
|
65
|
-
params: props.params,
|
|
66
|
-
query: props.query,
|
|
67
|
-
}))
|
|
68
|
-
|
|
69
|
-
// Un cambio de mapa en caliente repinta lo ya montado.
|
|
70
|
-
const version = ref(0)
|
|
71
|
-
|
|
72
|
-
onScopeDispose(onIconChange(() => version.value++))
|
|
73
|
-
|
|
74
|
-
const resolved = computed(() => {
|
|
75
|
-
version.value
|
|
76
|
-
|
|
77
|
-
return iconFor(props.icon)
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
// `ratio` era el multiplicador de UIkit sobre 16px. Se conserva para no
|
|
81
|
-
// romper a quien ya lo pasa.
|
|
82
|
-
const size = computed(() => props.ratio * 16)
|
|
83
|
-
|
|
84
|
-
</script>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
<div
|
|
4
|
-
:uk-dropdown="options"
|
|
5
|
-
class="fe-p-0 z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-slate-800 p-2">
|
|
6
|
-
|
|
7
|
-
<ul class="fe-menu">
|
|
8
|
-
|
|
9
|
-
<slot></slot>
|
|
10
|
-
|
|
11
|
-
</ul>
|
|
12
|
-
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup>
|
|
18
|
-
|
|
19
|
-
import { computed } from 'vue'
|
|
20
|
-
|
|
21
|
-
const props = defineProps({
|
|
22
|
-
pos: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: "bottom-left"
|
|
25
|
-
},
|
|
26
|
-
mode: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: "click"
|
|
29
|
-
},
|
|
30
|
-
offset: {
|
|
31
|
-
type: Number,
|
|
32
|
-
default: 0
|
|
33
|
-
},
|
|
34
|
-
animation: {
|
|
35
|
-
type: String,
|
|
36
|
-
// Es el nombre de una animacion de UIkit, no una clase nuestra: el
|
|
37
|
-
// dropdown sigue siendo de UIkit hasta que lo sustituya un componente
|
|
38
|
-
// headless propio.
|
|
39
|
-
default: "uk-animation-slide-top-small"
|
|
40
|
-
},
|
|
41
|
-
duration: {
|
|
42
|
-
type: Number,
|
|
43
|
-
default: 500
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const options = computed(() => `
|
|
48
|
-
pos: ${props.pos};
|
|
49
|
-
mode: ${props.mode};
|
|
50
|
-
offset: ${props.offset};
|
|
51
|
-
animation: ${props.animation};
|
|
52
|
-
duration: ${props.duration};
|
|
53
|
-
`)
|
|
54
|
-
|
|
55
|
-
</script>
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
<ul v-if="length > 3" class="fe-pagination fe-justify-center" fe-mb>
|
|
4
|
-
|
|
5
|
-
<li v-if="firstLink != null">
|
|
6
|
-
|
|
7
|
-
<a href="#" @click="emit('go', firstLink)">
|
|
8
|
-
|
|
9
|
-
<span fe-page-prev></span>
|
|
10
|
-
|
|
11
|
-
</a>
|
|
12
|
-
|
|
13
|
-
</li>
|
|
14
|
-
|
|
15
|
-
<li
|
|
16
|
-
v-for="link in middleLinks"
|
|
17
|
-
:key="link.label"
|
|
18
|
-
:class="{ 'fe-disabled': link.url == null, 'fe-active': link.active, }">
|
|
19
|
-
|
|
20
|
-
<a href="#" @click="emit('go', link.url)">
|
|
21
|
-
|
|
22
|
-
{{ link.label }}
|
|
23
|
-
|
|
24
|
-
</a>
|
|
25
|
-
|
|
26
|
-
</li>
|
|
27
|
-
|
|
28
|
-
<li v-if="lastLink != null">
|
|
29
|
-
|
|
30
|
-
<a href="#" @click="emit('go', lastLink)">
|
|
31
|
-
|
|
32
|
-
<span fe-page-next></span>
|
|
33
|
-
|
|
34
|
-
</a>
|
|
35
|
-
|
|
36
|
-
</li>
|
|
37
|
-
|
|
38
|
-
</ul>
|
|
39
|
-
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script setup>
|
|
43
|
-
|
|
44
|
-
import { computed } from 'vue'
|
|
45
|
-
|
|
46
|
-
const props = defineProps({
|
|
47
|
-
links: {
|
|
48
|
-
type: Array,
|
|
49
|
-
required: true,
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const emit = defineEmits(['go'])
|
|
54
|
-
|
|
55
|
-
const length = computed(() => props.links.length)
|
|
56
|
-
|
|
57
|
-
const firstLink = computed(() => length.value > 0 ? props.links[0].url : null)
|
|
58
|
-
|
|
59
|
-
const lastLink = computed(() => {
|
|
60
|
-
|
|
61
|
-
const last = props.links[length.value - 1]
|
|
62
|
-
|
|
63
|
-
return length.value > 0 && last !== undefined ? last.url : null
|
|
64
|
-
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
const middleLinks = computed(() => props.links.slice(1, -1))
|
|
68
|
-
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
<style scoped>
|
|
72
|
-
|
|
73
|
-
.fe-pagination > .fe-active > * {
|
|
74
|
-
color: #666;
|
|
75
|
-
font-weight: 600;
|
|
76
|
-
border-bottom: 3px solid var(--primary-color);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
</style>
|